Search Unity

TerraVol: volumetric/voxel terrain system. Dig holes caves in your terrains!

Discussion in 'Assets and Asset Store' started by Amfu, Apr 9, 2013.

  1. GXMark

    GXMark

    Joined:
    Oct 13, 2012
    Posts:
    514
    FLAT SURFACES

    Can TerraVol 2 easily create in world flat surfaces from say a slopy region. I always found this aspect no so easy to achieve with voxel engines given that it seems so simple. Does the editor example achieve this simply or am i missing something?
     
  2. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    Don't worry, I'm here :)
    You know, most of the publishers don't get enough income from their asset to live from this only. That's my case and I have a full time job beside TerraVol, which can be exhaustive/ask extra hours/etc., that's why sometimes I can't answer quickly. I apologize for that.
    But don't worry TerraVol is still under active development!

    Yes you can achieve this thanks to the editor tool or even while playing your game thanks to to Builder component. Just select the action named "flatten", adjust the height you want to obtain (for example y=100) and then just click on the terrain to set an area to this height.
     
  3. mathias234

    mathias234

    Joined:
    Sep 9, 2012
    Posts:
    239
    Ok to reproduce the steps i done

    first imported the TerraVol package then i made a C# script called SaveTest

    and in the SaveTest i wrote these codes

    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class SaveTest : MonoBehaviour {
    5.     TerraMap map;
    6.     GameObject mapObject;
    7.     Rect SaveMenuRect = new Rect(Screen.width / 2 - 100, Screen.height / 2 - 125, 200, 250);
    8.  
    9.     // Use this for initialization
    10.     void Start () {
    11.         mapObject = GameObject.Find ("Map");
    12.         map = mapObject.GetComponent<TerraMap> ();
    13.     }
    14.    
    15.     // Update is called once per frame
    16.     void Update () {
    17.    
    18.     }
    19.  
    20.     void OnGUI () {
    21.         SaveMenuRect = GUI.Window(1, SaveMenuRect, SaveMenu, "Save Menu");
    22.  
    23.     }
    24.  
    25.     void SaveMenu(int id)
    26.     {
    27.         if(GUILayout.Button("Save")){
    28.            
    29.             map.Save("C:/Saves/1.terra");
    30.         }
    31.         if(GUILayout.Button("Load")){
    32.             map.Load( "C:/Saves/1.terra");
    33.            
    34.         }
    35.     }
    36.  
    37. }
    38.  
    then i attach the script to the player

    then i go ingame edit the terrain using the infinite world example scene and the builder script

    click save then edit a bit more and then click load nothing happens the save file is in c:/Saves/1.terra but it dosent seem to load it. It says the file size is 173
     
  4. DesertRaven

    DesertRaven

    Joined:
    Jul 15, 2012
    Posts:
    137
    I'm a bit confused about this asset, does this work on or together with the unity terrain? Is there a limitation in terrain size? Can I use several terrains in one scene?
     
  5. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    Terravol is looking really good. I like the improvements in V2. There's one thing that's not entirely clear to me from the documentation though: Does Terravol allow chunk paging? Essentially, I'm hoping to make an "infinite" world that might be far too large to fit in memory. Does the Terravol API include functionality to allow me to load/unload chunks based on distance or other criteria? I see mention of loading/saving the whole map, and on hiding chunks that are beyond a certain distance, but it's hard to tell if this does exactly what I'm looking for or not.

    Thanks!
     
  6. mathias234

    mathias234

    Joined:
    Sep 9, 2012
    Posts:
    239
    It has a example scene where it shows infinie world with load / deload
     
  7. mathias234

    mathias234

    Joined:
    Sep 9, 2012
    Posts:
    239
    I am no expert in this but i would say is a mesh and it really has nothing to do with the buildt in unity terrain and no there is no limitations you can set it but basicly you can have as big terrain as you want
     
  8. DesertRaven

    DesertRaven

    Joined:
    Jul 15, 2012
    Posts:
    137
    Mat, thank you for your reply I just hope to get an expert answer from this developer on my questions as well. Do you use this asset? Does it work for your projects?
    What I'm intending to do is to generate a vast environment for a massive game. I have looked around to find a tool to create caves arches and cliffs to add to my terrain/s. So I'm trying to find out how this could help realize my goal.
     
  9. BES

    BES

    Joined:
    Feb 26, 2013
    Posts:
    212

    I have had this asset for a while ...but haven't tried using it until last night...

    I wanted to add terrain to a flat surface ...non terrain piece (probuilder mesh) ...but it didn't work ...kept getting a series of errors..

    The goal is to lay a terrain patch to the inside of an octagonal piece ...for a Dyson sphere type colony ship ...figured this asset would/could do it ..but now im not sure..
     
  10. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180

    Everything you have done is correct, except that you are trying to load the terrain while it is already loaded. The "Load" method is made to load a blank terrain only (at start). What you want to do is actually a reload. You're lucky, there is already a method which makes this for you in the TerraMap component: Reload(); :)

    If you simply change your code to this, it should work :
    Code (csharp):
    1. void SaveMenu(int id)
    2.     {
    3.         if(GUILayout.Button("Save")){
    4.            
    5.             map.Save("C:/Saves/1.terra");
    6.         }
    7.         if(GUILayout.Button("Load")){
    8.             map.Reload();
    9.            
    10.         }
    11.     }
    Let me know if this works for you.
     
  11. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    TerraVol has nothing to do with the standard terrain. You can use both, but you don't need to.
    There is theoretically no limitation in terrain size even if the current version has some performance issues when the terrain becomes to big. I'm working on a pooling system to solve that. But anyway, remember there are some difficulties to make an infinite world that are inherent to programming and aren't the fault of TerraVol: http://answers.unity3d.com/questions/50187/floating-point-accuracy-weirdness.html

    No, you can't use several TerraVol's terrains in one scene. You can have only one. But as long as it is infinite and supports multiple materials (unlimited), there is no reason why you would need to have several ones.
     
  12. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    Terrains are already infinite, but you will have to wait for the next version to get the chunk pool and avoid using all the memory.
     
  13. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    I'm not sure to understand what you want to do, but TerraVol can't use a mesh you imported and convert it into a terrain. Maybe I misunderstood though?
     
  14. mathias234

    mathias234

    Joined:
    Sep 9, 2012
    Posts:
    239
    the reload method reloads from last save am i right?
     
  15. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    It reloads from the file that is set in "load path" property of the Map component. As the Save method automatically sets this to the last save, yes you should be reloading your last save.
     
  16. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    289
    Ah, excellent. That's exactly what I wanted to know. Do you have an ETA on this feature?

    Thanks!
     
  17. mathias234

    mathias234

    Joined:
    Sep 9, 2012
    Posts:
    239
    amm the load is really buggy it wont continue to generate terrain after it is reloaded
     
  18. Autarkis

    Autarkis

    Joined:
    Oct 10, 2011
    Posts:
    318
    Hey Amfu,
    You mentioned a few pages ago that you were planning to add heightmap to voxel in TerraVol in 2.1 or 2.2 and that it may be out in January. Just wondering what the status on that was? It's a feature that would make this perfect in my eyes.
     
  19. mathias234

    mathias234

    Joined:
    Sep 9, 2012
    Posts:
    239
    Edit:
    I just didnt realize that it turned of build dynamicly
     
  20. TehWardy

    TehWardy

    Joined:
    Mar 20, 2013
    Posts:
    38
    WOW ...

    Several hours of reading later i really feel Amfu's pain here.

    Ok so ...

    A little moan
    There must have been at least 10 people that didn't understand the basic idea of a voxel or the idea behind the marching cubes algorithm and just as many that just plain didn't bother to read the thread to check that their answer had already been given !!!


    Big shout out for Amfu
    Amfu,
    I think you have done a great job here defending some real talent against some sometimes just plain daft questions.

    Someone earlier mentioned the voxelfarm engine, and building a similar toolset for terravol, truely amazing, even more so at this price!
    The RTP shader looks amazing when combined with this voxel world please keep working with Tom Amfu as it sounds like you guys can really work some magic !!!


    Now for my question(s)
    I have a slightly different need in my world where im hoping terravol might be able to help ...
    My game world is basically comprised of "floating islands" think avatar movie (the floating islands of pandora).
    I was hoping I could use a game object with a terravol component on it to render each island.

    I tried this with a few other alternatives and found the following ...
    1. They couldnt cope with more than about 3 or 4 islands in the scene because of daft things like transform handling code assumed "typical terrain generation" (its fair to say my terrain is pretty atypical).
    2. They often had to be "hacked" so i could put my own generation code in there.
    3. They were just plain buggy and couldn't cope with large amounts of data.


    I'm hoping that the pooling + LOD in terravols next version will make my world possible and will solve that but if i have a terravol object in the distance will it determine the LOD by checking the distance from the camera or will it default to the wrong LOD?

    My theory is that I should be able to get a pretty good draw distance because my world is full of whitespace with the odd blob of terrain in it, does this sound reasonable from what others know about terravol / Amfu?
    I would ideally like to have a parent component (might have to build this myself), that i can just keep throwing data at and then it will determine what can be rendered at what time in order to keep the frame rate around the ideal 60FPS.
    To that parent component I would give it lots of terravol components and have it figure out when to generate and build each based on camera position.
    I'm thinking quadtree/octree type behaviour.

    More recently i've been looking at using compute shaders to generate the data on the GPU and then render the buffers directly from there to obtain the level of performance I am after ... does terravol use any GPU based time for anyhting like generation?

    Have you considered using the GPU at all?
    I know what I would do to solve the view range problem on voxel engines but its the how that gets me, GPU's are a mighty beast to tame!
    It's how I ended up here oddly enough, I was trying to see if anyone had done it before me ... apparently not!!

    Think about it, if you pass a seed value and a position to the GPU and nothing else you save yourself a lot of time pushing vertex info around and your raw data would live where the magic happens!


    Other notes
    On terrain generation ... nVidia talked about this extensively in GPU gems 3, using around 8 octaves of noise combined with "warping" should allow truely "life like" terrain to be generated with overhangs and such, however this would take a long time on the cpu.
    I have quite a bit of code for doing this on the GPU which I think could be interesting if plugged in to terravols mesh generation and rendering code.

    I am seriously tempted to buy terravol but like many others on here I have had a few let downs with components that couldn't handle what i wanted, it would be cool if terravol had a way that i could just keep throwing data at it and it just "figure out" how to keep my frame rate high (like explained above), this I think is the one thing that is what you pay for with the big expensive commercial engines, the optimisation and a few more tools to work with the engine (but why do we need tools we have unity after all).
     
  21. rbneville

    rbneville

    Joined:
    Apr 2, 2011
    Posts:
    15
    Quick question for you. Is it possible using TerraVol to create a empty map and use my own script to populate the map with chunks and blocks? If so how would I go about this?

    Thanks for your time,
    Richard.
     
  22. TehWardy

    TehWardy

    Joined:
    Mar 20, 2013
    Posts:
    38
    Of course it is ... read back through this thread and the description of what terravol does.
     
  23. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,642
    hello,

    compared to the unity terrain engine, how slower is this one?
     
  24. mathias234

    mathias234

    Joined:
    Sep 9, 2012
    Posts:
    239
    Its a voxel engine ofc its a bit slow but its really fast to be a voxel engine
     
  25. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    Thank you for your encouragement, and sorry for the late reply!
    It is nice to see that some people take time to learn and understand voxel worlds :)

    Making floating islands with TerraVol is entirely possible but you will have to customize terrain generation in TerrainGenerator.cs to fit your needs. Terrain is generated column by column so it quite simple to understand it.

    You will have to make your world with one terrain only. TerraVol only supports one terrain in a scene at a time. But this shouldn't be a problem nor a limitation in any case as:
    • terrain is infinite (wait for the next version to get the pool system and keep constant memory usage)
    • it supports multiple (as many as you want) materials

    LOD will arrive later unfortunately.

    I've already looked into GPU solutions by the past, but I'd finally decided to stay on the CPU for several reasons:
    • it would be harder to customize terrain generation on the GPU, especially if you want to manage different biomes
    • it would be harder to handle terraforming
    • you couldn't create colliders for the terrain
    • in general, having the terrain data in RAM (ie. handled by the CPU) will allow a lot more interaction between it and other stuff in your scene (AI, pathfinding, multiplayer synchronization, etc.)
    • and I like to let the GPU handle "pure" rendering. You'll want to use triplanar shaders with parallax mapping on the terrain, which is already asking a lot to the GPU, and terrain won't be the only thing in your scene, especially if you want to use GI or stuff like that.


    I'm not saying GPU solutions are bad! It has many big advantages but it isn't easy-enough to use and generic/customizable-enough for TerraVol which has to fit the needs of a lot of games.
     
  26. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    Yes it is possible to do that :)
    You should customize TerrainGenerator.cs so it creates empty space (for example by always returning a block with a value of 1f).
     
  27. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    @mathias234 TehWardy

    Thanks a lot for giving some answers to other people :)
     
  28. TehWardy

    TehWardy

    Joined:
    Mar 20, 2013
    Posts:
    38
    This might be a problem for me as I need to move the islands independently of each other unless they are connected in some way (like by a bridge), this is what makes my problem particular complex in your case.

    Is there a way I could make Terravol work this way easily?
    What is the cause of this limitation?

    Interesting, other voxel engines allow fixed sizes of voxel volumes that you can position anywhere in the world, does TerraVol not havea such a capability?


    Can I also customise it so that it only generates for a set distance from a set position (for example: only generate 128 * 128 columns of voxels at a max height of 128 from the point of origin of the current game object).
    This would solve my problem ... (if i could make more than 1 terravol object)


    Always good to help out a fellow developer :) More so when the questions being asked have already been answered by you lol!!
     
    Last edited: Feb 17, 2014
  29. mathias234

    mathias234

    Joined:
    Sep 9, 2012
    Posts:
    239
    I am having a little probleme after loading a map that it seems to be unable "Sometimes" just build where you was before you saved and wont build more as the player moves

    I do loading this way:

    My TerraMap component and TerraMapGenerator is started off as disabled
    then when the player choose what save it wants to load my scripts fills the loadPath in TerraMap with the path then do alot of other stuff for the player this does not matter for the terrain then it enables first the MapGenerator then the map after that to make sure it all loads i do map.Reload to reload the terrain to the save

    this is the only way i manage to do this as the loading of map happens in Awake and awake dont care if the script is disabled or not

    i also made sure that build dynamicly is checked
     
  30. VataRaven

    VataRaven

    Joined:
    May 24, 2013
    Posts:
    180
    A part of me wishes that you and the guy that made TerrainComposer, would just work together and combine your 2 terrain engines

    You have the nice voxel modeling, even the grass generator, while the Composer covers the nice terrain generator.

    Can your voxel modeling be used on other terrain done from other assets?
     
  31. DDDiscover

    DDDiscover

    Joined:
    Dec 10, 2013
    Posts:
    17
    Related question:

    Can I combine the TeraVol terrains with the standard terrains from Unity?
     
  32. DDDiscover

    DDDiscover

    Joined:
    Dec 10, 2013
    Posts:
    17
    Is it possible to work with different level of details (LODs) for better performance?
     
  33. VataRaven

    VataRaven

    Joined:
    May 24, 2013
    Posts:
    180
    So...could this work with Terrain Composer?
     
  34. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    @Amfu,

    I'm a mobile developer.

    Bought the package to support the project but have not been able to use it because waiting for Mobile support for quite some time now.

    Can you give some ETA on Mobile support.

    Cheers.
     
  35. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    Hi everyone!

    As you have probably noticed, I haven't been able to answer you last week because I was in holidays.
    It has been a wonderful time for me as I asked my girlfriend to marry me and she said yes! :D

    Anyway, back on topic.

    @Rocki
    It's quite hard to say, unfortunately I can't promise anything about mobile yet. I'm finishing v2.1 that improves perfs but won't be enough for mobile I think.

    @VataRaven
    No currently there is no way you can make TerraVol work with Terrain Composer because TerraVol has nothing to do with standard terrains and doesn't even support heightmaps yet.

    @DDDiscover
    As I said to VataRaven, TerraVol has nothing to do with standard terrains, but you can have both TerraVol terrain and standard terrain in the same scene if you want. They just won"t interact with each other.
    Unfortunately, LOD isn't supported yet.

    @Mathias234
    When you call "Reload", is the terrain actually reloaded as you expect? After that, are the TerraMap and TerraMapGenerator components enabled?
     
  36. VataRaven

    VataRaven

    Joined:
    May 24, 2013
    Posts:
    180
    thanks for the reply
     
  37. mathias234

    mathias234

    Joined:
    Sep 9, 2012
    Posts:
    239
    Welcome back, I am happy to hear that you are getting married :)

    OT:
    Yes to both it reloads and they are enabled
     
  38. Setmaster

    Setmaster

    Joined:
    Sep 2, 2013
    Posts:
    239
    Can this be used with terrain/worldcomposer?
     
  39. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    @Amfu,

    Big Congratulations on your successful proposal to your future wife.
    Must of been a very special moment when you popped the question.
    Nice One.
     
  40. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    @Mathias234
    Thank you very much! :)
    I don't see why this doesn't work. I would need to have your scene and stuff to find what's going on. Could you reproduce the problem on a very simple scene in a blank project and send the all project to me? I'm sorry this is the only thing I can do.

    @Setmaster
    As you're not the first one to ask me this, I put a note on the first page about this. The short answer is no, this is not compatible with standard terrains and world composer.

    @rocki
    Thank you very much Rocki :)
    Yes it was definitely a wonderful moment!
     
  41. mathias234

    mathias234

    Joined:
    Sep 9, 2012
    Posts:
    239
    Sure ill send you it when its done!
     
  42. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    To make Amfu even more happy (congrats on your incoming marriage !) and satisfy user needs I can just rewrite what I answered somebody on my RTP thread:

    RTP3.1 + voxel terrains is now very successful mariage :). We've got no restrictions or requirements on mesh used. Basically you can get results with very simple mesh where only normals are defined (no uv, tangents which are calculated inside shader for triplanar, nor vertex colors are necessary to make it working).

    1. 4 layers (+snow as "virtual 5th layer). New shader allows to use geom blend on it (works fine for moderately steep surfaces), so - if you consider making terrain not dynamically, you can decorate it with more "virtual layers" (sticked meshes)

    2. blending - either vertex colors or via normals - configurable (like flats - 1st layers, sides / cliffs - 2nd layers, etc.). So - you don't need to define anything and variation on texturing will appear automatically (via world/local normals). Additionaly - you can use 2-4 layers. With less than 4 layers you've got 1 or 2 vertex color channels free (BA) for snow/water coverage control and for optional AO control (good to darken cavern interiors w/o necessity to self shadow it with realtime shadows)

    3. almost all RTP features are now supported that are available in triplanar (no POM nor aniso, 4 layers only)

    4. PBL - yes

    Should satisfy most users that like to use RTP power on ANY mesh (esp. these voxel ones).
    A (small) drawback - you need to configure shader features used by hand in shader code - commenting/uncommenting feature #defines and property blocks (so you don't see properties of features disabled in shader to not get confused). No such thing like "LOD manager" for voxel terrain shading solution. This is the same as in RTP3, but I've sorted out new shader code the way configuration is simplier and more logical.

    ATB, Tom
     
  43. Also

    Also

    Joined:
    Jul 17, 2013
    Posts:
    16
    Any ETA for 2.1? Is map generation from heightmap coming with 2.1?
     
  44. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    @Tomaszek
    Thank you very much Tom!
    This is an excellent news for all TerraVol users. I'm finishing v2.1 right now so I haven't much time, but I will definitely download RTP 3.1 update and see what I can do with it.

    @Also
    ~2 weeks
    I hope heightmap will be supported. If I don't encounter any big problem this will be the case.
     
  45. ElusiveJacob

    ElusiveJacob

    Joined:
    Mar 10, 2014
    Posts:
    7
    Hi Amfu. We recently bought the terravol package to test it out for a game we are building. Personally I love how it handles edits and vertical texturing, and most of the features are great. However it comes at too great draw-call cost from the way we are using it now.

    My questions are:

    1. Do you have a set of rules to follow to reduce the draw calls? Any tips and tricks not mentioned in the documentation?

    2. If the above tricks don't bring it down low enough, and seeing as we don't need the real-time editing features, is there a way we could bake out the terrain we make into a static mesh?

    Thanks for your time, and thanks for an awesome package!
     
  46. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    Thanks for your positive feedback ArachnidJacob :)

    1. Unfortunately no. The amount of draw calls comes from the fact we have one mesh per chunk.

    2. Sure you can. There is no buit-in function do handle that, but if you use a mesh combiner + a mesh exporter you will be able to save the terrain as a single mesh, in a .obj for example.
     
  47. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    "1. Unfortunately no. The amount of draw calls comes from the fact we have one mesh per chunk."

    Would it be possible to use a technique like MeshBaker from the asset store to combine these chunks ?
     
  48. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    If your terrain is static (ie. you do not perform real-time modification and it has a limited size so dynamic generation is disabled) then yes. Otherwise I'm quite sure this would drop your frame rate (combining meshes takes time!).
     
  49. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    MeshBaker has a feature where for dynamic moving meshes one can choose to treat a normal MeshRenderer as a SkinMeshRenderer and it will be much faster leveraging the fact that Unity uses very fast c++ code to handle SkinMeshRenderer. MeshBaker has an example of how this works.

    Combining meshes take time, however, there are various ways to do this so that it lessens the impact. For instance, by using a smart culling system that can determine the relevant parts to combine depending what is in view together with a background thread that does the heavy duty work of mesh combining calculations.

    TerraVol is a great product and it was the first Voxel generation tool on the Asset store. The draw call issue is definitely a sore spot that can definitely be improved upon.
     
  50. mathias234

    mathias234

    Joined:
    Sep 9, 2012
    Posts:
    239
    I dont think i will be able to gve the demo as i have given up my project using terravol