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. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    Good :)

    Yes as you say Hide distance should be greater than Build Distance. I simply show a warning in the console if this is not the case.

    I hope you will get it working! Please let me know.

    I've tested TerraVol with RTP3 and I get very nice results. I strongly recommend it. I've done a bit of work to make it very simple to use with TerraVol (now it takes less than 5min to integrate it) and will explain it in the documentation. I will upload a demo soon, showing how TerraVol and RTP3 work together.
    Of course, RTP3 will NOT be included in TerraVol package.
     
  2. mateodon

    mateodon

    Joined:
    Oct 1, 2013
    Posts:
    39
    Well that is just plain awesome. Does the Triplanar shader from RTP have vertex blend channels like the TerraVol shader? Does Geometry Blend work with trees placed with TerraVol? RTP's dynamic water could be a good place to start building procedural fluid placement, although I imagine it would still take a good bit of work to make sure streams don't abruptly end on the side of a hill.
     
  3. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    Yes, there is an example material that uses vertex blend channels like the TerraVol shader ;) I've not tested Geometry blend but I doubt this can work dynamically. And yes, this could be a good way to add fluids on the terrain (not 'volumetric' fluid though).
     
  4. SndChance

    SndChance

    Joined:
    Oct 6, 2013
    Posts:
    4
    Hey Amfu,

    the new version is awesome!

    The only thing is, that when a player reaches the end of the map(when the map gets resized), the Chunk generation get messed up and no new chunks are created or displayed.
     
  5. cookimage

    cookimage

    Joined:
    Sep 10, 2012
    Posts:
    729
    New update is starting to look good, small frame rate updated still needed to better the frame rate when moving over terrain but I did find that pre-making the terrain helps with this. If you just set it to do random procedural terrain every now and then you get a frame rate spik.
     
  6. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    376
    Time to update take Terravol for another spin :) I purchased this back in week one or two...
    I'm hoping to add A* pathfinding to my projects. I have an asset called " AI Made Easy " I'm hoping this can be used in conjunction with the Terravol system... if not I guess Rain is another pathfinding option.
     
    Last edited: Nov 13, 2013
  7. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    I'm quite curious about results you're able to achieve with RTP3 shader. BTW - I'm working on quick update for this so that the shader will be able to use moretypes of fog (now it's only exponential).

    Tom
     
  8. BES

    BES

    Joined:
    Feb 26, 2013
    Posts:
    212

    Awesome!.. since RTP3 is awesome ...and so is this TerraVol.
     
  9. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    376
    are there any video samples of TerraVol RPT3 in action ??

    Some time ago I purchased Advanced Surface Shaders but RPT3 looks like the go...
     
    Last edited: Nov 14, 2013
  10. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    You're right, it seems there's a bug. I'm gonna fix it before release. Thanks!

    If this is customizable enough to let you use your own pathfinder, then you should be able to make it work together.

    I'll upload a demo very soon and will post a few screenshots tonight so everyone can see it :)
    Very good news about the fog! Some people prefer to use linear fog indeed.

    I've finished the doc. I'm fixing a bug and then I think I will be able to send v2 for review. Thank you very much to all the beta testers! Please keep sending me your feedbacks especially when you find a bug! :)
     
  11. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    As promised, a few screenshots of a terrain created with TerraVol v2 using RTP3 (for terrain texturing).

    $01.jpg

    $02.jpg

    $03.jpg

    $04.jpg
     
  12. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    And two screenshots better showing the full power of the new grass system.

    $05.jpg

    $06.jpg
     
  13. VicToMeyeZR

    VicToMeyeZR

    Joined:
    Jun 3, 2012
    Posts:
    427
    WOW. Very cool. Nice work Amfu!!
     
  14. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    Thanks! I'm going to send the v2 this weekend for review, so it should probably be available next week on the Asset Store. ;)
     
  15. cookimage

    cookimage

    Joined:
    Sep 10, 2012
    Posts:
    729
    That look pretty good!!
     
  16. mateodon

    mateodon

    Joined:
    Oct 1, 2013
    Posts:
    39
    Very nice, looks like RTP just made it onto my asset wishlist. It is a shame that the Geometry Blend probably wont work with TerraVol though.

    For the record I haven't been able to get the pathfinder to work with RAIN yet, although admittedly that issue hasn't been my main focus. Eventually I'll need AI though, so if anyone finds a functional AI solution I'd certainly appreciate a heads up.

    I have been running some performance tests. The best results (at least for my PC) were achieved by setting Build Dynamically to false, but the framerate still dips a bit when viewing large portions of terrain. For some reason Hide Distance isn't working with Build Dynamically set to false, that might make it better.

    I think the spikes you mention are due to runtime chunk generation (Build Dynamically), when I slow down player movement I hardly notice it, but with faster movement it becomes more noticeable. I think the unfortunate reality is unless you are making a snail simulator you will have to endure occasional frame drops, and if you are making a fast paced game you should consider unchecking Build Dynamically.

    I think perhaps increasing the block size could also be used to reduce the performance impact of runtime generation, but I haven't done much testing with this theory yet.
     
  17. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    I see great potential using RTP shader with TerraVol. Would love to see how dynamic snow performs here. Also it's worth mentioning that next RTP3.1 release will introduce caustics for the "voxel" shader too (and 3 types of FOG, because now its limited to Exponential).

    If there will be enough reason (enough users that would like this TerraVol/RTP "mariage") I could even think about more TerraVol oriented, custom version of RTP shader that would be tailored not only for "any" vertex color driven mesh, but esp. to work even better, dedicated solution for TerraVol.

    Unfortunately geom blend needs alpha channel of vetex color - that's the reason it can not be used with geom blending of RTP. Mayby Amfu would go with any idea how to store blend info different way. What comes to mind quickly is usage of 2nd texcoords (we loose lightmapping then though). I'll think about it too.

    Tom
     
    Last edited: Nov 15, 2013
  18. Dorque

    Dorque

    Joined:
    Jul 19, 2012
    Posts:
    16
    I've got a question after looking through your code and attempting to make some changes to the random generator. Why do you use map2D in the TerraMapGenerator.cs file? Shouldn't you only need the information for the 3D chunks?
     
  19. BES

    BES

    Joined:
    Feb 26, 2013
    Posts:
    212
    I cant wait to try this ... you guys are awesome ...im waiting for an asset store update for both RTPv3 and TerraVol before I can start the terrain part of my project..

    Awesome pics Amfu !
     
    Last edited: Nov 16, 2013
  20. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    Release Candidate has been sent to a few users for a final test. If everything works fine, I will send it for approval tomorrow evening.

    A bug preventing the terrain from being built when the map got resized dynamically has been fixed. Actually, map doesn't need to be resized anymore ;)
    A new little feature has been added too: you now have the possibility to limit the size of the terrain in X and/or Z direction, which can be useful in many cases, like for example if you want to make a 2.5D game. A new scene has been added as an example of this.

    @Mateodon
    I'm glad you like it :)
    Yes I'm not surprised that you get better performance when disabling dynamic building. In the future, I'll try to improve the time needed to instantiate a chunk... even if it's mainly some pure Unity's work.

    @Tomaszek
    Yes you're right I'm sure I can do a lot better if I take the time to work more on my scene. I'm definitely going to do it.
    About geom blend, I may have an idea but I really don't know if it's a good one. The way TerraVol computes UV coordinates is extremely trivial:
    Code (csharp):
    1. public static void ComputeUVs(MeshData mesh, ChunkData chunk)
    2.         {
    3.             Vector3 offset = (Vector3) Chunk.ToWorldPosition(chunk.Position, Vector3i.zero);
    4.             // UV
    5.             foreach (Vector3 ver in mesh.vertices) {
    6.                 mesh.uv.Add(new Vector2(ver.x + offset.x, ver.z  + offset.z));
    7.             }
    8.         }
    As you can see, UV coordinates of a vertex is simply the absolute world position of the vertex (x z coordinates). Maybe this could be done directly in the shader thanks to _Object2World or something like that. Doing so, first texture coordinate would remain free for something else like geom blend.
    But maybe I'm totally wrong. As I'm not a shader expert at all, I can't say if it makes sense or not...
    What do you think?


    @Dorque
    map2D is used in TerraMapGenerator to check if a "column of chunks" has been already generated or built. This is faster than checking it for each chunk!

    @BES
    Thanks a lot! I'm glad you like it :)
     
  21. mikezenox

    mikezenox

    Joined:
    Oct 18, 2012
    Posts:
    55
    I ran into a weird bug with a few of my tree prefabs;

    $Untitled.jpg
     
  22. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    Indeed!
    Does that happen only with some of your prefabs (ie. not all of them)?
    What is the tree density of your map component?
    Could you send me one of your tree prefab on which the problem occurres?

    Thank you very much!
     
    Last edited: Nov 18, 2013
  23. cookimage

    cookimage

    Joined:
    Sep 10, 2012
    Posts:
    729
    Hi there, just checking if you send me a link to final copy for testing.
     
  24. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    I think I have, but there were a lot emails to send so if I forgot you just let me know :)
     
  25. mikezenox

    mikezenox

    Joined:
    Oct 18, 2012
    Posts:
    55
    It happened with most of my trees, but I think there was at least one that didn't. The tree density is the default value in the example scene (.22) and the prefab can be seen in the inspector there. I would be happy to send one when I make it home. Also, the method that is used to place trees makes it hard to place smaller trees or detail objects as they go underground, any way around that?
     
  26. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    @Mikezenow

    Could you find the line "if (Physics.Raycast (ray.origin, ray.direction, out hit, Chunk.SIZE_Y_TOTAL) {" in TerraVolEnhance.cs and replace it with:
    if (Physics.Raycast (ray.origin, ray.direction, out hit, Chunk.SIZE_Y_TOTAL) hit.transform.GetComponent<Chunk>() != null) {
    and tell me if it works?

    About your problem, I'll add an array on the TerraMap component called 'treesDeepInTheGround' that will have to be the same length than 'trees' array and will let you set how deep in the ground each type of trees should be. This will solve your problem :)

    Thanks
     
  27. tomaszek

    tomaszek

    Joined:
    Jun 18, 2009
    Posts:
    3,862
    Amfu,

    Do you think your uv coords can be computed in shader vertex function the same way you do it via script ? If they're just world x,z coords it's quite easy to tweak the RTP shader. This way we've got free uv coords data to be used as we need in the TerraVol object mesh (so for example blending I can move from vertex color A channel to uv coords - U). The only important thing would be computing top planar (or any we need) main uv coords to span for example global colormap (although stretched still can be useful).

    The only thing I need to know if you use uv corrds computed in your script for any TerraVol functionality or is it just used for shader/rendering only ?

    Tom
     
  28. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    That's what I was thinking of.
    TerraVol doesn't use UV coords in any functionallity. It's computed only because most of shaders need it. So you are free to use it for any other purpose. This would be a greate way to provide geom blending!
     
  29. mikezenox

    mikezenox

    Joined:
    Oct 18, 2012
    Posts:
    55
    @amfu, I will test that out as soon as I can and let you know. And that fix would be perfect, thanks :)

    It worked perfectly. Thanks!
     
    Last edited: Nov 18, 2013
  30. BES

    BES

    Joined:
    Feb 26, 2013
    Posts:
    212
    Amfu you submitted the new version to the asset store right? ....so we are waiting on the Unity peeps?


    ...sorry not trying to be a nag ...waiting on the new RTPv3 updates too .... takes those Unity peeps way too long ...

    I really want to try this with RTP3...
     
  31. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    I wanted to wait a bit to get more feedback (and fix last bugs) before sending it to Unity. This is done, and I've just submitted it for approval. ;)

    It should probably be released next week.

    Thanks for your patience. I hope you will enjoy TerraVol 2. By the way, this is the last chance to grab it for $65.
     
  32. BES

    BES

    Joined:
    Feb 26, 2013
    Posts:
    212
    Ah ..sorry my bad ..I thought you sent it already..thanks though for the update ...looking forward to trying it out.
     
  33. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Hi Amfu.

    Really Amazing package.
    I'm working mainly on Mobile. Do you have in-game performance metrics for Mobile?

    Cheers.
     
  34. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    Thanks Rocki!
    Unfortunately I don't have tested TerraVol on mobile yet but that is something I'd definitely planed to do.
     
  35. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Just Bought. Please let me know when you get some test results.
    Cheers.
     
  36. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    Thank you very much! Sure I will let you know.
     
  37. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    Just a word to tell that TerraVol 2 is now available on the Asset Store!

    I hope you will like it :)
     
  38. vincentellis

    vincentellis

    Joined:
    Oct 21, 2013
    Posts:
    100
    Does this support multiplayer realtime modifications? (eg.: Two clients altering the same terrain)
     
  39. mateodon

    mateodon

    Joined:
    Oct 1, 2013
    Posts:
    39
    Not sure how many times I've said thanks, but once more can't hurt. Your dedication to this asset is phenomenal, thank you.

    I do have one more request though. In the documentation could you explain how the pathfinder works and perhaps provide a basic example of how to use it. I am unsure of how to make an object follow the path.
     
  40. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    You will have to make all the multiplayer logic by yourself, but TerraVol stores player actions in a convenient way, so you can serialize actions, and send them to other players which will reproduce the effect of each action on their side.
    For example, when a player click to dig the ground, a 'dig action' is created and performed like this: WorldRecorder.Instance.PerformAction(new ActionData( ..... )). As you see, an "ActionData" object is created and is serializable. You can then send the action to other players which will call WorldRecorder.Instance.PerformAction( otherPlayerAction ) to reproduce its effect.

    However, you will have to be careful on the amount of actions each player can perform each second. Typically, you won't be able to do continuous editing. You will have to put some limitations. A player should be able to do only one action per click, and only once each 3 seconds for example (like a rocket launcher that can fire a rocket each 3 seconds).


    Thank you very much Mateodon, such comments give me even more motivation!

    Yes you're right, I completely forgot to tell more about pathfinder in the documentation. I will definitely do that soon.
     
  41. Gaxel

    Gaxel

    Joined:
    Sep 30, 2012
    Posts:
    17
    Great update, many thanks for giving us this wonderful asset.

    I have two questions: on the doc, to manage biomes, you explain how we can do it using OnBlockGenerateBefore... is it now OnBlockGenerateBeforeInThread (since Terravol is now multithread)?
    Also, if I want to add some items/characters to a chunk, in the same way I can use the TerraVolEnhance.OnChunkBuildAfter right?

    Many. many thanks again
     
    Last edited: Nov 22, 2013
  42. Gaxel

    Gaxel

    Joined:
    Sep 30, 2012
    Posts:
    17
    In the code there is PathTester.cs that it simply enough:

    If I get it right, basically, if you have two positions, you can obtain the path between them, as a list of nodes, using
    SearchNode path = PathFinder.FindPath(map, start, end, aboveGroundOnly, false);
    The first parameter is the "TerraMap" object, then start and ending position of the path, a boolean to set above ground only and a boolean for smooth path. It returns the first node in the path.

    then, using path.next returns the next node, null if there aren't.

    So, after creating the path, you can move your object from one node to the next... to make a enemy follow the player, you can recompute the path every some time with start=enemy position and end=player.position.

    Hope i'm right and useful :D
     
  43. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    Thanks! :)

    Yes and yes. Indeed the method's name changed. I've just updated the doc to fix this mistake.
    OnChunkBuildAfter is meant to add some stuff on the chunk so this is exactly what you want to do. You should check if there is actually a mesh in this chunk (a chunk can be totaly empty) before doing anything: chunk.ChunkData.MeshData.vertices.Count != 0

    You're welcome :)
     
  44. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    Yes, you're 100% right and I'm sure this will be useful to others. I'm updating the doc to explain pathfinding.
     
  45. Gaxel

    Gaxel

    Joined:
    Sep 30, 2012
    Posts:
    17
    Great :D

    Many, many thanks again for you're wonderful work!
     
  46. mateodon

    mateodon

    Joined:
    Oct 1, 2013
    Posts:
    39
    I look forward to it. Might I also suggest a changelog for the documentation? I expect there will be a number of further changes and additions to the doc in wake of the 2.0 release, it would make it easier for us to figure out what has and hasn't changed.

    Thanks for that, it makes this all a little less confusing. I still haven't made a functional movement script though. I am pretty terrible at figuring out the context of code snippets, which is why I asked for an example, I need something to break before I can figure out why mine isn't working :p
     
  47. kilju

    kilju

    Joined:
    Nov 4, 2013
    Posts:
    127
    just bought :) really nice asset now i can start to make some nice games :D fev questions tho. i dont really understand how to add new blocks can u explai it little bit? and second is it possible to add some physics to blocks? thank u
     
  48. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    Improving the doc is my short-term top priority. You can be sure you will find what you expect in a few days.

    Thank you very much Kilju!
    Do you want to add blocks programmatically or within the editor? It isn't possible to add some physic (like a rigidbody) to blocks because they are part of the terrain and so share the same mesh than the ground.
     
  49. kilju

    kilju

    Joined:
    Nov 4, 2013
    Posts:
    127
    np m8 :)
    in the editor. i dont really understand how the material setting works on blocks. i can add new block but i cant add materials on it. and i noticed i cant get my map dark enought even if i disable directional lightit still looks like it has some light source on it .
     
    Last edited: Nov 24, 2013
  50. Amfu

    Amfu

    Joined:
    Apr 9, 2013
    Posts:
    180
    If you want to apply a different material on your terrain, you have to create a new type of block in the BlockSet component. Give it a name (let's say "myblock"), then go back to the terrain editor tool and select your block in the select box "current type of block".
    Then, select "Paint" in the select box "Action".
    Now just click somewhere on your terrain to paint your material on it.

    About the light, have you checked the ambient light of your scene?