Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  6. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  7. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  8. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

[uTerrains] Ultimate Terrains - Voxel terrain engine

Discussion in 'Assets and Asset Store' started by Amandin-E, Feb 4, 2016.

  1. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    Hello everybody,

    This is the official forum post of Ultimate Terrains.


    Version 3.0

    You'll be glad to know I made a big update of the package that is available on the Asset Store. This is of course a free update for those who already bought the asset.
    If you already have v2.2, please get a look at the Upgrade Guide.

    => Get it here!
    => Try it!
    => More info & doc


    Ultimate Terrains is a voxel terrain engine implementing adaptive Dual Contouring with very powerful features. It is able to generate and render infinite terrains with any kind of shape (cubical, smooth, mountains, hills, caves, overhangs, etc.), supports real-time editing and offers awesome distance of view. It has been made to be easily and deeply customizable.

    Features:
    • All sources are included.
    • Fast, multithreaded, NO LAG.
    • Infinite terrains.
    • Giant distance of view. Visible part of a terrain is up to 8192x8192 while keeping an excellent voxel resolution (only 1x1x1 unit per voxel!).
    • Can render any kind of shape: mountains, hills, valleys, but also caves, holes, overhangs, cliffs, etc. Possibility to change the smoothness of some parts of the terrain (or the entire terrain) so you can have fully cubical areas and perfectly smooth relief at the same time.
    • Realtime editing. Dig/build your terrain as much as you want in real time.
    • NEW: realtime asynchronous editing to alter the terrain without FPS loss!
    • Procedural generation thanks to modules such as Perlin noise, Simplex, Ridged multifractal, heightmap, etc. You can write your own modules easily.
    • Biome system with full control over terrain generation.
    • Editor to edit the terrain directly within the scene view.
    • Powerful grass generator.
    • Trees system able to spawn trees at high distance.
    • GPU instanced details objects system.
    • Triplanar shaders (diffuse, specular, bumped, bumped specular)
    • Compatible with RTP3
    • Save & load terrain dynamically
    • JSON serialization for network synchronization

    Known issues:
    • Editor Tool can be very slow when the terrain is selected (and it becomes fast as soon as you unselect the terrain). Will be fixed in a future update.
    • Ultimate Terrains might be very slow when compiling with IL2CPP.

    Screenshots:
    9dc73139-1966-415a-a035-050d0e4540a2_scaled.jpg

    5fdeacf8-bd2b-40e9-adf0-404159928827_scaled.jpg 46135803-7b4c-4560-8061-25af777d313e_scaled.jpg a989b0e7-ea70-4f17-a264-9ad269f53707_scaled.jpg d6c3bc4c-2f47-4b59-a50f-832166a08467_scaled.jpg





    I hope you will enjoy Ultimate Terrains. If you have any question please ask it.
     
    Last edited: Jul 31, 2018
    ElroyUnity likes this.
  2. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    I think it's a little questionable doing this given you didn't really address the issues brought up in the old thread but are still trying to sell it as new.. yet unchanged...
     
  3. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    The old forum thread has been closed because of someone posting personal data of a member of the team. I've been away for a long time, but I'm back to answer questions. I have never said that there was anything new...
     
  4. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    One of the first lines implies its hot off the press
     
  5. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    @lazygunn Thanks, I hadn't seen it (copy-past from old thread). I edited the post.
     
  6. runevision

    runevision

    Unity Technologies

    Joined:
    Nov 28, 2007
    Posts:
    1,265
    I've had a quick look at uTerrains to figure out if it might be something I might want to use for a personal project.

    My first test was to create a voxel terrain that's just a slanted plane. The voxel function I use is simply:

    Code (CSharp):
    1. float MyFunction (float x, float y, float z) {
    2.     return y - x * 0.15f;
    3. }
    This should create a perfectly flat but slightly tilted plane. But instead I found it creates a stepped terrain. The most detailed LOD level around the player is almost completely flat, but the LODs get increasingly stepped the less detailed. Each LOD level has twice as big steps as the previous:

    SteppedTerrain.png

    Neither Marching Cubes nor Dual Contours terrain should give this result. Unlike cube-like terrains like in MineCraft, Marching Cubes and Dual Contours are able to perfectly represent a flat plane with any orientation, regardless of how large voxels are used. At least as far as I understand. So I'm wondering if it's a bug? I tried to tweak some of the settings, but none of them seemed to affect this.

    The issue is mostly visible for slightly slanted and highly regular surfaces like this. Surfaces that are close to 0 degrees slanted or 45 degrees slanted will look fine, and any noise will mask the issue, so it might be possible it's been there all along but is not spotted in most regular terrains.
     
  7. datatype_void

    datatype_void

    Joined:
    Sep 2, 2015
    Posts:
    13
    @runevision Do you have any insight on this matter? I have been waiting to see a response from the dev...
     
  8. runevision

    runevision

    Unity Technologies

    Joined:
    Nov 28, 2007
    Posts:
    1,265
    No, I'm afraid not.

    The dev wrote in the original thread that "Because of lack of time, no future version is currently planed." So they might have very limited time for checking and replying here too...
     
  9. datatype_void

    datatype_void

    Joined:
    Sep 2, 2015
    Posts:
    13
    @runevision Thanks for your response. I wasn't sure if you had managed to work something out with it.
     
  10. datatype_void

    datatype_void

    Joined:
    Sep 2, 2015
    Posts:
    13
    @AmandineEntertainment I am wondering if there is a way to support voxels less than 1 unit in size. When I put in a value such as 0.5, strange things happen. I want to be able to build a system that allows building with voxels in a fashion similar to what Everquest Landmark has. Any insight would be very much appreciated. :)
     
  11. Jrodz

    Jrodz

    Joined:
    Apr 8, 2014
    Posts:
    21
    I am looking to create a bulldozer road creation simulation (ie: push dirt around, level (grade) surfaces, pile dirt up). My first impressions from playing with the demos is that the voxel size doesn't really get small enough to handle the subtle terrain changes I would need. Could anyone with more experience in this engine tell me if this would be suitable for my goals or should I stick to manually adjusting heightmaps on stock terrain objects?
     
  12. Neomex

    Neomex

    Joined:
    Sep 2, 2013
    Posts:
    73
    Hey there, I am considering this for a purchase. Is the support alive?
     
  13. gg9988

    gg9988

    Joined:
    Sep 21, 2015
    Posts:
    5
    Is there any physics involved ?
    If not, do you have floating islands possible?
     
  14. joejr

    joejr

    Joined:
    Nov 5, 2015
    Posts:
    8
    I have a quick question please. In creating shapes your doc's reference DigCube and DigCubeEditor as examples. The one think i'm having a hard time understanding is how is the actual shape defined? where in the code does it call the shape?
    Thanks for your time on this.

    Joe.
     
  15. jessejarvis

    jessejarvis

    Joined:
    Aug 9, 2013
    Posts:
    263
    Anybody know how to set this up to be blocky? With multiple block types? Currently I am setting the Blockiness to 1 but it has quite a few slants in the terrain. I make multiple blocks types Stone/Dirt/Grass/Sand, etc but how do I make the dirt and stone spawn beneath the grass?

    I do like this terrain engine though, it's a great starter.

    Ideally I am trying to achieve this:

     
  16. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    Hello everybody,

    Today, after almost 3 years without active development and without support (I'm really sorry for that), I am pleased to announce the official come back of Ultimate Terrains!

    First of all, I will spend time to give support. Three years ago I didn't realize that this is the key to get happy customers. I was too much focused on the development of the asset itself and not enough on helping people to use it. This was a mistake.

    By the way, Ultimate Terrains has only 3 stars on the Asset Store, and this is almost only because of the lack of support. This is perfectly understandable and justified, but I honestly think Ultimate Terrains is a great and powerful voxel terrain solution, so I will do all I can to reach 5 stars again.

    Documentation is also something very important and I'm going to improve it too.


    A new version for the come back!

    You'll be glad to know I made a big update of the package that has just been approved on the Asset Store. This is of course a free update for those who already bought the asset.

    This update - version 2.0 - comes with a lot of improvements but also with breaking changes. Be warned, you won't be able to load terrains made with prior versions.

    Improvements:
    • Fully updated for Unity 2017.3
    • Overall performance improvements.
    • Bugs fix.
    • Better support of heightmaps (as 2D values generator).
    • Better editor tool to edit the terrain within Unity editor. It is simpler to use. It is also faster. In one word, it is more "usable".
    • Better serialization of terrain operations.

    New features:
    • Finite terrains. This might look useless as Ultimate Terrains handles infinite terrains at its heart, but actually most people just need a finite terrain, which allows to do some optimization and enable the possibility to bake terrain data.
    • New parameter "Vertical Size" allows to set a lower size of the terrain on the Y axis to save computation time.
    • Baking. You can now precompute finite terrains partially or completely. This is only suitable for small terrains as it takes a lot of memory (but reduces CPU usage). Typically, a baked terrain of 512x512 will take ~100MB of memory (RAM) for a partial bake and ~1GB for a full bake. A terrain of 1024x1024 would take ~500MB for a partial bake and ~4GB for a full bake! It is up to you to decide if it's worth it or not for your use case.

    This update also comes with new example scenes, new terrain textures and new generators.

    As before, all the source code is included.


    The next step is to provide support, improve documentation, make a video tutorial and create a beautiful demo scene.

    I'm very excited and enthusiastic about Ultimate Terrains come back. I hope you too!
     
    Veizour likes this.
  17. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    I forgot to mention that I lowered the price from $95 to $75 ;)
     
    Veizour likes this.
  18. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    @runevision
    I know I'm giving an answer far too late, but I was away during a long time, and now I'm back.

    Your issue with your simple slanted plane terrain is probably because the voxel value doesn't fit with higher LODs. You should simply divide the voxel value by the distance between two voxels of your highest LOD. For example, the distance between two voxels of LOD 6 is 2^6 = 64. So, your voxel function should look like this:
    Code (CSharp):
    1. float MyFunction (float x, float y, float z) {
    2.     return (y - x * 0.15f) / 64f;
    3. }
     
    Veizour likes this.
  19. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    It is back!
     
    Veizour likes this.
  20. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    There is a bug when voxel size is different than 1, but I've fixed it yesterday so this will be fixed in the next update. You can set the size you want. (minimum is 0.01).
     
    Veizour likes this.
  21. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    Physic is not involved for terrain generation (however the terrain generates mesh colliders to handle collision with other objects in your scene). Floating islands are definitely possible.
     
    Veizour likes this.
  22. runevision

    runevision

    Unity Technologies

    Joined:
    Nov 28, 2007
    Posts:
    1,265
    I just tried that now and it still doesn't produce anything like a flat plane. That this should work also doesn't fit my understanding of smooth voxels - they should work equally well regardless of the magnitude of the function used.

    Let me know if you succeed yourself in producing a perfectly flat slightly tilted plane at all LODs.
     
  23. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    @runevision I just tried with this function:
    Code (CSharp):
    1. public void Combine(float x, float y, float z, float[] values2D, float[] values3D, out float voxelValue, out VoxelType voxelType)
    2.     {
    3.         voxelValue = (y - 0.1f * x) / 64f;
    4.         voxelType = mainVoxelType;
    5.     }
    This produced a very surprising result: Capture d’écran 2018-05-23 à 20.03.27.png

    Obviously, there is a problem here... and this is a very interesting one!
    Actually, this is a floating point precision error. For some reasons, for some values of x where the value is equal to "0" exactly at the voxel position, I think the value switch between -0 and 0 producing inconsistent inside/outside voxels.
    This kind of error is extremely unlikely to happen with mathematical noises, but there it does.

    Anyway, a simple way to avoid this is to shift the value of x so the voxel value is equal to 0 between voxels (ie. not at exact voxel position). So, by doing this:
    Code (CSharp):
    1. public void Combine(float x, float y, float z, float[] values2D, float[] values3D, out float voxelValue, out VoxelType voxelType)
    2.     {
    3.         voxelValue = (y - 0.1f * (x + 0.5f)) / 64f;
    4.         voxelType = mainVoxelType;
    5.     }
    we get a nice flat plane:
    Capture d’écran 2018-05-23 à 20.23.26.png

    :)

    This is because voxel values are bounded between -1 and 1. Maybe this is something I should improve, and I should bound them between -64 and 64 (depending on the highest LOD)... Not sure of that...
     
    Veizour likes this.
  24. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    This can be counter intuitive, but the shape of the operation is defined programmatically.
    The function of the operation is actually called by the engine for each voxel that is affected in order to modify its value. You don't need to worry about this part. What you need is to implement the function so that the voxel value is altered depending on its position. For example, when you dig a sphere, the voxel value will be altered depending on its distance from the center of the sphere and its radius. Not sure if it's clear enough?
     
  25. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    You can adjust the size of a voxel to whatever you want (well, there is a bug in 2.0 that is fixed and pending for release 2.1, but you can consider it done). The only thing to keep in mind is that if you reduce the size of voxels, you also reduce the size of the visible part of the terrain of course. So you will have to make a compromise between far distance view and small voxel size. It just depends on your needs.
     
    Veizour likes this.
  26. unity_-TOEsv9C4pUH5w

    unity_-TOEsv9C4pUH5w

    Joined:
    May 26, 2018
    Posts:
    2
    Hi,

    Is it possible to have both cubical and smooth style at the same time on the same terrain? Something like cubical biomes and smooth biomes?
     
  27. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    Yes this is definitely possible: a terrain can have thousands of different voxel types which have their own blockiness value.
     
    unity_-TOEsv9C4pUH5w likes this.
  28. unity_-TOEsv9C4pUH5w

    unity_-TOEsv9C4pUH5w

    Joined:
    May 26, 2018
    Posts:
    2
    That's great! I'm going to buy it ;)
    Thanks
     
    Amandin-E likes this.
  29. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    Next update is already coming :)

    It fixes a bug when voxel size != 1 and a bug with the reticle not being displayed in the scene view.

    And most of all, it brings a brand new system for scenery objects:
    - a new details object system that uses GPU instancing and is perfectly adapted for small objects like plants, small rocks, wood sticks or whatever you want! Very fast.
    - a new tree system that is able to spawn trees very quickly at big distance. This is very powerful. Future versions will give you more control over trees spawning. It is recommended to use Speedtrees for performance reasons.

    A new feature allows you to react when an object (that has a collider) is affected by an operation. For example, by default, trees are removed when they are affected by an operation. Just add a collider to your object and a method like this:
    Code (CSharp):
    1. void OnAffectedByTerrainOperation(IOperation operation) {}
    You can do whatever you want from there. ;)

    This big update should be available within two weeks.

    Enjoy!
     
  30. Ashkan_gc

    Ashkan_gc

    Joined:
    Aug 12, 2009
    Posts:
    860
    Hi
    Very nice product. I'm currently user of another voxel engine which is nice and has very nice developers as well but its integration with unity leaves one asking. Got a few questions before buying ultimate terrains

    - Can we generate terrains at runtime using a seed with default generators for each world which the player makes?
    - Is the engine deterministic so if my clients send commands to the server for a modification, they all end up with the same terrain?
    - Can I use raycasts or normal array reading or some other way to get info about the voxels without heavily modifying the engine? I want to know say if I dig here what material am I gathering and things like that.
    - (should be yes but still) Can I modify voxel size to 1/8 of a metter if I want? does ultimate terrains implements LOD so it can support this with say 50 m of view?
    - Can I run this on mobile if I have a small say 100x100x30 (x,z,y) world with big sizes of voxels (just out of curiosity for a small mobile project)?
    - Can I use Unity standard materials for voxels (for PBR and metallic surface support)?
    - Is there any support for water? rivers/oceans/…
    - Can I write my generators in a way which I can create my interest point objects like monster spawners and other things using the data which the generator used?

    Probably answers to many of these could be easily given if I have bought it and looked at the code but I prefer to know before spending as an indie.
    Note: I'm an experienced programmer which know a thing or two about voxels so coding my own stuff would not be an issue.

    Thanks
     
    Amandin-E likes this.
  31. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    Sure you can. Configure your terrain generation (ie. biome(s)) with noise generator modules (simplex, multifractal, etc.) and give them the seed you want (even programatically) and you're good.

    It is fully deterministic. Terrain generation, trees & details placement, rotation, scale, as well as grass. The way operations behave (dig, etc.) is also deterministic. Everything is deterministic, and this is something that will never change in future updates.

    You can get voxel information anywhere in the world at any time (even if the terrain is not generated yet). It will just "generate" the voxel on the fly for you. However, this is not ideal if you want to iterate over many voxels (it will be slow). The next update will come with a new tree spawner that uses some tricks to get voxel information by column very quickly (in order to place tree without the need to wait for terrain generation). You will be able to see this and implement your own method out of this.

    In the current version 2.0, there is a bug on this part. But the next update (again, coming in two weeks) fixes that. If you setup the terrain to use all possible LODs, a terrain with 1m voxels has a visible part of 8km. So, if you set voxel size to 1/8m, the max visible part you can have out of it is 1km.

    I'd say theoretically this should work. But it could take too much memory, and I haven't tested it so I don't want to make any promise.

    You can literally use the material(s) you want. My advice is to use a triplanar shader, but there is no restriction. You do what you want.

    No, and this is not on the roadmap.

    Well, you could create your own generator like trees spawner... or even use the tree spawner to spawn any object you'd like. But to be honest, this is not highly configurable for now.


    I hope you'll be satisfied by my answers! :)
     
  32. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    @Ashkan_gc
    Note: documentation is quite poor for now (I don't want you to be disappointed because of this). My next task is to improve it. So you can expect progress on documentation in the next weeks on time to time (it takes a lot of time to write it).
     
  33. Ashkan_gc

    Ashkan_gc

    Joined:
    Aug 12, 2009
    Posts:
    860
    Many thanks for the responses. I guess I'll buy, I mean my only other option which is good and support water atm is terrain engine which is hard to buy and probably very expensive. You're engine is quite nice and has good support and the docs are mostly good enough.

    The only other things which makes me afraid is not packing textures for reduced draw calls but should not be a big issue.

    I can customize the tree generator for my needs I guess :)
     
  34. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    Well, yes, I know this is not ideal. The terrain is made of multiple meshes too (but simple and small meshes so they are cheap). I haven't focused on this yet because I have never encountered issues because of it (even with a modest graphic card).
     
  35. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    @Ashkan_gc
    Also, to be completely honest, I recommend that you use RTP3 (or equivalent) as terrain material because the one that is included is pretty basic. BTW, if someone could help me improve it I would greatly appreciate!
     
  36. killer1171090

    killer1171090

    Joined:
    Feb 23, 2013
    Posts:
    70
    Im glad to know this is back! Im looking to purchase it asap! Just one question, on the website somewhere it used to say it could make planets is this still true? Im developing a space exploration game and im looking for large scale voxel planets for my game.
     
  37. Ashkan_gc

    Ashkan_gc

    Joined:
    Aug 12, 2009
    Posts:
    860
    @AmandineEntertainment I actually bought it yesterday and even asked a new question in your own wordpress based Q&A site. Don't know if there is better or here.

    I am not a good graphics programmer but I'm experienced and know a good deal about multiplayer networking. Would help in those areas and will provide my generators for others to use. Also probably can help adding Path finding support using unity's new navmesh custom components (if I see I need it in my game)

    I'm trying to make a procedural jungle and roads in it for now Will take care of visuals later on.

    I would say having some tutorials for making a few different terrain types would be very good, even if it takes a few days of yours, that could get people started quickly. Doesn't need to be pretty great, just shows how to do basic stuff and how to combine generators for say mountains with snowy peaks and ...
     
  38. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    I'm glad this is back too! :)
    You can render any shape, so yes, you can render a planet. However, keep in mind that the size of the visible part of the terrain is 8km max. So if your planet is bigger than that, it won't be entirely visible (its surface will be generated on the fly around the player so it will work, it's just that your player won't be able to see the entire planet from far distance).
    Just be clear also, Ultimate Terrains does not provide planet specific features such as planet gravity.


    Thanks for buying! The Q&A website is better for support so other users can retrieve answers more easily.

    That would be awesome! You could even give it/sell it on the Asset Store (just like stamp packs for Gaia for example), that's up to you.

    I definitely agree. I'm finishing to fix some bugs for update 2.1 and right after that I'll be working on documentation and I will make a getting-started video tutorial.

    Would be great if you post some screenshots on time to time!

    BTW, I've found an ugly bug in operations persistence (save & load). I've fixed it for update 2.1 but you probably won't be able to load operations persisted with 2.0. So do not spend time on sculpting your terrain by hand until the next release!
     
  39. Ashkan_gc

    Ashkan_gc

    Joined:
    Aug 12, 2009
    Posts:
    860
    Thanks for the responses. To be clear I will generate everything. I'm coming from another voxel engine where basically each voxel had a material or was not there and if had a material could have a vector saying where the terrain surface passes. Yours is not yet clear to me. You only have a single value choosing the relation of the voxel to the surface.
    What does it mean in effect? Is it only calculated in relation to the voxels around a voxel?
    What happens if all voxels are set to say 0 or 1 or -1?

    I wanted to create a simple road using the function f(x)=y but with some default thickness. The result was ugly at best

    To be quick I modified flat combiner to this, I realize this is not true but am not sure what should I do since first of all , the default definitely goes above and beyond [-1,1] range and I don't know how do you normalize after that yet.


    Code (CSharp):
    1. public void Combine(float x, float y, float z, float[] values2D, float[] values3D, out float voxelValue, out VoxelType voxelType)
    2.     {
    3.         voxelValue = y - height;
    4.         if(Mathf.Abs((x+0.1f) - (z+0.1f)) < 15 && voxelValue >= 0)
    5.         {
    6.             voxelValue = 1;
    7.         }
    8.  
    9.  
    10.         voxelType = mainVoxelType;
    11.     }
    Thanks for the help in advance. I promise I'll get back when I learn more.
     
  40. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    @Ashkan_gc
    Basically, you can think of the voxel value as the distance between the voxel position and the surface (but not exactly, see below...). The surface is interpolated between voxel values.

    Voxel value is bounded between -1 (ie. completely inside) and 1 (ie. completely outside) and this may change. I think, after all, it would be probably better to bound it between -64 and 64 because this the distance between two voxel at highest LOD. If the value was bounded between -64 and 64, this would really represent the distance between the voxel position and the surface. As it is actually bounded between -1 and 1, if you want to be really accurate, you should think of it as being 1/64 of the distance between the voxel position and the surface. Don't know if it's clear?

    Now, let's see some examples where we have two neighbour voxels A and B:
    • if voxel A=-1 and voxel B=1, the surface will be exactly in the middle between A and B.
    • if voxel A=-0.5 and voxel B=0.5, this is the same (and here is the counter intuitive part => this is because value is interpolated).
    • if voxel A=-1 and voxel B=0.1, the surface will be between A and B, but closer to B.
    • if A and B have the same sign, there is no surface between them.
    • etc.
    This is not so easy to get used to it, but the benefit is that you can use mathematical noise functions out of the box to create a voxel field.
    BTW, I'm curious, how did you manage to generate the voxel vectors from noise in the other voxel engine? Did you have to do this by yourself?
     
  41. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    3,146
    What do you mean? just a big floating cube array (that is if we move to 45° all cube are slanted relative to normal to center) or it actually tile around a surface? if true how does it handle "poles"? Does it work with geosphere?
     
  42. killer1171090

    killer1171090

    Joined:
    Feb 23, 2013
    Posts:
    70
    Awesome, I can always make a fake planet to act like a LOD system.
    Would it be possible to save the terrain as a prefab and spawn it in runtime?
     
  43. Ashkan_gc

    Ashkan_gc

    Joined:
    Aug 12, 2009
    Posts:
    860
    @AmandineEntertainment It is more clear but not intuitive at all honestly speaking.
    Let's say I want to make a cave inside a complete cube, say I want to have a big cylinder empty inside it but the rest is filled with different materials. I cannot easily think of this

    in the other system I received an array for the cell and was supposed to fill itt with each voxel's data

    the data was,
    - do you have a material here (i.e. any voxels here)
    - if you have, if you want a smooth surface, tell us where in this voxel surface crosses, the value was a vector with 0,0,0 at a bottom corner and 11,1 at the top corner in the opposite side.

    To use noise functions you could easily compare the value of the noise function in your position with your y coordinate and see if you want a voxel there or not.

    I wonder if I can easily define a volume in your system or not? I mean if I want the whole cell to be initialized with voxels of different materials , what should I do? initialize all walls of the cube with 1 and the rest with -1 , probably would only create a surface at walls, Can you tell us how to define our desired volumes, after all one of the points of working with voxels is to be able to easily work with procedural algorithms and volumes. I love that I can easily add generators to your system and I love that the source code is in C# but is there any way to add other ways to define voxels in a chunk, like what one other user requested to give you a 2d or 1d array with voxel values which are basically {IsVoxelOrAir,MaterialIdIfVoxel,VectorDescribingSurfaceIfApplicable}
     
  44. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    Not sur to understand your question, bug you could typically make something like this: http://www.scienceofthespheres.com/blog/wp-content/uploads/2014/09/2014-09-23_00-11-17.png
    Note: this has not been made with uTerrains! It's just some picture found on the web to give you a quick idea.

    Terrains can be saved as prefabs and used across multiple scenes, yes.
    A terrain can be either dynamically generated (so you have nothing to save except its configuration) or baked. Baking is only suitable for small terrains because it takes a lot of memory.
    That said, when you make some manual modifications to the terrain (through operations), the operations are saved so they can be applied over and over when needed. In other words, we only store modifications made to the terrain. This allows to have very small saves. Note that this is currently bugged in version 2.0 and fixed in upcoming update 2.1.

    I think you just need to get used to it. Personally, I cannot think very simply of it with the other system way. What you want to make would look like this:
    Code (CSharp):
    1. public void Combine(float x, float y, float z, float[] values2D, float[] values3D, out float voxelValue, out VoxelType voxelType)
    2. {
    3.     // Cube
    4.     if (x > cubeMinX && x < cubeMaxX && y > cubeMinY && y < cubeMaxY && z > cubeMinZ && z < cubeMaxZ) {
    5.         voxelValue = -1f; // a negative voxel value means we are "inside". Here we just fill the cube.
    6.     } else {
    7.         voxelValue = 1f; // we are outside the cube
    8.     }
    9.    
    10.     // Dig cylinder inside the cube
    11.     voxelValue = Mathf.Max(cylinderRadius - distance(x, z, cylinderCenter), voxelValue);
    12.    
    13.     // Voxel type determines the material, you can set whatever you want to it... like:
    14.     if (x%2 == 0) {
    15.         voxelType = evenXVoxelType;
    16.     } else {
    17.         voxelType = oddXVoxelType;
    18.     }
    19. }
    I hope this is clearer now. Let me know if you need more help. I have to write all this in documentation, because today I do not provide enough info to users and you cannot understand by yourself (my bad).

    Yes but how did you do for 3D noise functions (not just comparing with Y)? Typically, how would you generate an asteroid field?
     
  45. Ashkan_gc

    Ashkan_gc

    Joined:
    Aug 12, 2009
    Posts:
    860
    @AmendineEntertainment, Now it is super duper clear! Many thanks. I might be able to help you with the docs soon hopefully.

    I never used 3d noise functions before but now that you wrote your example, I can see how to do stuff in uTerrains and it is not an issue anymore.
     
    Amandin-E likes this.
  46. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    @Ashkan_gc this would be very helpful if you could help me on the doc, especially by giving some feedback (sometimes things look clear to me but might be badly explained)!
     
  47. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    And BTW, in the example I gave you above, the cylinder would be a good candidate for a 2D value generator (in which you would compute the distance), and the final combiner would use its value directly in Mathf.Max(...). This would make it reusable, cachable, and better for performance as 2d values are computed only once per x/z coordinate.
     
  48. Ashkan_gc

    Ashkan_gc

    Joined:
    Aug 12, 2009
    Posts:
    860
    Yes I know, and if you want it to not cancel out your -1's actually you need a condition there. Issue is it is not smooth at all :( I guess I'm doing something wrong.

    See the image and the code upload_2018-6-4_20-27-42.png

    Code (CSharp):
    1. public void Combine(float x, float y, float z, float[] values2D, float[] values3D, out float voxelValue, out VoxelType voxelType)
    2.     {
    3.         if (y > 20 || y < -20)
    4.         {
    5.             voxelValue = 1;
    6.             voxelType = mainVoxelType;
    7.             return;
    8.         }
    9.         if (Mathf.Abs(x) < 20 && Mathf.Abs(z) < 20)
    10.             voxelValue = -1;//y - height;
    11.         else
    12.             voxelValue = 1;
    13.  
    14.         float distance = Vector2.Distance(Vector2.zero, new Vector3(x, z)) / 15f;
    15.         if (distance < 1)
    16.             voxelValue = distance;
    17.  
    18.         voxelType = mainVoxelType;
    19.     }
    Let me know what I am doing wrong. I'm trying to make a small cube with a cylinder cutting it in the middle as you can see and it is working nice other than it is not smooth. Do I need to tweak LOD values or I'm doing something wrong here? Or maybe is it because we are using floats instead of doubles for voxel data?

    About the doc, I'll surely give you feedback and surely will help. Whenever I figure this out a bit more, which seems to be soon, I'll write some stuff up and will try to help. I've worked on dev tools much myself and wrote docs before as well.



    There are multiple issues, one seem to be the UV of inner surface of the mesh is not right and second thing is the smoothness. It is the standard material here but with your material the only difference is that grayish parts are fully black, if I dig spheres inside the cylinder then those parts will have correct UVs
     
    Last edited: Jun 4, 2018
  49. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    @Ashkan_gc

    Here is the code:
    Code (CSharp):
    1. public void Combine(float x, float y, float z, float[] values2D, float[] values3D, out float voxelValue, out VoxelType voxelType)
    2.     {
    3.         if (Mathf.Abs(x) < 20 && Mathf.Abs(y) < 20 && Mathf.Abs(z) < 20) {
    4.             voxelValue = -1f;
    5.         } else {
    6.             voxelValue = 1f;
    7.         }
    8.  
    9.         voxelValue = Mathf.Max(voxelValue, 10f - Vector2.Distance(new Vector2(x, z), Vector2.zero));
    10.         voxelType = mainVoxelType;
    11.     }
    Result:
    Capture d’écran 2018-06-04 à 18.14.57.png

    Explanations:
    Your result is not smooth because your cylinder only affects voxel that are fully inside the cylinder (because of if (distance < 1)).
    Keep in mind that surface is interpolated between several voxel values, so you have to affect the voxel that are outside the cylinder (near the surface) as well (your condition should be if (distance < 1.5) for example), and you should use Mathf.Max.
    Here is some simple rule to remember: digging is done by taking the Max, and adding is done by getting the Min ;)
    Get a look at DigSphereOperation code to get an example about this.

    You're right, there are some issues with the shader & UV coordinates. I will fix this in a future update. Thanks for the feedback.
     
  50. Amandin-E

    Amandin-E

    Joined:
    Feb 4, 2015
    Posts:
    209
    Just a word to say I'm currently working on documentation. The version 2.1 is almost done (I'm just finishing to test it) and I will upload it to the Asset Store soon.

    Beside that, I'm also working on a new live demo. Here are a few screenshots. I'm using of course Ultimate Terrains for the terrain & grass, RTP3 for texturing, AQUA for water and some Speedtree for the trees. It's still WIP.

    Note the floating island and the caverns at water level.

    01.png 02.png 03.png 04.png 05.png