Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Voxeland - Voxel Terrain Tool

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

  1. xercool

    xercool

    Joined:
    Sep 5, 2017
    Posts:
    90
    Hi guys!

    I faced a problem w/ shaders after HDRP project set.
    The shaders don't support HDR mode.

    Please take a look @ screenshot.

    Do you have any ideas how to fix that?
     

    Attached Files:

  2. P_Jong

    P_Jong

    Joined:
    Jun 14, 2017
    Posts:
    51
    If you look in the comments above you will see some discussion already on this.

    Voxeland (ver 5.3.3 at the time of this post), does not work for either HDRP or LWRP.
    I'm having to already move forward on my current project that is a VR game using the LWRP for VR,
    and skip using Voxeland. A few developers I've talked with are waiting for these render pipelines to come out out of preview mode. But I'm hitting some amazing performance with the LWRP for VR that I really can't go back to doing things the old way.

    I think it is a bit more complex than @Wright making shaders that are compatible for HDRP and LWRP. If it was as simple as making a shader with Shader graph I think he might have already done that by now. I've already tried creating new shaders in shader graph and things still don't look correct in Voxeland (ver 5.3.3). So I've got to wait. But I'm sure when he does work on it the performance will be blazing faster than it is now.
     
  3. Gruguir

    Gruguir

    Joined:
    Nov 30, 2010
    Posts:
    316
    @Wright Could i use vertex color to store color values, or is it already used ? I'm using Voxeland (+array) material, and would like to paint red color on land block 0 (grass) position. Looks like the vertex color is always white ? (EDIT : got it to work by using ChunkMesh.EncodeColorChWeights, but i don't know if it can break something)
    Also maybe could we have an option to avoid deleting object blocks on Alter() method (use object block just for generation/placement then exclude them from data) ?
     
    Last edited: Sep 3, 2018
  4. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,618
    I plant to re-use some classes with their methods both in Voxeland and Voxelump. I don't plan changing the block structure yet - but if I'll do I will think of the way to upgrade the old one first. So I'm going to make newer Voxeland backwards compatible with the current one.

    The reason I'm not diving into LWRP and HDRP and SRP in general is that there's a lot could be changed before it all will settle down. I'm not a retrograde and wish to be on the edge of technology too, but I realize that I can't make Voxeland compatible with each and every upcoming change in SRP modes.
    (Sorry for duplicating the post).

    Yeah, I guess so.

    Yes, it's the way RTP and some other material plugins work. Switching Mesh Channel Encoding in Settings to RTP will store channel information in vertex colors.
     
    P_Jong and Ascensi like this.
  5. JanTuts

    JanTuts

    Joined:
    Dec 19, 2012
    Posts:
    7
    Hello @Wright!
    In an obviously ancient post in this thread, you said there was an untested .obj exporting feature, that could be enabled by uncommenting a few lines of code. Has this hidden feature since then been outright removed? I can't seem to find it anymore. I'm using Voxeland 5.3.3.

    Workable solution for the following problem in this post (no idea on actual cause though): https://forum.unity.com/threads/voxeland-voxel-terrain-tool.187741/page-43#post-3645676
    On a separate topic: I started encountering glitches when I edit some parts of the voxeland in the editor (see screenshots below). Any idea what might be causing this, and how we can prevent this from happening?
    It only appears to happen when trying to edit certain areas, while other areas edit without any issues.
    Same thing happens whether I add or remove blocks, with any size or type of brush.
    The terrain size is 300 (though we only ended up using about a 100 unit cube, the rest is empty) and display mode is set to "static" for both editor and playmode (since we need the terrain to stay exactly as it is during gameplay). We don't need to update the voxeland during gameplay and so "edit in playmode" is also off.
    Again I'm using Voxeland 5.3.3, and Unity 2018.2.1f1.

    Before painting in some blocks in this particular area:
    Screenshot_1536070580.png

    After painting in some blocks in this particular area:
    Screenshot_1536070633.png
     
    Last edited: Sep 6, 2018
  6. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    573
    Personally I think the glitch you are experiencing is related to how big your world is and how much memory your system has. When I was working with sizes larger than 600 that would happen often for me as well but when I upgraded from 16 to 32 GB it's very rare for me to experience.
     
  7. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    573
    @Wright so I have a Voxeland that I've manually sculpted and painted. I've seen this missing collider error for chunk#(61) in past projects..but is happening again..

    Is this something to worry about or is it a false positive? I've spent weeks on a terrain customizing it with tedious precision.. if the collider is somehow missing and this issue is on going - not just myself but others as well I think it would be good to have a recalculate colliders for chunk option.. I guess Voxeland should automatically force Voxeland to regenerate a new collider for any sculpted change?

    This is now what is happening:


    If I enter debug mode I get this error:
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. Voxeland5.Voxeland.Highlight (CoordDir center, Voxeland5.Brush brush, Boolean isEditing) (at Assets/Voxeland/Voxeland.cs:657)
    3. Voxeland5.VoxelandEditor.OnSceneGUI () (at Assets/Voxeland/Editor/VoxelandEditor.cs:110)
    4. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    5. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    6. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    7. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    8. UnityEditor.SceneView.CallOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2605)
    9. UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:1910)
    10. UnityEditor.SceneView.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:1757)
    11. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    12. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    13. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    14. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    15. UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:295)
    16. UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:288)
    17. UnityEditor.HostView.InvokeOnGUI (Rect onGUIPosition) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:255)
    18. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    19.  
    Update: maybe a clue -this visual glitch also turns on and of just by looking directly at it then looking away.
     
    Last edited: Sep 6, 2018
  8. JanTuts

    JanTuts

    Joined:
    Dec 19, 2012
    Posts:
    7
    @Wright / @Ascensi
    We've at least found a workable solution to the glitches: the glitched meshes were originating from tiny 1-block voids and floating 1-block balls and such. Filling in all the voids / digging away all the floating balls in the glitching area got rid of the glitching. I still have no idea why it's happening in the first place, but at least we can work with this.
     
  9. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,618
    Oh my, 5 years ago. It was Voxeland 3 or 4, and there's hardly even a line of code left from that times.

    The reason I didn't use that solution is because you could find plenty of free obj exporters even those times. But none of them could export the vertex color information, vital for the terrain painting. It's an obj format limitation, as far as I know. So you can save meshes, can edit them in Blender or other editor, but cannot use them with Voxeland shader anymore.

    I might guess it's because your chunk exceeds 65K vertex limit. Voxeland should write an error in the console about that if it is really so.

    Do you mean issue #61? If so I don't see how it is related. Is there any way to reproduce this bug?
     
  10. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    573
    Don't know how to reproduce, it just showed up and I don't know if it's related.. I do have caves below the terrain that I sculpted but no floating bits.. Overall I didn't install/update anything or make changes to Unity itself.
    The error is not issue #61 but rather the error is
    NullReferenceException: No colliderIndexToCoord defined
    Voxeland5.Chunk.GetTriIndexByCoord (CoordDir coord) (at Assets/Voxeland/Main/Chunk.cs:61) I posted the exact error above.

    Also getting this one:
    ArgumentException: Getting control 2's position in a group with only 2 controls when doing Repaint
    Aborting
     
    Last edited: Sep 6, 2018
  11. JanTuts

    JanTuts

    Joined:
    Dec 19, 2012
    Posts:
    7
    Haha, yeah, I expected as much... :p
    But thanks, I'll try to use some third party obj exporter tool then. I'd really just need the meshes, so losing the vertex colouring isn't an issue for me. :)

    Aha! Good to know, I'll keep an eye on it. Thanks! :D
     
  12. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    573
    @Wright I looked up that chunk.cs:61 error and it brought me back to a post I made with the same error and a fix and suggestion you had said "I've got to limit the maximum brush size to the collider distance - chunk size.
    Increasing the collider distance might help." Page 38
    This might also help you know what might cause the error, something to do with the camera and highlighter and maybe something else:


    Update: I loaded an older Scene and it loaded Voxeland without Glitches. Somehow Voxeland got corrupted it seems. I recommend to others that they have a backup of just Voxeland with all their settings in a scene file with ideal settings they would not have to update. I also manually save the Voxeland data (with backups of major changes) and not rely on saving to scene option. I'm a bit concerned that saving to scene may have effected Voxeland itself because other than adding a component, layer or tag it would be the only thing that directly influences Voxeland in the Scene.

    I am still getting the error but no glitch so far.
    NullReferenceException: No colliderIndexToCoord defined
    Voxeland5.Chunk.GetTriIndexByCoord (CoordDir coord) (at Assets/Voxeland/Main/Chunk.cs:61)
     
    Last edited: Sep 8, 2018
  13. ChillyMcChill

    ChillyMcChill

    Joined:
    Nov 17, 2016
    Posts:
    57
    Has anyone found a solution for floating trees and objects?
     
  14. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,618
    Ascensi, try creating new scene with new Voxeland object and assigning the voxel data saved from the corrupted scene. Could you remember what were you doing before the issue occurred?

    Could you post a screenshot? I can hardly remember what was it about.
     
  15. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    724
    Hi Wright,

    is it possible to export an area or cubic part as an mesh or obj with texture and UV maps?
    We want to use RenderInstanceIndirect on several same landscape meshes.

    Thank you.
     
  16. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,618
    You can save all of the object's child meshes with the script like that:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3.  
    4. public static class SaveAssetClass
    5. {
    6.     [MenuItem ("Edit/Save Asset/Child Meshes")]
    7.     static void SaveChildMeshes ()
    8.     {
    9.         MeshFilter[] filters = Selection.activeGameObject.GetComponentsInChildren<MeshFilter>();
    10.  
    11.         string savePath = UnityEditor.EditorUtility.SaveFolderPanel(
    12.             "Save Child Meshes as Unity Asset",
    13.             "Assets",
    14.             "Asset");
    15.  
    16.         if (savePath!=null && savePath.Length!=0)
    17.         {
    18.             savePath = savePath.Replace(Application.dataPath, "Assets");
    19.  
    20.             for (int i=0; i<filters.Length; i++)
    21.             {
    22.                 Mesh mesh = filters[i].sharedMesh;
    23.                 if (mesh == null) continue;
    24.  
    25.                 UnityEditor.AssetDatabase.CreateAsset(mesh, savePath + "/" + i.ToString() + ".asset");
    26.                 UnityEditor.AssetDatabase.SaveAssets();
    27.             }
    28.         }
    29.     }
    30. }
    Select the Voxeland object and run the script from Edit - Save Asset - Child Meshes menu.
     

    Attached Files:

    Ascensi and Quatum1000 like this.
  17. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    724
    Cool, thank you!
     
  18. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    573
    Not sure what caused it but I decided to delete the library folder then use a backup saved in another scene but I also updated Megasplat and things seemed perfect although the glitches has stopped if I navigated fast in the editor I'd always get error messages about it not being balanced and popping.. (will get the exact error message later) but also along with it I got that error for Chunk.cs:61

    Things are going well enough for now but i will likely add a fresh Voxeland script later to see the difference.

    But I wonder now that Unity 2018.3 is out will this work with Voxeland? It's apparently faster and Vegetation Studio Pro beta needs it to be fast and has mesh terrain support. Prior versions (2018.2) were troublesome to set up.

    Lastly I keep getting non critical messages about Voxeland not having normals.. is this because Unity doesn't recognize the normals in a texture array or would the texture array need to be rebuilt or is this something else? thank you.
     
  19. nrodemund

    nrodemund

    Joined:
    Sep 15, 2018
    Posts:
    14
    Hi, I consider using a voxel terrain engine for my next project. This project seems to fit most conditions, but:

    * Is this project still active? Demo/Testversion etc. offline. Same to MapMagic.
    * I expect MapMagic to be capable to generate from a different origin point (i.e. when player spawns some kilometers away from 0,0), but VoxelLand seems to save the *whole* map changes into one byte array, not chunk by chunk. As I cannot try it out (Evaluation offline), is this an issue in larger maps (memory, ...)? (Or did I understand it wrong and Voxelland saves area by area?)
    * and same question like Ascensi, compatible with 2018.2 and 2018.3?

    Thanks for your help!
     
  20. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,618
    Guess it's a standard Unity warning about normal-map material have no normal map assigned. It could be rather annoying but actually does not mean an issue. If it's not that warning - could you please paste it here?

    Is 2018.3 out? I can see only 2018.2.8 as the latest released version. Voxeland worked fine with 2018.3 beta (but I must admit it wasn't the fresh one), so I don't expect any problem here, but I've got to test it with 2018.3 after release just to be sure.
    Voxeland is compatible with Unity 2018.2

    Non-generated area is encoded in just a dozen of bytes in the array, so think of it like a per-area save.

    Yes, both assets are still alive. It's just my site host goes offline for too often recently. I'm going to move the the other one soon.
     
  21. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,508
    @Wright : I'm thinking of purchasing this asset.
    But I have a question.

    Is it possible to save just the mesh with my texture information so I can just use the mesh for it instead?
    My game doesn't need any realtime deformations, etc.

    Like would a standard Unity FBX Exporter work you think?
    I just don't need all the voxel details after I design it, I could just use a mesh to remove the unnecessary calculations for things.

    Unless this is very performant for large (at least 1,500 x 1,500 meter Minimum) maps sizes.
    Or if it's it's possible to break the map down into multiple voxel terrains and stay performant.

    Thanks,
    David.
     
  22. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,508
    Just went ahead and got it. So nevertheless I got it now lol. It was just too tempting to just sit here and wait for an answer.. I'm sure no matter what way it's put, anything is possible. It's just a matter of figuring it out. If anything I export a mesh and just make a vertex color shader and done lol.
     
  23. megmaltese

    megmaltese

    Joined:
    Mar 19, 2009
    Posts:
    2,153
    Hi, I'm interested in this product maybe, so I have some questions.

    1.
    I read in the docs this "Grass Blocks: a separate data for the grass types. Similar to the land blocks data, except that it is a 2D “array” instead of 3D. It is spread in X and Z axis. Each byte determines the grass type at the current position."
    This means that if I have a terrain with a "top" part painted with grass, and an underlying cavity, that cavity will have the same grass painting at that X,Y position on ground and ceiling, right?
    In this case, I don't think it's very good... may I ask why you choose this format instead than keep it linked with the 3D structure? I guess for performance reasons?
    However, this is not a major issue for me.

    2.
    I need a solution for a racing game. The usual problem with voxel terrains is in chunks management: when generating chunks or LODs, the framerate takes a hit. While this is ok for most games, it is unacceptable for a racing game, which has to keep a constant and flowing framerate so to not disturb the high speed driving in game.
    Now, from the demo it seems that your solution is not affect by this problem, or maybe it loses 1 frame or 2 sometimes, it's acceptable.
    But I've seen that the chunk generation flashes empty space for 1 frame or 2 at the seams (I suppose). Is there a way to avoid this? Because while running at 100 Km/h, the player would constantly see flashing ground under his nose, it's not ok. Maybe overlapping the 2 LOD meshes for one frame or two before removing the "old" LOD is a solution?

    3.
    I see there's plenty elasticity about LOD management and collision generation.
    My question is, as I am building a multiplayer game, will collision generation work ok server side?
    In case some work is needed to make it work server side, how much work must be done?

    4.
    I don't need ultra detailed terrain:
    1 unit voxel would be great, 2 units voxel would be good, and even 3 units voxel would be acceptable, but I need a long view range, like 8000 units or so.
    I don't need infinite terrains, but quite large ones. From a minimum of 8000 units size to a maximum of, say, 40000 units, even though I could stop at 20000 units, but it would be a bit restraining.
    Do you think this can be achieved with Voxeland?

    5.
    I tried the demo, and I think there is some problem with the LOD management/culling.
    Patches stay cleared for long time and they don't get updated if the camera doesn't move, sign that the frustum calculation is not correct. See attachment, empty patches (2 of them in different times) show up on the bottom left part of the screen (cyan color).

    I'll be trying the evaluation version now, I'll see what I can do with it :)
    Edit: ummm seems that not much can be done with the evaluation tool... can't change settings (needed to see how smooth the thing could go with productivity settings), and can't even see actual 3D terrains because it's entered MapMagic mode. Useless. I'll wait some answers I guess.
     

    Attached Files:

    • v.zip
      File size:
      1.6 MB
      Views:
      29
    Last edited: Sep 22, 2018
  24. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,508
    @Wright : Does this package not contain the ability to use a Roughness map as an alpha for an Albedo?
    I had to turn my alpha channel off because the terrain was black.
     
  25. hongtm

    hongtm

    Joined:
    May 22, 2018
    Posts:
    18
    Hello,
    Do voxeland tool support VR and CTS?
     
  26. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,618
    You can export meshes to obj (will loose color information) of fbx using the third-party exporters, but if the performance is the only reason to do so it is a needless action - Voxeland meshes work no slower than other models while they are not changing. You can make a static Voxeland object and disable the Voxeland component once you're happy with the terrain made to remove any overhead (like lod switching) completely.

    This way you'll have to keep the same voxel data for the grass, so the data amount will be doubled. And there's no way of editing such a 3D grass - imagine you've digged a hole under the grass bush - will the grass float in air? Or will it be removed - but then all blocks edited will be left of grass...

    All of the chunk calculation is done in a separate threads, it's only the new mesh assigning that uses the main thread. However the chunk should not flash. BTW what demo were you using - evaluation version or the project build?

    Do you mean generating a collider mesh should be done by the server? The main problem I see here is transferring to generated meshes to clients - and they are not that small. Unfortunately it's out of the scope of Voxeland as a terrain engine, but I'm just curious why do you have to generate collision on the server side?

    There's no technical difference between the terrain of 40000 units (1600 square km, 10 times larger than the Witcher 3) and the infinite one - you can't keep it all loaded at once, and will have to generate voxel chunks on-the-go. Voxeland can do it, so I don't think it will be a problem. Next thing to mention is the view range, it's limited to 2K units with the horizon mesh, but since you don't need a high voxel density you can scale up the Voxeland object twice. This way you will get 2 units per voxel, faster generate speed and 4K view range. It's quite a lot, I'm afraid 8K range would be a problem because of Z-fighting and other floating precision issues.

    So it was a project build. It seems to be a horizon mesh issue, I'll take a look at it, thanks! Do you have the same problem in the evaluation version?

    Voxeland's shader uses the alpha channel to store the heightmap for the height blending, i.e. the higher texture elements will "appear" first:

    I didn't know that turning off an alpha channel could help. It uses gray:128 value as a midpoint. I guess the most reliable way to ignore this effect is to fill alpha with gray.

    There are users that made VR applications with Voxeland. CTS isn't supported, but you can use RTP or MegaSplat instead.
     
  27. megmaltese

    megmaltese

    Joined:
    Mar 19, 2009
    Posts:
    2,153
    Sorry, I wasn't clear here. I just ask if it will be working correctly in a multiplayer game. Of course there's no need to have the terrain generated and sent by the server. Also, it would never work real time.


    Again, maybe I wasn't clear. If you lower the resolution, you can increase the distance.
    So if I have reasonable performance with 1 voxel per 1 unit and reach 1000 units distance, I can have the same performance with 1 voxel per 2 units and 4000 units distance (it's not a square, it's a cube, so for each halving of resolution, there should theoretically be a 4 folds increase in performance and memory used remain the same), and with 1 voxel per 4 units I may extend the view to 16000 units.
    Now, I don't need 16000 units view, but 4000 yes. And it would be great to have the whole terrain in memory, and for that I need 16000 x 16000 x 2000.


    Perfect I'd say. Seems the problem here is only memory. Could you try a test of such a situation?
    16000 x 16000 x 2000 with voxels set at 2 or 4 units.


    No, the evaluation seemed to run fine, so that I thought the project build was an old one probably.
     
  28. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,508
    @Wright : Thanks for the response. But the whole alpha thing I noticed what it was for. What I meant to ask was, is there a way to get roughness maps to work with this package in general? Like, would it be as simple as adjusting some of the shader code to relfect the roughness map, or is this designed in such a way that a roughness texture just wouldn't work.. I'll try to attempt it my self, but, would like to use just pretty much - standard shader type of material so I can do my PBR :p

    Also, one thing I did notice, not sure what is causing it. But at times I noticed like tiny black artifacts. Look like a bunch of tiny black squares.

    But on that note, regardless, I really do love this package! And actually believe it or not, it is very performance friendly for me :) I thought before buying it that it was going to be extremely intensive. Nope, at least not for my PC it isn't lol.
     
  29. Ziron999

    Ziron999

    Joined:
    Jan 22, 2014
    Posts:
    238
    does this have a save/load system built in for this part? because i don't see how you could possibly keep track of this data without serious issues unless it's already built into this system you created.
     
  30. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    975
    @Wright, you may recall that I contacted this forum some weeks ago about being unable to update to Unity 2018, because my Voxeland static object wouldn't migrate to the newer versions of Voxeland that compile correctly on Unity 2018. We worked on the problem but didn't find a solution, and it seemed I might have a corrupted file.

    I'm happy to report that I solved this over the weekend, using a script I wrote based on example code in the Voxeland user guide. I'm reporting my steps here in case someone else has the same problem.
    1. Before doing any of the following MAKE A FULL BACKUP of your project!
    2. In the project with the problematic Voxeland model, create the script I'm sharing below (or your variant thereof). This is not exactly the code from Denis' user guide, but it was based on that code. This script must be in a folder called "Editor" at some level of your project tree, and I don't recommend putting it inside the Voxeland folder tree.
    3. The script adds two menu options, "Voxeland Export" and "Voxeland Import", to the right-mouse menu under the GameObject hierarchy. Select your Voxeland object and use the Voxeland Export option. A text file (actually raw binary data) should appear at the "Assets" level of your project. You may have to refresh the view to see it. Verify that it exists and has a reasonable size (mine was about 4 megabytes, YMMV).
    4. Take careful note (screen shots, maybe?) of the Land Block textures you were using on your Voxeland object, and any other settings that you care about replicating.
    5. Delete your Voxeland model from the scene.
    6. Delete the Voxeland software folders and examples from your project hierarchy.
    7. Import the latest version of Voxeland.
    8. Create an empty Voxeland Static object in the scene.
    9. Assign your Land Block textures and set their properties.
    10. Select your randomly-generated Voxeland Static object in the Hierarchy, and use the "Voxeland Import" menu item. Your Voxeland geometry should reappear, replacing the random terrain.
    11. Adjust other settings as needed.
    Warnings:
    • My little code snippet, being written for my own one-time use, assumes only one Voxeland object and only one scene. It hardwires the data file path and name since it assumes there will be only one. If your situation is more complicated, you'll need to either prompt for a filename or manually move aside each export as you create it.
    • I needed to do this exactly one time. It worked. I'm done. I did not make any attempt to generalize the code and haven't tested it (nor do I intend to do so) in any scene but my own. Use at your own risk.
    Here's the code, again based on @Wright's published example (and with snips of the example code included, with permission:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEditor;
    5. using Voxeland5;
    6.  
    7. [ExecuteInEditMode]
    8. public class VoxelandSaveLoadLocal : ScriptableObject {
    9.  
    10.         const string filepath = "Assets\\SavedVoxelandData.txt";
    11.  
    12.         [MenuItem("GameObject/Voxeland Export", false, 45)]
    13.         static void VoxelandSave(MenuCommand command) {
    14.                 GameObject selection = Selection.activeGameObject;
    15.                 if (selection != null) {
    16.                         Voxeland voxeland = selection.GetComponent<Voxeland>();
    17.                         if (voxeland != null) {
    18.                                 Save(voxeland);
    19.                         } else {
    20.                                 Debug.Log("Must select a GameObject with a Voxeland component");
    21.                         }
    22.                 }
    23.         }
    24.  
    25.         [MenuItem("GameObject/Voxeland Import", false, 45)]
    26.         static void VoxelandLoad(MenuCommand command) {
    27.                 GameObject selection = Selection.activeGameObject;
    28.                 if (selection != null) {
    29.                         Voxeland voxeland = selection.GetComponent<Voxeland>();
    30.                         if (voxeland != null) {
    31.                                 Load(voxeland);
    32.                         } else {
    33.                                 Debug.Log("Must select a GameObject with a Voxeland component");
    34.                         }
    35.                 }
    36.         }
    37.  
    38.         public static void Save (Voxeland5.Voxeland voxeland)
    39.         {
    40.             byte[] byteArray = voxeland.data.ToByteArray();
    41.             System.IO.File.WriteAllBytes("Assets\\SavedVoxelandData.txt", byteArray);
    42.         }
    43.  
    44.         public static void Load (Voxeland5.Voxeland voxeland)
    45.         {
    46.             byte[] byteArray = System.IO.File.ReadAllBytes("Assets\\SavedVoxelandData.txt");
    47.             voxeland.data.FromByteArray(byteArray);
    48.             voxeland.Rebuild(); //optionally, to make the loaded data be displayed
    49.         }
    50. }
     
    Last edited: Sep 27, 2018
  31. superkratos

    superkratos

    Joined:
    Sep 4, 2017
    Posts:
    86
    Hi, Wright. I've been watching this forum for a long time and I like this "Voxeland" way of creation terrain a lot. But practically I think the "Voxelump" idea you mentioned previously could be of great usage in our undergoing project:). So do you mind letting us know more about your progress of "Voxelump" and your plan to release it?
     
    syscrusher likes this.
  32. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,618
    Yes, Voxeland works at 8000 or even 16000 units from origin in infinite mode, and it works being upscaled twice too. And you don't need that much memory for that - about 1 Gb according to my calculations

    How simple it will be depends on how experienced you are in shaders. This is theoretically possible, and I don't see a problem in changing alpha to smoothness map in shader, but I haven't tried it.

    You can serialize voxel data with all the changes to byte array - and then save this array using your game save serialization system.

    syscrusher, thanks for the code! Feel free to include the the parts from the manual (right now it's not yet clear what do you mean under Save and Load. Are these the methods from serialize link above?)
    BTW you don't need to derive from MonoBehavior as far as I can tell.

    It will be the first thing will do right after MM2. I can't wait to start it, but MM users have been waiting for this update for almost a year.
     
    Last edited: Sep 27, 2018
    megmaltese likes this.
  33. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,508
    @Wright : I'm not too bad in Shaders. I just wasn't sure if there was all sorts of various other systems in play that will break if I go changing things lol. But mainly, I wasn't sure if the Voxel system was too demanding performance wise,as the reason it never got a PBR Update for it.

    I'll give it a go soon. If I get it, I'll send you my updated stuff so you can test it, and if it's within your satisfaction, put it in an update so others have a choice between the old shading and new.

    Thanks mate.
     
  34. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    975
    Code updated, and thanks for permitting your sample code to be included for clarity. I was hoping that would be okay, but did not feel I had the right to assume so. :) I also tested, and it can be (and now is) derived from ScriptableObject instead of MonoBehaviour.
     
  35. superkratos

    superkratos

    Joined:
    Sep 4, 2017
    Posts:
    86
    Hi, Wright. Looking forward to you Voxelump and thanks for your response:).
    Now I'm testing to create some local area where traditional terrain way could not achieve because of it's lack of modeling flexibility, and I want to blend it with traditional terrain with MicroSplat. I'm not sure this is the correct way and maybe I could use your suggestions:D.
    Besides performance issue which we haven't tested, the first problem I've got is an error trying to bake occluder data which says "Invalid scene( possibly too large bounds)". But I just created a 90*90 Voxeland with 9 blocks, which I think should be small enough. So do you have any experience or suggestion about this issue?
    The second question is that I can't see a tansform gizmo of Voxeland right now, so I can't move or scale it. Because of internet limitation, my testing computer can not update Voxeland to the latest version, but I believe it should be version 5.3.1. Is this a version problem?
     
  36. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,618
    I mean - you can use a non-derived static class :)

    I'm not aware of those issue, so I doubt that updating will help. Try disabling horizon mesh - if it's used - it's really a huge mesh that can cause this problem. Disabling will help to find out if the problem is in the horizon, but even it is it's still could be used after changing it's static flags.

    This happens because Voxeland uses the brush gizmo instead of the standard one. Roll-up the Voxeland script in inspector to enable them.
     
  37. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    975
    I had a similar issue in Unity 2017. I didn't think to do what @Wright suggested and disable horizon mesh (I don't think it is enabled anyway, but I'll check). Originally, I solved the issue by defining occlusion volumes after consulting the Unity documentation on the error message. But now that my scene is updated to Unity 2018.2, I am able to bake the entire scene without the occlusion volumes. So I am tentatively thinking the folks at Unity have enhanced the baking tool to support larger data. Don't take that as gospel, because there were so many other changes in my scene during the update that I can't absolutely be sure something else didn't also impact it.
     
  38. Coltenney

    Coltenney

    Joined:
    Mar 10, 2015
    Posts:
    21
    Hi there, I'm just wondering if there's anything I can do to place a voxel at an arbitrary coordinate? I want to raycast to an object and use the hit point as the coordinates for a voxel. Is there already a method for this or do I need to make a new version of Alter()?
     
  39. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,618
    You can do this with the current Alter version:
    Code (CSharp):
    1. voxeland.Alter(new CoordDir(x,y,z), voxeland.brush, Voxeland.EditMode.replace, 0, -1, -1);
     
  40. Xype

    Xype

    Joined:
    Apr 10, 2017
    Posts:
    339
    @Wright I told you about the tangentmode thing in January, someone else mentioned it in July, in Jan on 2017 it was depricated, in 2018.2 it is obsolete, nothing was ever touched with it?

    Assets/Voxeland/Tools/CustomSerialization.cs(261,167): warning CS0618: `UnityEngine.Keyframe.tangentMode' is obsolete: `Use AnimationUtility.SetLeftTangentMode, AnimationUtility.SetRightTangentMode, AnimationUtility.GetLeftTangentMode or AnimationUtility.GetRightTangentMode instead.'

    Assets/Voxeland/Tools/CustomSerialization.cs(476,9): warning CS0618: `UnityEngine.Keyframe.tangentMode' is obsolete: `Use AnimationUtility.SetLeftTangentMode, AnimationUtility.SetRightTangentMode, AnimationUtility.GetLeftTangentMode or AnimationUtility.GetRightTangentMode instead.'
     
  41. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,508
    @Wright : Is there a way to flatten an area? Not smooth, but flatten as in level like you can with the Unity Terrain tool. Shift click the height you like, then click and it raises the surface to that height.
     
  42. JLO

    JLO

    Joined:
    Nov 11, 2012
    Posts:
    41
    @Wright I also think a flattening tool is much needed. Smoothing out an area to make it flat doesn't always work that well.
     
  43. hongtm

    hongtm

    Joined:
    May 22, 2018
    Posts:
    18
    Hello
    I just bought your access, It had 2 errors:
    Assets\Voxeland\Tools\Extensions\TextureArrayExtensions.cs(31,66): error CS1503: Argument 3: cannot convert from 'UnityEngine.TextureCompressionQuality' to 'int'
    Assets\Voxeland\Tools\Extensions\TextureArrayExtensions.cs(117,66): error CS1503: Argument 3: cannot convert from 'UnityEngine.TextureCompressionQuality' to 'int'
     
  44. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    975
    @Wright, while we are on the subject of feature requests, I have one that I think would be pretty simple. Would you consider making that byte array import/export a standard feature of the asset? What I have in mind is something similar to what I posted (based, of course, on your API example) but with an actual UI around it to prompt for a filename and folder, probably defaulting to the name of the Unity GameObject from the hierarchy.

    This feature would be useful in cloning voxel objects from one project to another, for making backups that are outside the asset itself (since a lot of work can go into carefully crafting a voxel object), and for easily making a backup/restore point for those times when a designer wants to experiment with a new terrain layout but be able to easily revert if they don't like their new idea.
     
  45. ibbybn

    ibbybn

    Joined:
    Jan 6, 2017
    Posts:
    133
    Has anyone found a way of using megasplat clusters with voxeland? When selecting the main voxeland gameobject and selecting an array in vertrex painter pro i get a Fatal Error Popup: GetManagerFromContext: pointer to object of manager 'RenderSettings' is NULL (table index 24) in Unity 2018.2.3f1

    Regardless of megasplat I think being able to select multiple landblocks and blending them with tweakable noise pattern would be very helpful. New owner here though, is there something similar already in voxeland?
     
  46. JLO

    JLO

    Joined:
    Nov 11, 2012
    Posts:
    41
    @Wright Did you ever find a fix for the "Texture Array Inspector" not working when Amplify Shader is installed?
     
  47. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,618
    Strangely, everything seems to be working in Unity 2018.2.0f2. It still gives a warning, but the scripts are compiled. And in 2018.3b too. Anyways I admit it's no good.
    I'm going to get rid of all these warnings this weekend, including this one.

    When using 2D (or 2.5D) terrain such a leveling tool is rather easy to implement - all of the edited pixels are within the brush range. But it becomes more complicated when using voxels - imagine a brush 5*5 voxels used to flatten land at the height of 10 - you will need to change the voxels that are outside the brush, lower or higher. I can't say it could not be done, but this will require changing a bit of core things, so don't expect it soon.

    What is your Unity version?

    I'm thinking of storing data in RAW file instead of the asset one for the further versions, but still there's some research that should be done first like the size of the raw bytes compared to asset, save and load time, etc.
    But I got your point, if I decide to leave .asset I'll think what I can do to export data as raw bytes.

    Unfortunately you can't paint voxeland blocks with MegaSplat or third-party vertex painter, it does not work this way. Voxeland land blocks with different channels and textures should be used instead.

    Still didn't get my hands on AS, but it could be an interference that could be easily fixed. If you could provide some detail on the issue like what exactly happens and is there any console error I could try to find out what is the problem and fix it this weekend.
     
  48. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    975
    (nod) For me, the point of this is to be able to extract the geometry and texture index (that's probably the wrong term) for each voxel into some sort of external format that is likely to survive Voxeland version updates and is documented in case someone wants to use Voxeland to feed some sort of downstream custom tooling.

    With the problems I had upgrading my scene, I had actually prepared myself for the possibility of deleting the Voxeland objects entirely, upgrading the rest of the scene, then loading the newest version of Voxeland and starting from scratch to remake something close to my landscape. I decided to try your export/import API and my custom code as a last ditch effort, and I was so utterly relieved when the geometry came back into the new scene intact. This capability saved me a lot of work.

    I know you do your best to ensure Voxeland upgrades are smooth, but Stuff Happens in the real world. My corrupted data was probably not your fault at all -- for a short time, I had a problem with some Unity editor crashes unrelated to Voxeland, and that's probably what did it. Having some kind of safety net to protect the work in an external file is a comforting feeling. :)
     
  49. JLO

    JLO

    Joined:
    Nov 11, 2012
    Posts:
    41
    @Wright there are no error messages or warnings. The "Texture Array Inspector" works fine when setting up a clean project with Voxeland installed. Once Amplify Shader is installed the "Texture Array Inspector" defaults back to the regular inspector. No errors or warnings are given.

     
  50. JLO

    JLO

    Joined:
    Nov 11, 2012
    Posts:
    41
    The only error messages I get is after deleting Amplify Shader. Once AS is gone the Texture Array Inspector works great.