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

Voxeland - Voxel Terrain Tool

Discussion in 'Assets and Asset Store' started by Wright, Jun 25, 2013.

  1. Olafson

    Olafson

    Joined:
    Aug 7, 2012
    Posts:
    255
    Yes. I would split it into several smaller files that I can then dynamically load and unload just like any other object in the game.

    Should work, I guess. Still not optimal. Would be nice if you could do something about the terrain size problem, but I do understand that it is a huge problem and hard to make. Everything has a flaw, and it seems to be that this is the flaw of voxeland.

    Thanks!
     
  2. ZoeDreams

    ZoeDreams

    Joined:
    Dec 6, 2013
    Posts:
    21
    First I would like to thank you Wright for putting together a great scaffolding for a dynamic voxel world. This was exactly what our studio was looking for. Your code was easy to understand, and your documentation is great. Considerably better then other paid assets we have downloaded.

    I have read though this thread, all of the documentation, and code multiple times. I will preemptively warn you that this may be considered TL;DL; to those whom seek a turn key answer. Short answer there is no short answer to get what you want. More information below.

    Our team has been able to get the recommended 4MP terrain working without a hitch. We successfully created and loaded 8MP (8096 x 8096). However after many performance tests, we prefer the recommended 4MP, as this allows us to render worlds 512 tall!!! We do not bake our terrain, it is editable by player and physics by design. This allows for destructible, player and script modifiable terrain.

    Lets face it, the standard built in terrain isn't very good. It also lack the extensible and robustness demanded by our current players. So we did not opt for terrain engines that utilize the existing system. The existing prefab that voxeland creates is the most performing way we have used thus far.

    However unlike the recommend 15 block chunk size, we prefer 32 block chunks. For testing and development i do not run with dynamic building. This is very annoying when navigating around the scene graphs, as it redundantly loads the same chunks every time you move the scene graph (bug?). Luckily i have 16GB of ram so its not to much of an issue, these maps use about 4GB of ram when loaded. But barely use any when you have dynamic loading on, and even less when you have per frame rendering that uses more CPU.

    Voxeland does lack infinite scrolling terrain, but that could easily enough be scripted. There is also no documentation on the format of the text dump for file saves and imports. There is also not a tool to covert fbx height maps or normal maps into voxel textual load files.

    In fact loading terrain as regions which consist of chunks of terrain is the most efficent way to handle very large terrains. Also a tool to convert voxel land to a height map would be great; even with omitting subterranean caverns or caves. We have created one for our project, however adding one to the asset would be a sure win!

    Once you have generated your terrain file, besure to go into the land generator and turn down all of the default values. The default values hammer your system hard and take FOREVER!!! i found justa fractal iterations and a couple errosion passes is fine. Wright has like 40 or so passes per chunk!!!

    Also make sure you have atleast 4 block types declared to generate land properly. Also make sure not to save the voxels into the scene. This is SLOW!!! Try putting this file on a RAM disk or SSD.

    after the new years i am planning on incoroporating some new algorithms to use dynamic region sizes so that we can have larger then 512 height. This will allow for mount everest size mountains ... >4MP height. however you are limited to the depth and width to around 512. This can create loading lag if you do not handle LOD.

    anyways thank you for reading. good luck and happy coding.

    ~kara marie
     
  3. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,265
    Thank you krawson, such a posts inspire me on the improvement of Voxeland.

    The dynamic build should not be calculated on every camera move. It seems that you have a tiny delta between Remove Distance and Build Distance. Try increasing it. The camera should travel that delta before building new chunks will start.

    I plan to expand the import and export functionality and add such a features like import from heightmap and standard Unity terrain and export to model. I do not think that someone can use data exported to text because it is purely internal feature to transfer data between Voxeland versions or to save data in-game and to load it in other game session.

    The feature to ignore meshes on saving is almost ready, but I've got memory leaks related with it. As soon as I will remove those leaks Voxeland scenes could be free from bulky mesh information.

    Height limitation is mostly related with ambient calculation. I'll thinks about how to expand this value, or giva an ability to create non-ambient terrains without that limitation.

    I must admit that you've mentioned the most weak spots and bottlenecks of Voxeland. It's mostly matches my own to-do list, and I am working on its improvement.
     
  4. saswilson

    saswilson

    Joined:
    Jun 6, 2013
    Posts:
    44
    Hi, when I try the demo and switch between textures, it works fine, but when I import voxeland into my project and load the same textures as the ones in the demo, only the ground texture works. Clicking on the 2nd texture just builds another ground block. Can someone help me out?
     
  5. saswilson

    saswilson

    Joined:
    Jun 6, 2013
    Posts:
    44
    Actually, when using Voxeland on Android, for me I've found that the problem is the shader that I'm using. The only only that works (displays all my selected textures) is the Voxeland/Terrain4 shader. I really need to use one of the mobile shaders, but I just get the same problem I've posted above. Anyone else experience this, or knows of a fix?
     
  6. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,265
    saswilson, what kind of shader are you trying to use on terrain for mobile device? Terrain4 should work just fine, and if it does not then I need more details. Bumped shaders are for web, mac and pc builds.
    ps please note that voxeland should use special voxeland shaders, so Unity build-in mobile shaders will work too.
     
  7. saswilson

    saswilson

    Joined:
    Jun 6, 2013
    Posts:
    44
    Thanks, basically, the only shader that displays all my active textures is the Terrain4 shader. All mobile ones only display the "ground" texture.
     
  8. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,265
    Voxeland uses texture blending based on mesh vertex color information. Standard mobile shaders do not have a support for this.
     
  9. saswilson

    saswilson

    Joined:
    Jun 6, 2013
    Posts:
    44
    Ok thanks. It's it possible to use Relief Terrain Pack v3 with Voxeland?
     
  10. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,265
    Honestly, I have not tested Voxeland with RTP. Most probably shaders will work but will have no support for blending.
     
  11. ZoeDreams

    ZoeDreams

    Joined:
    Dec 6, 2013
    Posts:
    21
    thank you for the LOD tips, they worked quite well.

    i had no luck in getting the import and export to work. Which i suspect to be caused by some type of encoding. I will be experimenting with this more tomorow and next week as i try to come up with a better persistence method for multiplayer scenarios.

    That is understandable. I have successfully tested worlds 512 high and they work f ine, slow but they work. I have also realized that you can not load more then say 4 or so gigs into unitys memory before you get heap stack errors. I got around this by using 256 height worlds which is pretty giant. After more experimenting using worlds ?4km is overkill. Even at 1km you generate some pretty epic landscapes. Try fractals such a 90/92 and 90/92 @ 2 total :) Even so you should generally be procedurally loading terrains based on player transforms. Currently im working on trying to use 256 x 256 x 256 cubes, and stitch them together with some fancy js magic.

    As with anything that pushes science to the limits you will find errors. Hopefully with all our testing and your dedication we will create something even more amazing :)

    thank you for your time. And is there a rough time when to expect a patch or new version to voxeland?
     
  12. ZoeDreams

    ZoeDreams

    Joined:
    Dec 6, 2013
    Posts:
    21
    Could you please explain how multiplayer over network would work a bit better. More specifically this line in your documentation is not clear to me

    "To syncronize the terrain on newly connected player's computers you can use VoxelandOctNode.SaveToIntList(out
    list:List.<int>) on master."

    on master? what is master. I assume it is the master terrain file on the server. How does this work or how do i get a master. I understand the principal of what your doing, but don't fully understand which terrain i pull this from???

    Do you have an example or demo project this demostrates it? I am using photon.

    TIA
     
  13. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    Hey Wright!

    Your plugin looks really awesome, and I want to buy it RIGHT NOW, but I have a few questions about it to make sure it will work with our game before buying it. I tried reading the whole thread first, so please excuse me if they were answered already:

    1) Custom Shaders - I noticed that this package comes with it's own shaders but is it possible to use custom written shaders with it, or does it only work with the shaders that come with the package?

    2) Does this work in web player? This is a big one for us as our game is a web player game.

    3) Does it work with streamed scene asset bundles? The way we are handling our game is each scene is exported as a streamed scene asset bundle and loaded before playing. Since it is web player we lower the initial download of the game by only loading the levels that are needed. I noticed that the terrain data is stored in a separate asset, so how would this work with streamed scene asset bundles? Would the terrain data be included or would we have to load it in separately?
    http://docs.unity3d.com/Documentati...ldPipeline.BuildStreamedSceneAssetBundle.html

    4) Does the terrain have to be a closed mesh? It seems to be a waste of polygons to have the edges and the underside of the terrain if you never see it.

    5) Is it possible to have 3 or 4 small terrains in the scene, and duplicate them as instances to reduce total memory? Say I have 3 terrain chunks that all blend together seamlessly, I can copy the meshes around to make the map feel bigger, and to reduce the amount of memory needed instead of having 1 large terrain with unique geometry.

    6) Is it possible to bake the terrain mesh and possibly export it for further editing?

    Hope to hear from you soon. Thanks!
     
  14. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,265
    krawson, I'm working on Voxeland 3 right now. It was re-written in C#, code was refactored. After I'll add a features I've plan - it will take a couple of weeks, maybe more - it will be available in Asset Store.

    When the new player is connected, one of the players (or maybe all of the players, but this will be traffic waste) should send him the terrain that is actual at the moment of the game. It is not enough for new player just to load terrain, as it could be changed by others.
    In Unity's standard Networking it is convenient to make player who runs the server be responsible for sending terrain to newcomers (but actually, it could be any player - for example, one with the fastest connection).
    Please note that the abovementioned has a sense only if it is allowed to connect or re-connect during the game. When all the players start a round and more players is not expected it would be handy simply to load initial unchanged terrain.


    Fishypants, thanks :) It is possible to create custom shaders. To make texture blending in our shaders you should use vertex color information: r,g, and b channels are for the first three textures, and (1.0f-r-g-b) is for the fourth one. Vertex color alpha sets the additional ambient value.

    Voxeland works in web-player. Here is the demo. I think it should be possible to include data asset along with the scene, actually, like a standard Unity terrain's data.

    Terrain is not a closed mesh. It has neither sides, nor bottom faces. You can create them (using "Cap" section in settings), but it is not necessary.

    It is possible to have as many terrains as you like. Someone on forums have made seamless welding of different terrains - but this welding feature does not comes "out of the box" with Voxeland.

    It is possible to convert terrain to standard unity meshes to make occlusion culling and lightmapping. I've made an exporter to .obj file, but, unfortunately, obj does not contain vertex color information which is vital for terrain texturing. So exporter code was commented out because it looked like a bug (but you can enable it uncommenting VoxelandEditor, script.guiExport section).
     
    Last edited: Jan 23, 2014
  15. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    Awesome! That sounds great. I'm going to buy it at give it a go. Do you have an online web player example? The link you provided sends me to http://unity3d.com/webplayer/ instead.
     
  16. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    Wait, nevermind, I found it. Awesome! Can't wait to try it out :D
     
  17. ldlework

    ldlework

    Joined:
    Jan 22, 2014
    Posts:
    46
    I just bought Voxeland and I've been playing with it for a few hours. I have this crazy problem where if I turn off playmode editing, any where the player goes this very horrid artifacting appears.

    $cLcymY1.png

    I'm having to disable the highlight and editing features of playedit mode just to use this asset :(
     
  18. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    For some reason when I try to create a terrain with anything other than default settings, the terrain doesn't show up at all. Plus I get a lot of errors like:
    InvalidOperationException: Operation is not valid due to the current state of the object
    System.Collections.Stack.Peek () (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Collections/Stack.cs:321)
    UnityEngine.GUILayoutUtility.EndLayoutGroup () (at C:/BuildAgent/work/d3d49558e4d408f4/artifacts/EditorGenerated/GUILayoutUtility.cs:222)
    UnityEngine.GUILayout.EndVertical () (at C:/BuildAgent/work/d3d49558e4d408f4/artifacts/EditorGenerated/GUILayout.cs:265)
    UnityEditor.HostView.OnGUI () (at C:/BuildAgent/work/d3d49558e4d408f4/Editor/Mono/GUI/DockArea.cs:126)
     
  19. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,265
    ldlework, seems that lod do not turn off somehow. Try downloading this file (Voxeland.js). If it will not help I'll need to investigate further.

    Fishypants, yeah, link is fixed )))
    Just testing out terrain creation. I could create terrain both on Unity 3.5.0 and Unity 4.3.1 with any parameters without errors. Btw never met such an errors. Looks intriguing. What is your Unity version? What exactly parameters did you change? Would you be willing to send me project (just remove everything secret and unnecessary from it)?
     
  20. delinx32

    delinx32

    Joined:
    Apr 20, 2012
    Posts:
    417
    Whenever I use the substance to create two textures and then apply them to two different blocks, it seems to get confused as to which to use. It doesn't necessarily use the one that I have selected. Is that a bug in Voxeland, or am I using the substance thingy wrong? I don't really know about substances, but i just created two different ones. They both appear to be correct.

    Also, glad to hear that you rewrote in c#, although its a bit irritating too because I just finished porting my copy of the code to C# yesterday!

    *EDIT, not sure what's going on. See below, the hard line between the red and brown textures. I was clicking with the same texture on both sides of that line. No matter what, red would go on the right, and brown on the left.

    It also appears that block types are getting confused in edit mode. It doesn't always paint with the block you appear to have selected in the demo.

    $Capture.PNG

    *EDIT2, After going through the code and playing with it a bit I think I understand. You support any number of block types, but it only appears to be 4 per "chunk"?
     
    Last edited: Jan 24, 2014
  21. ldlework

    ldlework

    Joined:
    Jan 22, 2014
    Posts:
    46
    Wright,

    That modified script indeed fixed the un-textured LOD mesh from appearing in game when the player collides with the terrain mesh. However, now in the editor when the Voxeland object is selected, I see this wireframe: http://i.imgur.com/U5KrPJ4.png
     
  22. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,265
    delinx32, yes, the limit of textures per chunk is 4.
    Btw I'm not only rewrote the code - besides just a conversion to C# I've made code refactoring and made it more stable and simple to move further.

    ldlework, Unity can hide wireframe with EditorUtility.SetSelectedWireframeHidden, but this function cannot hide collision wire. So I found a workaround by assigning zero materials on collision object renderer. Somehow this workaround does not work in your case. What is your Unity version?
     
  23. ldlework

    ldlework

    Joined:
    Jan 22, 2014
    Posts:
    46
    Wright: 4.3.3f1
     
  24. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,265
    ldlework, I've upgraded to Unity 4.3.3f1 and still could not reproduce a bug. Are you willing to send me a project (remove all unnecessary from it) to mail@denispahunov.ru?
     
  25. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    Hey Wright,
    Would it be possible when baking the terrain to meshes, to weld / merge the edges of each block so each chuck is a continuous mesh? The reason I ask is because we are using webplayer and we need to use low resolution lightmaps (less than 1k). Right now when we bake the lighmaps the lightmapper is separating each chunk and the the resolution is so small, it's creating weird artifacts in the lightmap. I believe if the mesh is a continuous mesh the lightmap will blend across the chunks better and not reveal the artifacts as much.

    Right now I can increase the lightmap resolution and the artifacts disappear but the resulting lightmap size is too high.

    Let me know if any of this makes sense. If not I can create example images showing the problem and the solution. Thanks!
     
  26. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,265
    Fishypants, you can try checking "Weld Verts" checkbox in Settings. This will weld all of the chunk verts. But it will not solve lightmap problem - actually, it will not solve any mapping problem because welded verts does not support UV. The reason is that the voxel terrain could not be turned to planar uv - it has hanging blocks, arcs, caves, etc. - actually, you can sculpt terrain in shape of a rabbit or any other form:). Probably it is the reason why you give preference to Voxeland, and not standard terrain ). So the most obvious way is to make per-face uv and then pack uvs into one lightmap. Voxeland takes the quad of 4 faces welded together - it is slightly enhanced algorithm. To improve it further there should be a complex uv unwrap engine with seams editor, relax tools and etc. I do not plan to make a 3ds max out of Voxeland, at least for now :)

    Have you tried changing "Lightmap padding" setting? Decreasing this parameter can cause padding artifacts, but it will greatly reduce amount of un-mapped texture space.
     
    Last edited: Jan 26, 2014
  27. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    Wright, where is the "Weld Verts" option? I can't seem to find it. Under Voxeland Settings I have the following options:
    Chunk Size
    Playmode Edit
    Do Not Save Playmode Changes
    Normals Smooth
    Normals Random
    Lightmap Padding
    Save Meshes With Scene
    Hide Chunk Objects
    Cap Bounds


    Honestly, I think the verts should be welded by default. This will definitely fix the lightmap problem. Here is what I am seeing after baking the lightmap:
    $screen-1.jpg

    Which is wrong. I've adjusted the Lightmap Padding, with no success and honestly this wont fix the issue. The problem is the lightmap is small, so the pixels of the lightmap texture are being split between blocks edges like this:
    $screen-3.jpg

    This is happening because the way the lightmapper works, it will layout the uvs based on the mesh borders. It will then split up each uv shell further based on edge angle. Since every face of every block is already separated, it just lays out the uvs per block face (which is bad). Like this:
    $screen-4.jpg

    If the chunk vertices are merged however, unity will break out the uvs based on angle between faces, and you get a more continuous uv layout which will allow the texture to blend correctly across the block faces like this:
    $screen-5.jpg

    I exported a chunk and merged the vertices in Maya. I then reimported it into Unity and baked the lightmap on it. The results are correct and what I am after:
    $screen-2.jpg
     
  28. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    Continued:

    Notice how the lightmap pixels blend correctly between the block faces:
    $screen-6.jpg

    So if there is a way to merge the vertices please let me know. I can generate the secondary uv2 lightmap using Unwrapping.GenerateSecondaryUVSet(). As long as each chunk is a single continuous mesh, it will lay out the lightmap uvs correctly. Ideally it would be good to have Voxeland automatically weld the vertices and call Unwrapping.GenerateSecondaryUVSet() on each chunk it generates, so the vertices would be continuous and it will automatically have lightmap uvs set for each chunk.
     
    Last edited: Jan 27, 2014
  29. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,265
    Fishypants, I'll see what I can do with GenerateSecondaryUVSet. Thanks for advice. However, welded verts do not allow per-face mapping which is used not only for lightmapping, but also for uv1 channel. So welded verts feature should be shipped with triplanar shader only, which I plan for the next version.
     
  30. ZoeDreams

    ZoeDreams

    Joined:
    Dec 6, 2013
    Posts:
    21
    Fishypants brings up some good points that I agree with. How about a supported (Pro) option for using light probes, and update them based on terrain changes. Never thought of that until now, as our dynamic shadows look amazing in voxeland. This was actually one of the main reason we decided to using this over terravol.

    LOD UPDATE
    I think i have nailed down some good parameters for the LoD. The only mode which i believe would be useble would be the per frame building. This works similiar to how minecraft builds and loads its chunks; however this is not plagued with dreaded lag spikes. I have found that keeping a much higher remove distance creates a much smoother play experience, as it invokes the GC alot less. However you use a bit more ram. I also found setting my build distance lower works better, as this loads chunks more smoothly. My current tested settings at 80, 240,40 are nice. I am thinking of bumping the remove further out as i do some more profiling of the memory usuage. Turning off LOD or per frame usually results in out of memory errors.

    I forgot if you mentioned it or not, but will version 3 have infinite scrolling terrains or any improvements to the current landsize of about 2km to 4km? Also will i be able to load a terrain from a height map? And lastly will it have better multi-threaded processing for loading chunks?
     
  31. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    Wright,
    I was reading up on the welded vertex issue, and you are totally right. Sorry about my confusion due to lack of understanding on my part. Weird that Unity doesn't allow this, but I think its more of a limitation of real time rendering and not really a Unity issue in general.

    Anyways, I have good news! I was testing out Unwrapping.GenerateSecondaryUVSet, and it totally fixes the lightmapping issue. I had to create a UnwrapParam object and give it values for the unwrap, but it works like a charm. I've found that these settings usually play very nicely with the general smoothness of Voxeland created meshes:

    Code (csharp):
    1. Mesh mesh = Selection.gameObjects[i].GetComponent<MeshFilter>().sharedMesh;
    2.            
    3. UnwrapParam param = new UnwrapParam();
    4. param.angleError = 0.99f;
    5. param.areaError = 0.99f;
    6. param.hardAngle = 45;
    7. param.packMargin = 0f;
    8.                
    9. Unwrapping.GenerateSecondaryUVSet(mesh, param);
    Now the lightmap smoothly blends across the mesh surface, even at low resolutions :D
    $screen-7.jpg
     
  32. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,265
    Thanks for the unwrap parameters! I'll use them as a default in the next version.

    Btw you've got a really nice picture :)
     
  33. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    Thanks! BTW - I LOVE making terrains in Voxeland, it takes all of the tedious work out of terrain creation and makes it fun to use, and its probably the fastest way to make unique, interesting terrains. Great job on your hard work in developing it! :D
     
  34. ZoeDreams

    ZoeDreams

    Joined:
    Dec 6, 2013
    Posts:
    21
    i would agree, once you learn the algorithms for the terrain gen its pretty amazing what you can get. Its even more fun to explore it first person and edit it. Looking forward to the next version.
     
  35. stevesan

    stevesan

    Joined:
    Aug 14, 2011
    Posts:
    65
    Just wanted to say, I've been hacking up Voxeland a TON for our game Subnautica (http://subnauti.ca). Some features I've implemented:

    - Arbitrary materials/shaders and blending. This allows us to, for example, animate lava blocks.
    - Octree streaming for HUGE worlds, limited only by HDD space.
    - Almost completely eliminated GC alloc in meshing code.
    - OctNode is now a ValueType, and only takes 8 bytes per node. Also pooled, so dynamic voxelization causes 0 GC as well.
    - Multithreaded chunk meshing (still has some main-thread parts I'd like to get rid of. Mesh colliders is probably the biggest problem).

    We will be releasing a "terrain test" soon, which is meant to be like ShaderToy but for terrain generation code :) I will post the link sometime next week when it's ready to go...
     
    Last edited: Feb 2, 2014
    KaletheQuick likes this.
  36. stevesan

    stevesan

    Joined:
    Aug 14, 2011
    Posts:
    65
    Also I was wondering, what smoothing algorithm does VL actually use? Is it something you tweaked on your own? I would have expected it to be Catmull-Clark, but reading the code, it doesn't seem to be (although it's similar).
     
  37. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,265
    Fishypants, krawson, thanks! It's really nice to hear that my work has been appreciated!

    stevesan, your game looks really promising. Solidifying lava - is that also Voxeland?

    Voxeland uses Catmull-Clark subdivision algorithm with one face vertex and for edge verts. But Voxeland has a slightly changed smoothing: instead of one iteration it makes two, each is analog of relax modifier in 3ds max: move vertex toward the average position of its neighboring vertices. One iteration is for non-subdivided mesh, and one is for subdivided.
     
    laurentlavigne likes this.
  38. stevesan

    stevesan

    Joined:
    Aug 14, 2011
    Posts:
    65
    @Wright ah thanks for the clarification! So when you say you use CC subdiv, you just mean the way you create new verts/edges/faces, right? You don't actually use the CC algorithm to POSITION the verts, correct?

    I would like more artist control on how smooth certain blocks get, so I guess I can play with how much they move towards their neighbor average. I will go ahead and try this...it would be great to have smooth hills! :)

    That lava dissolve thing is our own mesh effect, but you should see our lava voxeland shader :) Using my material blending, we have animating voxeland blocks!
     
    KaletheQuick likes this.
  39. stevesan

    stevesan

    Joined:
    Aug 14, 2011
    Posts:
    65
    Oh also, this is technically not released yet, but I wanted to share this with voxeland users. We're gonna be releasing our "terrain test" very soon, which is just demonstrating the terrain engine we're developing for our game (based on VL), but you can write your own terrain gen plugins too! It has hotloading, which is great fun for tweaking and iterating on your plugin.

    All info you need is here: http://tinyurl.com/subtt
     
  40. ZoeDreams

    ZoeDreams

    Joined:
    Dec 6, 2013
    Posts:
    21
    try using RSP for some awesome relief shading. That should be able to give you the control your looking for, without increasing script call.
     
  41. ZoeDreams

    ZoeDreams

    Joined:
    Dec 6, 2013
    Posts:
    21
    so thats a mod for voxeland?
     
  42. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,265
    stevesan, that's right: Catmull-Clark algorithm is used only for subdividing. Positioning algorithm is slightly different - it is rather simple and I don't even know if it has any name ) In version 3 there will be a "smoothness" block type parameter, which allows to control how smooth the terrain covered with will be. Setting smoothness to 0 will make a terrain look in a cubical style, like Minecraft.

    I also haven't quite figured it out )
     
    KaletheQuick likes this.
  43. ZoeDreams

    ZoeDreams

    Joined:
    Dec 6, 2013
    Posts:
    21
    Hi Wright,

    I added a fix on voxeland.js for if you are loading the prefab before your camera may be ready. When running in build mode it would not crash, but the editor seems to complain.

    Code (csharp):
    1.  
    2. function Update ()
    3. {
    4.     if(Camera.main == null) return;
    5.    
    6.     //update speed-up values. TODO - add camera rotation
    7.     var camPos : Vector3 = Camera.main.transform.position;
    8.         ...
    9.  
     
  44. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    Hey Wright,

    Would it be possible to make it so you can click the mouse button down and drag to add voxels, instead of having to keep clicking to add / remove each voxel? Or maybe an option to have click to add / remove and an option to click and drag add / remove?
     
  45. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,265
    krawson, yeah, this bug could happen on scene load. I've already fixed it in c# version, but your quick fix could be very useful to others. Thanks!

    Fishypants, funny: when I was making the firs version of Voxeland it had that behavior as a bug. But it was not so cool as it may seem: after the button it digged a block, than immediately the block under it, and so on - so some sort of a well appeared.
    I'll think about how to prevent digging below the changed block only, giving an ability to dig other blocks. Maybe rebuild a collider on mouse release only...
     
  46. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    Wright,

    Maybe you can make it so if the mouse is dragging, either limit the amount of digging / adding by a timer, or do it based on if the mouse has moved a certain distance. Something similar to the way Photoshop's spacing setting for brushes would be nice. For example:

    // Time based method
    timer = 0;
    OnMouseDrag{
    timer++;
    if(timer > 4){
    timer = 0;
    DigBlock();
    }
    }

    // Mouse position based method
    vector2 LastMousePosition;
    OnMouseDrag{
    // Get current mouse pos XY
    Vector2 currentPosition = mousePosition;

    // If the user moved the mouse more than a certain amount
    if(Vector2(currentPosition - LastMousePosition).magnitude > 0.4){
    LastMousePosition = currentPosition;
    DigBlock();
    }
    }

    I think checking the distance the mouse has moved in combination with a timer might work out ok. I might look into modifying the current Voxeland to see if I can get something working correctly.
     
  47. ZoeDreams

    ZoeDreams

    Joined:
    Dec 6, 2013
    Posts:
    21
    a Similiar voxeland engine called terravol implements this. It is more annoying then useful, as you dig alot of on wanted blocks. I would rather see something similiar to how the minecraft mod "World Edit" works. set a cubic region by right and left clicking the top left and bottom right corners. Then either copy, paste it to another position, clear it, rebuild it, regenerate it, or replace block type, etc....

    BTW that engine uses marching cubes which makes bigger terrain, but its not very pretty. Even with RTPv3.

    Speaking of which has anyone tried to see if they can get that to work with voxeland.

    I am going to experiment with using an LODGroup on voxeland, and some low res prefabs to display. This way we can hide the voxels in the editor, and only build them at run time. I think LODGrouping will be the key to allowing us to scale these small regions into many kilometers. Octree is awesome. but at the end of the day we need to be able to display 4000 meters. haing a build range of 5 chunks (~200m) is just not epic enough.

    Even if we set the transform scale of the voxel object to like 4 or 6 (and scale down our grass shaders. we get bigger land but its funky..) I would definately like to see the ability to adjust the vertice distance between all x, y, and z axis'
     
    Last edited: Feb 14, 2014
  48. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,265
    Fishypants, the problem is in the mouse delta. It does not guarantee that the mouse cursor will aim another block. And it seems to me that the timer will be more an a burden than a help.

    Region-editing like WorldEdit... It does not seems very useful to me. But theoretically it could be made on Voxeland, and even improved: there will be no need to work with console, all the commands could be implemented with buttons and spinners in Inspector.

    Speaking about the marching cubes it is necessary to say that they require about 2 times more faces on the same chunk because of "cutting" a planar triangles between two voxels.

    I cannot use LODGroup in Voxeland because, actually, it's a pro-only feature. So I Voxeland has it's own lod system. But you can try using lods as a plugin. Are you going to use LODGroup on voxeland as a whole or on chunks only?

    You need to adjust vertex distance in direction of x,y,z axis... between what vertices? Should it be on a grass or on chunks? You would definitely like to see that ability and I guess it is very important, but it's vague for me yet.
     
  49. XPAction

    XPAction

    Joined:
    Jan 13, 2014
    Posts:
    11
    what about Dual Contouring?? its faster
     
  50. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    So I have ended up making a few tweaks to Voxeland, still looking into the drag to add voxels feature. I'm close on getting something working for that. Ended up modifying the way it generates the terrain and I find that using the lower resolution mesh with a larger terrain yields better results for me than a smaller terrain using the highrez mesh. Also ended up writting a custom Unity to Maya Obj exporter for Voxeland terrains for quick adjustments and fixes in Maya. And finally wrote my own Triplanar shader which blends between 3 textures and 3 normals with the dirt area being paintable as vertex colors. All in all I'm super happy with this tool :D
    $voxeland-modifications.jpg