Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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

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

  1. PvTGreg

    PvTGreg

    Joined:
    Jan 29, 2014
    Posts:
    365
    you know the ingame builder and scene builder scripts use them
     
  2. DJ_Design

    DJ_Design

    Joined:
    Mar 14, 2013
    Posts:
    124
    Remember doing this will most likely cause framerate drop from whatever you're at now :) Just a word of advice
     
  3. unsubstantiation

    unsubstantiation

    Joined:
    Nov 21, 2014
    Posts:
    6
    I tried searching the forum but could not find a definitive answer. Does this system allow for importing heightmaps or textures? For me atleast heightmaps would be quite important. could somebody who knows for sure please tell me.
     
  4. DJ_Design

    DJ_Design

    Joined:
    Mar 14, 2013
    Posts:
    124
    Yes TerraVol includes such a feature.
     
  5. Hydroliquid

    Hydroliquid

    Joined:
    Dec 1, 2014
    Posts:
    2
    why is there no tutorial on how to use this? I just bought it and cant figure out how to use it.
     
  6. repettom

    repettom

    Joined:
    Oct 22, 2014
    Posts:
    5
    Hey guys, I am looking into buying TerraVol but I was wondering if it works with the latest version of Unity, that is version 4.6 release. Can any of you confirm. Many thanks!
     
  7. DJ_Design

    DJ_Design

    Joined:
    Mar 14, 2013
    Posts:
    124
    Can't see a reason why it would fail honestly. I havint been on in a while so i might just be crackers, But if in the case it dosint work just pm the developer or something, He seems active in that area
     
  8. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    Hi @Theekshana A
    You can use the editor to dig caves the way you want. You can also customize TerrainGenerator.cs to generate caves automatically but this will be a lot harder to do.

    @PvTGreg & @VataRaven :
    For now I don't have time to port it to Unreal Engine but I will consider it one day. As Unreal Engine uses C++, it will be easier to make it fast.
    BUT: unlike PvtGreg said, you don't have the right to buy TerraVol and port it to Unreal Engine by yourself! TerraVol is NOT open source. Please read the Asset Store licence.
     
  9. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    @repettom & @Lechado : yes this should work with 4.6, if you encounter any compatibility issue please contact me :)
    I know for sure TerraVol is not fully compatible with Unity 5 beta, but this won't be hard to fix and I will of course update TerraVol to make it compatible with Unity 5.x.
     
    Arkade likes this.
  10. ProjectFirstChance

    ProjectFirstChance

    Joined:
    Nov 29, 2014
    Posts:
    3
    Hi Author,

    I have a few questions to start with. (I have sent you an email. But posting it here just in case the question might be helpful)(Using Unity 4.6)

    1.As per the documentation, I have to add a 'Block' to the 'BlockSet'. Are you talking about doing it in the script using "blocks.Add..."? Can you please provide some details on what is to be done?
    2.When I build my project, I get the below errors. Can you please let me know what I am missing here.

    c:\Users\joshua\Documents\RunEpisode0\Assets\TerraVolPack\TerraVol\Scripts\Editor\ChunkEditor.cs(7,7): Error CS0246: The type or namespace name 'TerraVol' could not be found (are you missing a using directive or an assembly reference?) (CS0246) (Assembly-CSharp-Editor)
    c:\Users\joshua\Documents\RunEpisode0\Assets\TerraVolPack\TerraVol\Scripts\Editor\TerraEditor.cs(7,7): Error CS0246: The type or namespace name 'TerraVol' could not be found (are you missing a using directive or an assembly reference?) (CS0246) (Assembly-CSharp-Editor)
    c:\Users\joshua\Documents\RunEpisode0\Assets\TerraVolPack\TerraVol\Scripts\Editor\TerraMapGeneratorEditor.cs(7,7): Error CS0246: The type or namespace name 'TerraVol' could not be found (are you missing a using directive or an assembly reference?) (CS0246) (Assembly-CSharp-Editor)
    c:\Users\joshua\Documents\RunEpisode0\Assets\TerraVolPack\TerraVol\Scripts\Editor\ChunkEditor.cs(10,10): Error CS0246: The type or namespace name 'Chunk' could not be found (are you missing a using directive or an assembly reference?) (CS0246) (Assembly-CSharp-Editor)
    c:\Users\joshua\Documents\RunEpisode0\Assets\TerraVolPack\TerraVol\Scripts\Editor\TerraEditor.cs(10,10): Error CS0246: The type or namespace name 'TerraBuilder' could not be found (are you missing a using directive or an assembly reference?) (CS0246) (Assembly-CSharp-Editor)
    c:\Users\joshua\Documents\RunEpisode0\Assets\TerraVolPack\TerraVol\Scripts\Editor\TerraMapGeneratorEditor.cs(10,10): Error CS0246: The type or namespace name 'TerraMapGenerator' could not be found (are you missing a using directive or an assembly reference?) (CS0246) (Assembly-CSharp-Editor)

    Good night.
     
  11. z3nth10n

    z3nth10n

    Joined:
    Nov 23, 2013
    Posts:
    55
    Hello @Amfu, I have question, it's possible to change roughness and granularity (TerraMapGenerator parameters) on TerraVol Enhance script,

    I want to change these variables when it's generating the Terrain, for example:

    Code (CSharp):
    1. public Block OnBlockGenerateBeforeInThread (Vector3i position)
    2. {
    3.  
    4.     if (position.x > 10) {
    5.         return aBlock;
    6.     } else if (position.x < 10) {
    7.         return anotherBlock;
    8.     }
    9.     return null;
    10. }
    There are two biomes, and well, I want to change the variables, for example, to make Extreme Hills like in Minecraft...

    Is there anyway to do this?

    Thanks.

    ===================================================================

    Edit:
    I use Random.seed for all Random.value, but for some reason now the generation lasts twice... I don't know why :/

    PS: Sorry for bad english :/
     
    Last edited: Dec 6, 2014
  12. ProjectFirstChance

    ProjectFirstChance

    Joined:
    Nov 29, 2014
    Posts:
    3
    Hi,
    Can someone please help me set up the scripts.
    I have imported the package straight from the unity store.
    But when I try to build I get the error "Type or Namespace Terravol could not be found" (The same error for Chunk, Terrabuilder, TerraMapGenerator).
    Any help will be highly appreciated.

    [I initially have posted two questions. But now I think I figured the first one out.]

    Thanks.
     
  13. danicrem

    danicrem

    Joined:
    Nov 9, 2014
    Posts:
    45
    Is it possible to make very small holes with terravol? I need sharp 10cm wide en 5cm deep holes and 30 cm wide and 15cm deep holes. Is it also possible to undo the digging, so that holes can be filled again to the original state?
    Is it possible to convert a 3d mesh terrain to a terravol terrain? Then I could design it in blender and convert it to a voxel terrain.
    Last question: is it possible to create blocks that cannot be deformed? So you can't dig beneith trees, buildings and rocks.
    Daniel
     
  14. ProjectFirstChance

    ProjectFirstChance

    Joined:
    Nov 29, 2014
    Posts:
    3
    Hello Amfu..
    Pretty nice package..once I got to learn it, it is proving to be very useful..
    most of the difficulties for me was because I am also a beginner in c#, and very rusty in my c, cpp,java etc..like 5 -6 years rusty..
    But after digging through your code..i am refreshing all my basics and advanced learnings..
    Also I am looking to hook into various locations of the code to accomplish certain things..for experiments
    Thanks for no help ;-)
    That 2* review is still staying. But definitely a great package...
     
  15. Shark711

    Shark711

    Joined:
    Mar 2, 2014
    Posts:
    4
    Good day Author,
    Excuse my ignorance but a simple search didn't yield any results.
    Do you perhaps have a simple example of this being used with the standard unity Networking solution?
    I've read that I should share only the "generation parameters", do these change as the map is getting deformed? If not, take the example of a map constantly being changed, and a game server that is a couple of months old, if you have to share those parameters (to generate the original terrain) then reapply all changes throughout the lifespan, you can imagine how long such a load will take (assuming you have multiple players doing constant changes to the terrain.

    Any and all comments are welcome, I'm quite interested to know what would be the best approach to this. (I am hoping the generation parameter are also updated as the terrain changed, but it doesn't seem that is the case)
     
  16. repettom

    repettom

    Joined:
    Oct 22, 2014
    Posts:
    5
    @Amfu ok thanks!.. I will buy now and also RTP 3.1. Any special thing I need to know in order to get the 2 working together?

    Thanks!
     
  17. furiouslol

    furiouslol

    Joined:
    Aug 19, 2014
    Posts:
    19
    Hi!

    I've started playing around with setting up biomes as per the documentation. It seems for some reason that even though I ask to use a certain block after position.x > 10 (for example), things get weird


    I've set up my blocks and assigned a material for each (ensuring the right index is used for each). I didn't add any 'blending' blocks as of yet, since I'm not overly fussed at this stage.

    My understand of the biome system would be once position.x > 10, everything over that would be using the material specified - so I dont really know why this has gone a bit screwy.

    Not only this, but every now and then Ill get a single square or two with a different material used.

    Has anyone had this happen to them, or any advice/hints on what could be causing this? I've looked at the affected chunks individually and notice 2 materials assigned to it (as I would have imagined), not sure if this is normal or not either.

    Thanks!
     
  18. rohmer

    rohmer

    Joined:
    Mar 24, 2014
    Posts:
    23
    Hello,
    I am working with TerraVol and am having a bit of an issue seeing how to do something.

    I have a terrain generator I have written that I like, it exports a mesh. I want to convert the mesh into a TerraVol terrain, this is what I am having a bit of an issue with.

    Any suggestions?
     
  19. Theekshana-A

    Theekshana-A

    Joined:
    Sep 27, 2014
    Posts:
    81
    Thx for the reply, We will try our best!.
     
  20. Theekshana-A

    Theekshana-A

    Joined:
    Sep 27, 2014
    Posts:
    81
    How do you generate villages and custom trees and dungeons and caves with this?
     
  21. Theekshana-A

    Theekshana-A

    Joined:
    Sep 27, 2014
    Posts:
    81
    well yes
     
  22. furiouslol

    furiouslol

    Joined:
    Aug 19, 2014
    Posts:
    19
    Amfu already told you. Use TerrainGenerator.cs, you'll have to code it yourself, though.
     
  23. Theekshana-A

    Theekshana-A

    Joined:
    Sep 27, 2014
    Posts:
    81
    Oh right.
     
  24. furiouslol

    furiouslol

    Joined:
    Aug 19, 2014
    Posts:
    19
    Quick question for anyone who's thought about it in the past:

    How easy would it be to get 2 grass materials rendering? Has anyone done it? I've given it a crack but it seems my second grass material replaces the first one.
     
  25. catalys

    catalys

    Joined:
    Dec 29, 2014
    Posts:
    6
    Is it possible to randomly generate biomes like with perlin noise instead of the x position for it.
     
  26. XPAction

    XPAction

    Joined:
    Jan 13, 2014
    Posts:
    11
    I have tryed with no luck (C# beginner).. maybe an array of grass materials will do the job?
     
  27. furiouslol

    furiouslol

    Joined:
    Aug 19, 2014
    Posts:
    19
    I've tried that. I dont know TerraVols code well enough (to be fair, only just started looking at it when wanting to try this).

    For some reason my new grass replaces the old one (i.e., only the second 'new' material is used).

    Edit: Another thing I'm curious about...

    Any way to destroy blocks within the chunks instead of the whole chunk itself? I find the size that gets destroyed way too big currently.

    Thanks!
     
    Last edited: Dec 30, 2014
  28. Variable Argument

    Variable Argument

    Joined:
    Jan 2, 2015
    Posts:
    1
    Does anyone one know if it's possible to create like, a floating island with Terravol?
     
  29. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    654
    Yes, definitely possible.
     
  30. z3nth10n

    z3nth10n

    Joined:
    Nov 23, 2013
    Posts:
    55
    It's possible to mix this with Terra vol? Have anybody tried that?

    --------------------------------------------------------------------------------------------------------------------------------

    I'm experiencing little peaks of low FPS, anybody has also this issue? :/

    Edit: Using profiler, now, I know the reason of these peaks:

     
    Last edited: Jan 6, 2015
  31. kjeksen

    kjeksen

    Joined:
    Jan 10, 2015
    Posts:
    2
    Hey guys. "quick" questions as im looking into TerraVol v2.

    Is it possible to make layers of Blocks of different kind and that will be stored as made. So when user "digs" in the game
    the Block type will appear? Example. User digs through the grass and comes to sand, further Down he/she comes to "stone".

    Is it also possible to set max amount of digging With TerraVol?
     
  32. DJ_Design

    DJ_Design

    Joined:
    Mar 14, 2013
    Posts:
    124
    I believe you can accomplish this through if(chunk.y <= 5) {enable stone/sand block here}

    Havint read into it much but i imagine what you want to do is possible with a bit of simple code.

    "is it also possible to set max amount of digging with TerraVol" If you are talking about a dig limit down (Compared to say Bedrock in minecraft) Then yes it is possible with the TerraVol blockset system (isdestructable) Or you can set a limit to how low the ground can be built and that will cause the bottom of the terrain to be indestructable. I'm not sure about the layers you wanted to create (Might have to ask the dev about that) But i hope i helped in some way :p
     
  33. kjeksen

    kjeksen

    Joined:
    Jan 10, 2015
    Posts:
    2
    The max amount of digging is fine with indestructablw.

    But i want to make certain ground areas of the map of a different type of ground, but when I dig it in game mode, my dig blocks appear. Is it any way to "store" the type of ground / blocks that have been placed? Or does terraVol just create new blocks when you dig instead of removing?
     
  34. Wiegriaf21

    Wiegriaf21

    Joined:
    Jan 17, 2015
    Posts:
    7
    Can I obtain something like what the developers of "Rising World" did with terravol engine?


    I've explored the engine a lot but I can't find a solution, it seems that the brush size of digging/building is stricly related to the blocks dimension and if the block size is something like (1,1,1) the terrain that is generated need to be very small to mantain a decent framerate. So the question is if there's a way to generate a large map with the possibility of digging little holes and building with little blocks (i.e. small size of the brush with large map).
     
  35. DJ_Design

    DJ_Design

    Joined:
    Mar 14, 2013
    Posts:
    124
    Again, I havint tried, But in the builder script there should be a variable that has to do with what block it uses to place/dig blocks, If you raycast what your mouse is looking at and whatever that material is, We set that to the variable. I'll probably end up doing this myself, If and when i do i'll post it here
     
  36. eteeski

    eteeski

    Joined:
    Feb 2, 2010
    Posts:
    476
    I bought Terravol and I've been playing around with it for a few days now. Either I'm doing something wrong, or I've run into some pretty bug glitches.
    In all the scenes, even the example scenes, I'm getting really bad texture stretching on vertical surfaces. It's like the uv map is just projected straight up and down.

    Also, I can't figure out how to add a different texture while digging. When I dig, it's just more grass. When I click "change type of block>" it switches to the snow, but just changes the texture of the entire chunk and doesn't dig. And there's no blending between textures.

    I assume the snow thing has to do with that line saying "Don't forget to select 'WinterDigged' block...." but I have no idea what that means. Select it where? I see "WinterDigged" in the inspector of the BlockSet game object, but how do I select it?
     
  37. cefwyn

    cefwyn

    Joined:
    Jan 2, 2013
    Posts:
    15
    I have the same issue as eteeski. The triplanar shader that comes with terravol doesn't appear to work (it's a massive shader considering what little it's doing) even though there are no shader compile errors and this leads to the terrain being rendered with straight diffuse. The dig issue seems to relate to the vertex painting not being done unless you use RTP3 (which to me seems to work counter intuitively to how a triplanar shader should work). I verified this by creating a shader that simply renders the terrain with it's vertex color and always the terrain would render in whatever color the "Default" block color was set to. The paint tool would indeed change the vertex color, but digging never did. The interaction between the vertex color and RTP3 really doesn't make sense to me. My understanding is that the triplanar shader is supposed to project a different texture along x, y, and z axis respectively however when you enable RTP3 in terravol it simply changes the vertex color based on surface normal and RTP3 picks it's texture based off of that. It was my understanding that the triplanar shader for a voxel terrain was meant to do a standard triplanar projection and choose which texture to use in the blending based on the terrains vertex color (ie. "dug" terrain would have a different vertex color so would use a different texture from a cliff even though it has the same surface normal). I'm kind of annoyed that I can't get the materials for either RTP3 or Terravol working as I expect, but at least it's given me motivation to learn a lot about the shaders. One issue I have that's not mentioned above is using either RTP3 or the terravol material I get random black patches where it's either not being lit properly or not textured properly. With the terravol material it seems to be most common at sharp angles, while with the RTP3 shader it can show up anywhere like below:
    Screenshot 2015-01-26 15.16.59.jpg
    Note that this screenshot is in Unity5 and I've had to modify things to work in Unity5, but the same issues appear in Unity 4.6 as well.

    Sorry about the long post, but I've been pulling my hair out for the last few days trying to figure out exactly where the problem is or if I just really don't understand triplanar shading and am inventing my own system and noticed that the previous poster has the exact same issues I have.
     
  38. eteeski

    eteeski

    Joined:
    Feb 2, 2010
    Posts:
    476
    You said you had to modify things to work in Unity5? I'm planning on upgrading to Unity5 soon. What did you have to modify?
     
  39. cefwyn

    cefwyn

    Joined:
    Jan 2, 2013
    Posts:
    15
    I don't remember every change I made unfortunately but it was very minor stuff. Unity 5 automatically upgrades most of it. Some of the scripts use deprecated functions which are easy to change. The examples don't work though unless you recreate them yourself because even though all the scripts work just fine something isn't getting initialized properly somewhere. I'm still chasing down what's causing the black vertices though. I think there might be cases where the normals are being miscalculated or something.
     
  40. eteeski

    eteeski

    Joined:
    Feb 2, 2010
    Posts:
    476
    I think I found something that might help your problem with the black holes in your terrain. I found some random triplanar shader here on the unity forums someone made. It had a setting called "BlendPlateau". When it was higher, I got holes just like yours, when it was lower, the holes were gone. Maybe RTP3 has something similar? idk, it's a setting to control the blend between top, sides, and bottom textures. Not an exact solution, but I hope that at least helps give you a clue to fix your problem.

     
    Arkade likes this.
  41. cefwyn

    cefwyn

    Joined:
    Jan 2, 2013
    Posts:
    15
    RTP3 might have something similar but I'd have to know exactly what that blend plateau is and I don't understand how blending the triplanar materials could ever result in black vertices.Only artifacts I'm aware of for triplanar shading is at 45 degree angle when using splatting getting visible misalignment. I've basically fixed it's appearing on my terrains by keeping the roughness down because the problem seems to be most prominent with sharp angles in the terrain (which I'd rather not have anyways). I'm trying to work on my own shader though because I want to merge the way the RTP3 shader works with how triplanar is supposed to work. RTP3 just blindly projects one of the 4 textures onto the terrain based on it's normal and with the RTP3 define set in Terravol, Terravol changes the vertex colors for some reason even though RTP3 doesn't look at it. I would like to do the high quality triplanar and uv blending that RTP3 does but also use the vertex color of the terrain to decide what texture to apply so the paint tool actually does something. I don't know nearly as much of shader programming as I would like so it's taking me time to figure out what I need to change to do all this.
     
    Arkade likes this.
  42. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,293
    Is this still in development?
     
  43. DJ_Design

    DJ_Design

    Joined:
    Mar 14, 2013
    Posts:
    124
    I believe so
     
  44. Hroudtwolf

    Hroudtwolf

    Joined:
    Sep 18, 2014
    Posts:
    1
    Hi,

    I'm trying to set simple cubes above the ground.

    But everything what happens is, that the ground will textured with the material of the cube.
    terravol_problem_adding_blocks.jpg
    (Screenshot)

    Here is my code:
    Code (csharp):
    1. private void SetBlock() {
    2.  
    3.         Vector3? position = GetClickTarget();
    4.         if (position == null) {
    5.             return;
    6.         }
    7.    
    8.         Vector3i actionPos = Chunk.ToTerraVolPositionFloor(position.Value);
    9.         actionPos.y += 1; // I want to have the new cube above the detected one.
    10.  
    11.         Debug.Log ("Build one block");
    12.  
    13.         WorldRecorder.Instance.PerformAction(new ActionData(
    14.             actionPos,
    15.             Vector3.one,            
    16.             currentBlock,
    17.             ActionDataType.Build,
    18.             BrushType.SharpCube,
    19.             false,
    20.             true
    21.         ));
    22.     }
    23.  
    24.  
    25.     private Vector3? GetClickTarget() {
    26.        
    27.         Ray ray;
    28.          ray = new Ray (Camera.main.transform.position + Camera.main.transform.forward, Camera.main.transform.forward);
    29.            
    30.         RaycastHit hit = new RaycastHit ();
    31.         if (Physics.Raycast (ray.origin, ray.direction, out hit, 2f)) {
    32.             return hit.point + ray.direction;
    33.         }
    34.  
    35.         return null;
    36.     }
    What is wrong with my code?
    Thanks in advance.

    Best regards
    Hroudtwolf
     
  45. ValrikRobot

    ValrikRobot

    Joined:
    Jun 26, 2013
    Posts:
    206
    What i need to do, is be able to set the world values from a 3d array. I will also be usin RTP for this so i will only really have 4 textures to work from. the array would contain a number eg
    0 = empty
    1=rock
    2=sand
    3=grass
    4=dirt
    Is it also possible to set tree's in the same way?
    Is this acheivable?
     
  46. mikezenox

    mikezenox

    Joined:
    Oct 18, 2012
    Posts:
    55
    Quick question, when I attempt to save and reload my terrain from its terra file, the terrain information saves but the textures ive painted and trees I deleted all go back to their default settings. I understand how to customize these things during generation with the biomes script but i would like to be able to save this information from inside the editor as well so I can build towns and such essentially. How do I go about doing this?
     
    boysenberry likes this.
  47. FisherM

    FisherM

    Joined:
    Dec 28, 2013
    Posts:
    366
    would it be possible to limit the deformations to the terrain? So you could only dig say 5m off the surface of any location?

    Also, would it be possible to generate terrains from heightmap big enough for flight sims with 10-50km range.
     
  48. Woog

    Woog

    Joined:
    Feb 15, 2015
    Posts:
    1
    For those of you who are using Relief Terrain Pack with Terravol, do you need to do anything special in either of the programs settings to get them to play nice? I am trying to play around with RTP in the standard 2-biome scene that comes with Terrvol, but no matter what I try to do, I keep getting the error:
    MissingComponentException: There is no 'Renderer' attached to the "Map" game object, but a script is trying to access it.
    You probably need to add a Renderer to the game object "Map". Or your script needs to check if the component is attached before using it.
    I can use each program separately, but can't get them to work together. I've even changed terravol scenes and get the same error.
    Thanks!
     
  49. Skaeren

    Skaeren

    Joined:
    Feb 9, 2015
    Posts:
    14
    I do not understand the part of the documentation that reads:
    1. Inside the BlockSet component, add a Block named “Default” with a material index of 0 and add a material to the “materials” array (see Using BlockSet component section).
    I have not been able to find anywhere inside the BlockSet component to add a block. Could someone explain how, or make a youtube vid showing how to set this tool up?
     
  50. Kelkith

    Kelkith

    Joined:
    Mar 19, 2014
    Posts:
    14
    We're looking to use this asset in our project, but I'm hesitant to purchase it as I'm unsure if this is still in development and if it works with Unity 5. If it is still in development, what are future features / improvements we can expect?