Search Unity

Voxeland - Voxel Terrain Tool

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

  1. Wright


    Feb 26, 2013
    BTW MapMagic is on sale too !

    The thing is that Voxeland generates a new chunk, not just loads it. However, generating is done in a separate thread, so it does not affect the performance - only the final stage, setting up the Unity mesh happens in main thread and require some time depending on the chunk complexity. Loading a ready mesh can remove this lag, but the size of the data will be increased significantly - while Voxeland just stores the compressed block data (it's about 4 KB per chunk) SECTR will have store all of the mesh data (about 350 KB per chunk). 1 square kilometer will take about 1.2 GB of meshes only, and 10*10 would be 120 GB. I guess SECTR can handle that, but the question is if you are willing to make the size of your game that big.
  2. EnriquePage91


    Jul 2, 2015

    1) Thank you for the quick reply Dennis! I think it won't be worth it then, as I am not interested in storing the geometry - I want the system to be able to generate it in real-time. I figured perhaps SECTR wouldn't do the trick, so for now I guess I'll put it on hold, check a few things based on your reply and if anything get back at you in a few days.

    2) Yes, I did see that about mapmagic! "Unfortunately" I own it already lol!

    I do have a thing to mention about this (*this has been updated, make sure to check the Edit about it as I believe I was wrong to assume the following*):

    I was about to start building my terrain right now (I have updated Unity ever since I bought the plugin), and I got a missing definition error ("UN_MapMagic"). After updating MapMagic and restarting unity the definition had still not been added. Well, this isn't really the problem, I added it myself after finding the name of the definion symbol that was required. The problem however, is that ever since I updated MapMagic, I am getting two errors concerning "uNature".

    It seems "OutputGenerators.cs" does not take into consideration whether the user has uNature or not. I have added the pertinent #if #elseif #endif statements to take this into consideration however I have still to try and see that everything works as intended (compiling as we speak).

    I can send you the OutputGenerators.cs file that I have modified if this is any use to you, however I would suspect you would know it's really a few lines so maybe this isn't even worth it, as you can probably do it yourself in less time than it'll take to organize an exchange of files.

    So, am I missing something here? or is this just an error? Not a big deal but I figure I'd mention it.

    3) Another "quick" question that I have: can we utilize real-time navmesh baking for infinite terrains? Or what would be your approach, given that I imagine infinite terrains are NOT static? Sorry, I am quite new to navmeshes: I have always simply used raycasts to determine whether movement is possible or not.

    I'm kinda new to utilizing navmeshes and although it is quite simply while in the Editor, I'd like to know your opinion about how to go about NPC movement considering that I am trying to use the Infinite Terrain option of Voxeland.

    I'll gladly also consider Unity Assets if you think there is a good, pertinent solution to this already available.

    Once again, thank you so much for the amazing product and support - I really love MapMagic + Voxeland combo, it's amazing.

    EDIT 1 - (UPDATE about issue 2):

    Well, after compiling the first changes 9 new errors appeared (all similar, simply a matter of properly addressing it with #if #else whatever), however whenever I add a Voxeland Infinite Terrain and change the generator to MapMagic I still get told MapMagic isn't installed or it's scripting define symbol isn't added.

    Am I right to assume the scripting define symbol is "UN_MapMagic"? I am starting to believe I might have messed up as this might have been a scripting define symbol for uNature compatibility WITH MapMagic, which would explain all of my issues.

    Unfortunately, Unity isn't adding the define symbol itself even after restarting, but I have seen in a post from 2017 that you mention the scripting define symbol to be "MAPMAGIC" only.

    I will try this out to see if it works but any feedback to speed up this process would be greatly appreciated!

    EDIT 2 - (UPDATE about issue 2):

    Ok, I have managed to fix the issues by adding MAPMAGIC and VOXELAND to the scripting define symbols - all working as expected! Just make sure NOT to use UN_MapMagic unless you're using uNature, I was wrong to believe this was the define symbol for MapMagic.

    Except for the fact that whenever I generate a terrain, the active chunks (the ones loaded around the camera) DO NOT have materials... Really weird! Every other chunck (the ones on the background, perhaps acting as sort of "Impostors", HAVE the textures that I have added through the Land blocks.

    Some images so you can see the issue:

    01.png 02.png

    Any idea as to what this issue might be?? Thank you in advance!

    EDIT 3 - (UPDATE about issue 2):

    I was using a custom shader that I wrote, this was the issue. Make sure your material is utilizing the provided shader on the default "general material" named as Land (the default material). Otherwise, use either one of the supported custom shaders or write your own and deal with the necessary consequences I guess LOL :p. If anything can still be brought to this topic and Denis has an easy solution perhaps he can let us know how to utilize a custom shader; I've seen his tutorials but I believe none covers how to implement your own material, there are only tuts for the most popular terrain shader solutions (which is fine tbh, at least to begin with).
    Last edited: May 2, 2019
  3. Wright


    Feb 26, 2013

    I have not tested it myself, but here is what users write:
    Try searching for dynamic pathfinding assets that do not require baking, like this. Just a first search result, but it might do the trick.

    Hint: If you switch Mesh Channel Encoding mode to RTP you will get your block types encoded in vertex color channels. Knowing that you can write the shader the way any other mesh shaders are made. Just keep in mind that you will need triplanar mapping since voxel structures are too complex to map them seamlessly.

    I'm glad you could sort out most of the issues in the updates, but is there something I've missed and you still need support on something?
    EnriquePage91 likes this.
  4. AshyB


    Aug 9, 2012
    I'm looking into purchasing a voxel terrain system while the may sale is on. Question, is there a way to remove floating debris? For example, if you dig under and around the tip of a hill.. Does it automatically remove the floating tip or is there a way to remove it? Or does the floating debris fall to the ground?
  5. EnriquePage91


    Jul 2, 2015
    There might be debris depending on the cut applied, however Voxeland does a good job generally cleaning that up automatically. However, you could always probably code this yourself, I'm sure Denis can tell you more about this but since you can modify through code the deformation of the terrain, you could probably come up with a system that detects debris on a radius from where the last terrain edit was performed and check if there are no "disconnected" pieces.

    This would certainly require to check the values of several voxels surrounding the edited voxel everytime there is a terrain modification so perhaps it might be a bit intensive but I'm not sure as I haven't done so myself. I would imagine it would be ok as far as you're not editing tons of voxels at the same time.

    AFAIK, you're not gonna find many Voxel engines that have voxel physics (debris falling to the ground automatically), I believe Voxel Farm supports this but it is very expensive and I believe is subscription based. However, I am not really that sure so you should probably check on both of these things I just said about Voxel Farm. The point is, I did read it once a few years ago and it was quite unreasonable for an indie IMO.

    I believe you could probably fake the physics and have the debris fall to the ground but this if possible would require even more computing than the first solution of simply finding such debris and getting rid of it by turning it's voxel into an "air cube" so to speak. You'd have to probably code something similar and once you isolate the debris, bake it into a mesh and then add a rigidbody to it or handle the gravity yourself. however you'd have to do this dynamically and it doesn't necessarily sound like an easy task unless you're a good programmer, but perhaps I'm entirely wrong.

    I'm sure Denis will give you better feedback once he has the time.
  6. EnriquePage91


    Jul 2, 2015

    Thank you so much for your previous advice! I will look into the options and if anything get back to you once I have any doubts about it.

    I have a few more questions to ask:

    1) Is Vegetation Studio Pro supported by Voxeland? I'm still looking at good asset purchases during the sale and this one looks amazing. UPDATE (EDIT1) : I've bought it already, trying to figure out how to use it with Voxeland AND mapmagic. The tutorial for MapMagic and VS seems to not point out all the necessary steps (since it is meant exclusively for MapMagic). I will try to figure this out for a while and get back at you otherwise!

    2) I'm modifying the terrain at runtime through the method you suggest on the documentation, and have ticked the "edit in Play Mode" bool on the Voxeland script however whenever I exit playmode the changes remain. Am I missing something here? How can I have any control over the saving of such changes? I'd like to only save such changes whenever I decide to, and I do feel like perhaps I am missing something already available.

    3) I've programmed the functionality in (2) in order to grant it to the player but also to utilize it to edit maps in editor mode. I am particularly interested in creating a system that will adjust the terrain underneath the prefabs I spawn (or perhaps also place manually) in order to avoid any penetration. Any advice on how to handle this would be very appreciated as unfortunately there's not much in the documentation about this. I would imagine this will be similar to the approach I described above for AshyB, so I guess any clarification as to how to go about stuff like this would be very useful for many other people.

    4) I've collected both Voxeland and MapMagic on an Assembly, since from what I understand this helps in compile time. Once coding my own things, I've come up with the problem that both of the Extensions classes (for MapMagic and Voxeland) include the same method:


    There are conflicts when trying to access such static function to get an instance of the Voxeland script if both namespaces are being used (MapMagic and Voxeland5). I imagine there is a way to specify on the script that I want to use Voxeland's extension class when utilizing this function, could you please tell me how to do this ?

    For the moment I've had to modify Voxeland's Extensions.cs to have the same function twice but have one be called AnyVoxeland(). This works but is rather undesired as I'd like to be able to update your packages whenever there are any updates available without having to pay attention to which files I've modified myself.

    I'm having a lot of fun playing around with Voxeland and MapMagic! It would definitely be great to have a little more info as to how to do a little more coding and how to deal with the grass and objects when utilizing voxeland and mapmagic, but other than that I am pretty pleased with what I've seen and feel like both packages are worth rating 5 stars. I will make sure to do so myself.

    Thank you so much in advance, I know these are a lot of questions! Hopefully they will help other people out too.
    Last edited: May 9, 2019
  7. valentinwinkelmann


    Nov 3, 2014
    I Just import MapMagic and then import Voxeland. after that i activate Voxeland5 in the Compatiblity settings. Now i get 3 Errors:

    Assets\MapMagic\Main\Preview.cs(72,40): error CS1061: 'Voxeland' does not contain a definition for 'Transforms' and no accessible extension method 'Transforms' accepting a first argument of type 'Voxeland' could be found (are you missing a using directive or an assembly reference?)
    Assets\MapMagic\Main\GeneratorsAsset.cs(703,18): error CS0266: Cannot implicitly convert type 'Voxeland5.Voxeland' to 'MapMagic.IMapMagic'. An explicit conversion exists (are you missing a cast?)
    Assets\MapMagic\Main\GeneratorsAsset.cs(744,72): error CS1061: 'Generator' does not contain a definition for 'mapMagicGens' and no accessible extension method 'mapMagicGens' accepting a first argument of type 'Generator' could be found (are you missing a using directive or an assembly reference?)

    how can i fix it?

    Oh i just have to enable also "MapMagic" in the compatiblity settings
    Last edited: May 7, 2019
    EnriquePage91 likes this.
  8. mlewy


    Mar 16, 2015
    Hey I am following this tutorial but it seems out of date are there any other basic video tutoirals, I cant seem how to add grass.
  9. valentinwinkelmann


    Nov 3, 2014
    Two things that urgently need to be improved. first:
    The different renderpipelines should be supported, especially the LWRP.

    also the generation should work with a little less noise. no matter how smooth i set the MapMagic noise in the generator. there are always "spots" in the terrain. when i use the smoothBursh manualy it gets a lot more smoother. so it's not the voxeland terrain but the generation.
    camta005 likes this.
  10. EnriquePage91


    Jul 2, 2015
    Hey keep looking through this thread precisely for what you've brought up as point two and you will find a solution.

    Someone already posted a generator which does not generate such holes (He even offers it for free on his post so you can simply download and plug it in). Denis has also seen this and offered an alternative solution. I haven't tried any but from what I remember the user who did such alteration did a great job of giving us the control of whether a surface should have such imperfections or not, so it seemed like a pretty viable generator to grab.

    I can't remember exactly how I found it, but I know it's somewhere around in these 47 pages. Just use google and search on this forum particularly.

    Good luck.
  11. Andrew203


    Apr 23, 2018
    Hey anyone could tell me if Voxeland is any good on Android/Ios in terms of performance?
  12. Wright


    Feb 26, 2013
    Voxeland does not treat floating islands in a special way - they are nor removed, neither fall to the ground. It's not the collision or physics simulation problem - the thing is it's very hard to find out what blocks exactly are floating and do they have any connection with the ground. But the main issue is that if the floating blocks would be treated in any way it doesn't guarantee that the unnatural formations could be created - imagine big island on a on-block stem or even a "bridge" to the island from the side. Formally, it still won't be a floating island, but it looks weird. To solve this there should be complex strength of materials calculations, maybe more complicated than Voxeland itself.

    No, it's MapMagic that is compatible with VS Pro, it doesn't make Voxeland compatible with it automatically. The thing is Voxeland uses the MapMagic as a generating tool, while it remains the core Voxeland in other aspects.

    That's an expected behavior when using an asset data. If you change a material, a prefab, a terrain data or any other asset in playmode it won't be reverted to it's original state when leaving the playmode.
    But if you don't save the data to the asset file all of the changes will be stored in scene. However it's more of a side effect and I can't guarantee it will always work this way.

    Oddly enough since Voxeland and MapMagic actually are in the same assembly by the default (I mean Assembly-CSharp). You can try not using Any, replace it with LINQ or just pick the first object from HasSet's foreach loop.

    I've got LWRP graph shader somewhere. Just 4 channels and primitive blending, but it's LWRP after all. Will try to find it on Monday.

    Seems to be it

    Depends on the performance of your target devices. You can try the evaluation version to see if it will fit.
    EnriquePage91 likes this.
  13. EnriquePage91


    Jul 2, 2015

    Thanks Denis!

    1) If I utilize an asset to save the data asset before runtime then, I should be able to restore it to such values on OnDisable or something like that then, am I correct? I am in fact storing the data on a Scriptable Object Asset, so it's not being saved to the scene. I am also familiar with Scriptable Objects keeping their changes when altered at runtime, however I do think it would be ideal to find a way to have changes only be saved when requested, this is after all a very important feature for a Voxel terrain system.

    2) I have been in touch with Lennart, the dev behind VSPro and he has suggested that I utilize the Raycast Terrain system on his package. I am going to explore this and will get back at you if I have any issues I could use your help on. For now, if you're familiar at all with this process (which seems to already have been integrated by a Voxeland user), I would really appreciate it.

    3) Unfortunately I need Voxeland and MapMagic to be on their specific assembly, as I am writing scripts to interact with their systems and my code belongs in an assembly of itself. I'd rather not include the Assembly-CSharp on my own assembly, since I believe this would increase compile time substantially whenever I make changes to my library. Am I correct? Perhaps this isn't as relevant as I believe. For the moment, the solution of AnyVoxeland works, however yes it would be ideal to get rid of this modification. I will also try the solutions you provided to see what can be done.

    3.1) By the way, even though I have deactivated the grass system on Voxeland/MapMagic, I am getting "Grass" objects appearing out of nowhere in my hierarchy (I do have a VS Pro Object node that intends to export the grass from my MapMagic graph, could this be the case?) These objects are not being destroyed either and they appear as child of the chunks of Voxeland. I am putting this as (3.1) because the grass objects have their Mesh Renderer deactivated and their material isn't configured (empty texture slots). I am being told by the compiler that the shader cannot find its namespace (probably because I created the Assembly containing both packages). I am no expert on shaders so I am not sure what to modify to avoid this, but the warning is:

    "Could not create a custom UI for the shader "Voxeland/Grass". The shader has the following: "Custom Editor = VoxelandMaterialInspector". Does the custom editor specified include its namespace? And does the class either derive from ShaderGUI or MaterialEditor?"

    3.1 UPDATE: I tried removing the VSPro Object nodes from the graph, there's no VSPro Map nodes either, but the grass objects are still being generated (they utilize the Voxeland Grass shader which is having problems, as described above). I do believe this started happening when I installed VSPro though, could Voxeland be somehow requesting vegetation to be built by VSPro after trying to utilize it in conjunction with MapMagic? It seems a bit weird it would utilize the Voxeland Grass shader though, I'm not entirely sure what happened there.

    Thank you so much in advance for any feedback you might be able to offer, have a wonderful day!
    Last edited: May 11, 2019
  14. Wright


    Feb 26, 2013
    This is the way Unity works, and, unfortunately, I'm not going to change that. All of the changes to materials, prefabs and other assets persist no matter if they were made in playmode or not. When you change the standard Unity terrain all of the changes remain when you leave the playmode, and Voxeland behaves the same (unless it stores the data in scene).

    Unfortunately can't help you with that, I haven't looked into VSPro raycast system.

    You don't have to use Any or AnyVoxeland if you don't like to. Just disregard those methods, use LINQ or foreach and and you won't have to change the Voxeland code.

    These objects are the special objects to store the grass. They are empty if the grass is not used, but they have to be created anyways.

    You can change the grass material shader if you have problems with it (Materials panel - Grass).
  15. Inicus-Qvist


    Mar 12, 2015
    Low Poly Achieved:
    Desktop Screenshot 2018.12.08 -
    Desktop Screenshot 2018.12.08 -

    It was a matter of finding in the code where the vertices are created and making sure that, instead of re-using vertices for adjacent tris (which produces a smooth edge), it creates a unique set of verts for each tri (creating the hard edge, low poly look). The way I did it is not 100% efficient because I think it is re-doing work at the end of the process and this is the kind of thing that should ideally be done upfront when the mesh is being calculated in the first place, to prevent re-doing the same or similar work. But it gets the job done. Just go to "MeshData.cs", usually found in "Assets/uTerrains/Sources/Code", go to the "ToMesh" function, and replace it with this (or make equivalent changes):

    Code (CSharp):
    1. internal void ToMesh(ref Mesh mesh, out int materialsMask, Bounds bounds)
    2.         {
    3.             if (!isReadyForToMesh) {
    4.                 UDebug.LogError("MeshData is no ready for ToMesh conversion");
    5.             }
    7.             materialsMask = 0;
    8.             if (mesh != null) {
    9.                 mesh.Clear();
    10.             }
    12.             if (newVertices.Count == 0) {
    13.                 return;
    14.             }
    16.             if (mesh == null) {
    17.                 mesh = ChunkObjectPool.MeshPool.Get();
    18.                 mesh.MarkDynamic();
    19.             }
    21.             //Separate Faces for Low-Poly Effect
    22.             bool hardEdges = true;
    23.             if (hardEdges)
    24.             {
    25.                 List<int>[] tempIndices = new List<int>[0];
    26.                 tempIndices = Indices;
    27.                 List<Vector3> tempNewVerts = new List<Vector3>();
    28.                 List<Color32> tempNewCol = new List<Color32>();
    29.                 List<Vector3> tempNewNorm = new List<Vector3>();
    30.                 List<Vector2> tempNewUVs = new List<Vector2>();
    31.                 List<Vector2> tempNewUV2s = new List<Vector2>();
    32.                 List<Vector2> tempNewUV3s = new List<Vector2>();
    33.                 List<Vector2> tempNewUV4s = new List<Vector2>();
    34.                 List<Vector4> tempNewTangents = new List<Vector4>();
    35.                 for (var sub = 0; sub < SubmeshCount; ++sub)
    36.                 {
    37.                     int msIndex = 0;
    38.                     var ind = GetIndices(sub);
    39.                     var indexCount = ind.Count;
    40.                     List<int> tempInd = new List<int>();
    41.                     //materialsMask |= 1 << i;
    42.                     //mesh.SetTriangles(ind, msIndex++);
    43.                     for (var i = 0; i < indexCount; i += 3)
    44.                     {
    45.                         // get the three vertices that make the triangle
    46.                         var v0 = isReadyForToMesh ? newVertices[ind[i + 0]] : Vertices[ind[i + 0]].Vertex;
    47.                         var v1 = isReadyForToMesh ? newVertices[ind[i + 1]] : Vertices[ind[i + 1]].Vertex;
    48.                         var v2 = isReadyForToMesh ? newVertices[ind[i + 2]] : Vertices[ind[i + 2]].Vertex;
    49.                         var c0 = isReadyForToMesh ? newColors[ind[i + 0]] : Vertices[ind[i + 0]].Color;
    50.                         var c1 = isReadyForToMesh ? newColors[ind[i + 1]] : Vertices[ind[i + 1]].Color;
    51.                         var c2 = isReadyForToMesh ? newColors[ind[i + 2]] : Vertices[ind[i + 2]].Color;
    52.                         var n0 = isReadyForToMesh ? newNormals[ind[i + 0]] : Vertices[ind[i + 0]].Normal;
    53.                         var n1 = isReadyForToMesh ? newNormals[ind[i + 1]] : Vertices[ind[i + 1]].Normal;
    54.                         var n2 = isReadyForToMesh ? newNormals[ind[i + 2]] : Vertices[ind[i + 2]].Normal;
    55.                         var uA = isReadyForToMesh ? newUVs[ind[i + 0]] : Vertices[ind[i + 0]].Uv;
    56.                         var uB = isReadyForToMesh ? newUVs[ind[i + 1]] : Vertices[ind[i + 1]].Uv;
    57.                         var uC = isReadyForToMesh ? newUVs[ind[i + 2]] : Vertices[ind[i + 2]].Uv;
    58.                         var u2A = isReadyForToMesh ? newUVs[ind[i + 0]] : Vertices[ind[i + 0]].Uv2;
    59.                         var u2B = isReadyForToMesh ? newUVs[ind[i + 1]] : Vertices[ind[i + 1]].Uv2;
    60.                         var u2C = isReadyForToMesh ? newUVs[ind[i + 2]] : Vertices[ind[i + 2]].Uv2;
    61.                         var u3A = isReadyForToMesh ? newUVs[ind[i + 0]] : Vertices[ind[i + 0]].Uv3;
    62.                         var u3B = isReadyForToMesh ? newUVs[ind[i + 1]] : Vertices[ind[i + 1]].Uv3;
    63.                         var u3C = isReadyForToMesh ? newUVs[ind[i + 2]] : Vertices[ind[i + 2]].Uv3;
    64.                         var u4A = isReadyForToMesh ? newUVs[ind[i + 0]] : Vertices[ind[i + 0]].Uv4;
    65.                         var u4B = isReadyForToMesh ? newUVs[ind[i + 1]] : Vertices[ind[i + 1]].Uv4;
    66.                         var u4C = isReadyForToMesh ? newUVs[ind[i + 2]] : Vertices[ind[i + 2]].Uv4;
    67.                         var t0 = isReadyForToMesh ? newTangents[ind[i + 0]] : Vertices[ind[i + 0]].Tangent;
    68.                         var t1 = isReadyForToMesh ? newTangents[ind[i + 1]] : Vertices[ind[i + 1]].Tangent;
    69.                         var t2 = isReadyForToMesh ? newTangents[ind[i + 2]] : Vertices[ind[i + 2]].Tangent;
    72.                         tempNewVerts.Add(v0);
    73.                         tempNewCol.Add(c0);
    74.                         tempNewNorm.Add(n0);
    75.                         tempNewUVs.Add(uA);
    76.                         tempNewUV2s.Add(u2A);
    77.                         tempNewUV3s.Add(u3A);
    78.                         tempNewUV4s.Add(u4A);
    79.                         tempNewTangents.Add(t0);
    80.                         tempInd.Add(msIndex);
    81.                         msIndex++;
    84.                         tempNewVerts.Add(v1);
    85.                         tempNewCol.Add(c1);
    86.                         tempNewNorm.Add(n1);
    87.                         tempNewUVs.Add(uB);
    88.                         tempNewUV2s.Add(u2B);
    89.                         tempNewUV3s.Add(u3B);
    90.                         tempNewUV4s.Add(u4B);
    91.                         tempNewTangents.Add(t1);
    92.                         tempInd.Add(msIndex);
    93.                         msIndex++;
    96.                         tempNewVerts.Add(v2);
    97.                         tempNewCol.Add(c2);
    98.                         tempNewNorm.Add(n2);
    99.                         tempNewUVs.Add(uC);
    100.                         tempNewUV2s.Add(u2C);
    101.                         tempNewUV3s.Add(u3C);
    102.                         tempNewUV4s.Add(u4C);
    103.                         tempNewTangents.Add(t2);
    104.                         tempInd.Add(msIndex);
    105.                         msIndex++;
    106.                     }
    107.                     tempIndices[sub] = tempInd;
    108.                 }
    109.                 mesh.SetVertices(tempNewVerts);
    110.                 mesh.SetColors(tempNewCol);
    111.                 mesh.SetNormals(tempNewNorm);
    112.                 mesh.SetUVs(0, tempNewUVs);
    113.                 mesh.SetUVs(1, tempNewUV2s);
    114.                 mesh.SetUVs(2, tempNewUV3s);
    115.                 mesh.SetUVs(3, tempNewUV4s);
    116.                 mesh.SetTangents(tempNewTangents);
    118.                 mesh.subMeshCount = actualSubmeshCount;
    119.                 var mIndex = 0;
    120.                 for (var i = 0; i < SubmeshCount; ++i)
    121.                 {
    122.                     var ind = tempIndices[i];
    123.                     if (ind.Count > 0)
    124.                     {
    125.                         materialsMask |= 1 << i;
    126.                         mesh.SetTriangles(ind, mIndex++);
    127.                     }
    128.                 }
    129.                 mesh.RecalculateNormals();
    130.             }
    131.             //END Separate Faces
    132.             else
    133.             {
    134.                 mesh.SetVertices(newVertices);
    135.                 mesh.SetColors(newColors);
    136.                 mesh.SetNormals(newNormals);
    137.                 mesh.SetUVs(0, newUVs);
    138.                 mesh.SetUVs(1, newUVs2);
    139.                 mesh.SetUVs(2, newUVs3);
    140.                 mesh.SetUVs(3, newUVs4);
    141.                 mesh.SetTangents(newTangents);
    143.                 mesh.subMeshCount = actualSubmeshCount;
    144.                 var mIndex = 0;
    145.                 for (var i = 0; i < SubmeshCount; ++i)
    146.                 {
    147.                     var ind = Indices[i];
    148.                     if (ind.Count > 0)
    149.                     {
    150.                         materialsMask |= 1 << i;
    151.                         mesh.SetTriangles(ind, mIndex++);
    152.                     }
    153.                 }
    154.             }
    156.             mesh.bounds = bounds;
    157.         }
    camta005 and Wright like this.
  16. Wright


    Feb 26, 2013
    Congrats with a good job done well!

    The thing is that Voxeland "welds" vertices before the smoothing to find the average normal direction, so the only way to achieve lowpoly is the one you advise, with splitting vertices back from a welded mesh.
  17. Wintermute-


    Sep 5, 2017
    I have a question; how do I create more LOD levels? I found how to make the LOD closer or further from the camera, but I am only getting two levels, a high and low. I noticed that the scene that comes with Voxeland has more levels of LOD. I am using dynamic limited. Thank you,
  18. Wintermute-


    Sep 5, 2017
    Another question, is there a way to transform the voxel terrain into a mesh? I need to create a mesh collider that is separate from the mesh itself.
  19. Wright


    Feb 26, 2013
    You might be speaking of the horizon mesh - it gives the last non-voxel (planar) LOD level. It is enabled in settings, under the Horizon Mesh tab.

    Actually the Voxeland terrain is a mesh. You can see that by selecting each chunk in a hierarchy menu. The chunks script has the reference to 2 meshes, for high and low detail levels. The last one if used as a collider mesh - you can try to get use of the collider component to assign your mesh here.
    Wintermute- likes this.
  20. Wintermute-


    Sep 5, 2017
    Hi, thanks for your response,

    I see the mesh on the chunks, but is there a way to freeze the mesh so it is not created in run-time? For example, save the mesh in the project. I am using scenes on demand and it takes a while to load using Voxeland. I am using a very small terrain size, 30-90 so it might be better if I could freeze it.
  21. Wright


    Feb 26, 2013
    If you are using the static Voxeland mode then all of the meshes are saved to scene, and once they load they are not generated and not affected with Voxeland at all. To save them as a separate meshes you can iterate all of the Voxeland's mesh filter components in children and call AssetDatabase.CreateAsset on each of the sharedMeshes.
    Wintermute- likes this.
  22. play_unity729


    Apr 18, 2018
    On unity 2017.2.5 shows all the land black and I got a TVAL_ID error on the line 69, if I use it on unity 2019 works ok, sadly I need unity 2017 for the project I'm working, some one got a fix for it? it's on Land.shader
  23. Wintermute-


    Sep 5, 2017
    Last question. If I use static, it adds a lot more geometry. Is there a way to reduce the level of geometry in static? Because I believe it gets rid LOD levels.
  24. Wright


    Feb 26, 2013
    I've got no 2017.2 installed, but I've just checked that there is no problem with shader in 2017.3.0f2

    Unfortunately there's no way to get rid of hi-poly meshes and use only LODs. Voxeland creates main meshes first, and then makes low-poly of them. There is no way to skip hi-poly meshes on creation, and I have not looked into the way to remove them after.
    Wintermute- likes this.
  25. play_unity729


    Apr 18, 2018
    yes, there's no problem from that version, sadly I need to work on 2017.2.5 on other versions up to 2017.3 works fine
  26. ChillyMcChill


    Nov 17, 2016
    Has anyone got terrain changes working with photon?
  27. TarekNassef


    Aug 19, 2017
    Can you help me to solve this problem ?

    Assets\Voxeland\Tools\Extensions\Texture2DExtensions.cs(62,86): error CS1739: The best overload for 'Texture2D' does not have a parameter named 'mipmap'

    Assets\Voxeland\Tools\Extensions\TextureArrayExtensions.cs(31,66): error CS1503: Argument 3: cannot convert from 'UnityEngine.TextureCompressionQuality' to 'int'

    I using this version Unity 2018.3.0f1 (64-bit)
    Many Thanks :)
  28. Wright


    Feb 26, 2013
    Are you sure you are using the latest Voxeland version?
    Could you please try it in a fresh project in demo scene? I've just installed 2017.2 and it all seems to be fine here.
  29. rolfy01


    Mar 14, 2016
    Voxeland was the first asset I purchased when I picked up Unity but only recently got the chance to use it. I just wanted to say having a blast creating sculptures with this really cool tool. I can create an interesting terrain right out of the box with this and limited only by my own imagination. Thanks for creating it.
    Last edited: Jun 20, 2019
    EnriquePage91, Weblox, Wright and 2 others like this.
  30. Wright


    Feb 26, 2013
    Thanks! I'm really glad to hear you are enjoining Voxeland, and thanks for sharing the screens. Looks awesome!
    rolfy01 likes this.
  31. Strance


    Apr 6, 2013
    Hi :D
    I'd like to share a game we're working on. It's Light Trail Rush, an arcade racing game where the road is traced by the first player. We've used Voxeland to procedurally generate asteroids:




    The asteroids can be dug as they are still Voxeland objects in-game, we have a kind of drill power-up to create tunnels.

    If you want more details, I wrote an article about the process we got through to make this possible:

    I know some people have tried to generate floating lands before, there even is some posts about a next asset "Voxelump". Feel free to ask if you need a starting point to create this kind of object.

    @Wright Your plugin is amazing, however I would have loved to see more comments in your code or a programmer-friendly documentation with doxygen for example. Anyway, thanks for having given access to the source code, I wouldn't have been able to understand Voxeland's deep workflow otherwise and I wouldn't have been able to achieve this result :) (We've even created an Amplify shader that reuse your land block decryption)
    Last edited: Jul 11, 2019
    EnriquePage91, Wright and ssurget like this.
  32. lzardo2012


    Apr 11, 2013
    Hello, I just acquired your plug-in and I want to use it for a 2.5d sidescroller game, I know it´s not exactly desgined for such, but is there any information anywhere on where to start?

    If it´s possible at all, at least I found someone talking about using it for a sidescrolling game

    Also, is there more tutorials for it? I could not find any on youtube, except on how to integrate Voxeland with other assets.

    Thanks in advance
  33. Wright


    Feb 26, 2013
    A couple of months ago I've got a feature request to make Voxeland rotatable along the X axis. Rotating it 90 degrees will order chunks both vertically and horizontally, making it possible to create games like Terraria or Oxygen Not Included. Guess it could be used sidescroller games too.
    This feature was implemented and currently available in Voxeland - just rotate it the usual way you rotate an object.

    It's nice to see you've chosen Voxeland to create asteroids! Great job with the generator and Amplify shader!
    I'm trying to keep the comments only where they are really necessary, but I'll keep in mind that some users need a bit more commented code. Speaking of Doxygen - I'm using it for MapMagic and going to use it with Voxeland too after a while.
    Strance likes this.
  34. lzardo2012


    Apr 11, 2013
    Thanks for your quick reply

    Just another questions:

    Can I change the number and disposition of chunks? for example, having only a line of them?
  35. Wright


    Feb 26, 2013
    Unfortunately it's not possible - or at least not possible without the hacks like using multiple 'key' objects (the ones that are set in "Generate Around..." is settings, like the main camera) aligned in line
  36. WildStyle69


    Jul 20, 2016
    Hi @Wright

    We're considering Voxeland for a VR project and I have a few questions;
    • Goal is to model a tunnel area based on real spacial data.
    • Is it possible to plug data into Voxeland, or sculpt based on data points?
    • Or can we create states that could playback / transition in real-time?
    • For the rock underground, one block can only have a single material?
    • So it's not possible to create / blend rock materials in the same voxel space?
    • Performance for smaller terrains / tunnels should be OK for high-end VR?
    Understand some or all of this may not be possible, just wondering if / how much we could customize to create some kind of real-time rock / tunnel simulation.

    // WildStyle
  37. TiToMoskito


    Jan 28, 2014
    Does it work with Lightweight Render Pipeline? Because everything is purple...
  38. TiToMoskito


    Jan 28, 2014
    Does it also work with voxeland?
  39. Wright


    Feb 26, 2013
    Voxeland works with the standard pipeline only. I'm going the release the shader graphs that will work with any pipeline soon, but still they are under the development.
    Ascensi likes this.
  40. Chemanel


    May 6, 2015
    Move to the direction of smoothness... definitively.

    I had an idea for a project for years (a kind of minecraft but with cars) and that is the main point that blocks me. (cause you cannot drive cars in the world that is generated right now cause all of those bumps)
  41. GamePowerNetwork


    Sep 23, 2012
    I just want to +1 the direction of going toward a more smooth Voxeland
  42. N1warhead


    Mar 12, 2014
    I noticed others asked how to make a Voxel Asteroid with Voxel Land.

    Now - this makes me wonder, would it be possible to make a Spherical Voxel Planet? I wouldn't see why not if it can make an Asteroid from code. Because this would make it really unique to get rid of technically (unlimited) worlds and just have it where players can run around the entire planet and end up back to where they were before.

    Think of Medieval Engineers (the entire planet is Voxel Based).
  43. N1warhead


    Mar 12, 2014
    @Wright Sorry below is A TON of information for you to work with. Sorry I'm just trying to help you possibly pinpoint the problem.

    (The Issue)- Voxeland Grass is being extremely inefficient for some reason. Literally 14.5 FPS - demo scene is just as bad.

    I got a 6 core Ryzen, Rx480 Graphics Card, 48 Gigs of ram. (just updated AMD Drivers, and windows updates as well - didn't work).

    Normally I can handle tens of millions of Polygons, over 1000 batches, 800+ shadows and still keep 50ish FPS on any other project that uses Unity Terrain. I mean I knew voxels had some overhead, but this isn't coming from Voxels, it's coming from culling (according to the profiler), well Actually the biggest culprit is - not Gfx.WaitForPresent but one I never seen before - Gfx.WaitForPresentOnGfxThread.

    I've isolated the issue down to the grass. The second I remove grass blocks from project my FPS goes back to 80+ FPS.
    So there's something going on with the grass. I haven't changed any of the grass settings so it's still on 50, well I did try changing it to 25 once (didn't help).

    Not sure if it matters but I'm using MapMagic as the generator. The Grass Density is set to the default 1. And it's set to only show on the grass blocks - which in my case there's not many. Most of it is pine straw blocks which don't have grass (for obvious reasons). So it's not that I have millions of grass or anything.

    But like I said, this happens in your Demo Scene too, so it's not map magic related.

    Perhaps it's a 2019.2f1 issue?

    [Edit 2]
    If the camera isn't looking at the grass FPS goes back up as well. But I've noticed it mainly happens when the player is on top of the grass. So if I'm in pine straw for example with grass around the edges of it, it sometimes isn't as bad or doesn't happen at all. But the moment the player gets to the grass performance drops badly again. (Not always - sometimes it's simply just constantly bad regardless.)

    The performance drop doesn't happen in scene view, only in game view. Actually nvm - it's just a slight performance drop in Scene View (nothing major - workable there), but in game view - it's horrendous. I even dropped Density to 0.3 - it helped only a tiny bit having only patches of grass here and there and it still dropped to 25ish FPS.

    [Edit 3]
    I went to run a build and it failed at the end with this

    Error 1
    Code (CSharp):
    2. NullReferenceException: Object reference not set to an instance of an object
    3. MapMagic.VoxelandGrassOutput.OnLayerGUI (MapMagic.Layout layout, System.Boolean selected, System.Int32 num) (at Assets/MapMagic/Generators/VoxelandOutputs.cs:696)
    Error 2
    Code (CSharp):
    1. Thread Error: System.IndexOutOfRangeException: Index was outside the bounds of the array.
    2.   at MapMagic.Matrix2`1[T].get_Item (System.Int32 x, System.Int32 z) [0x00000] in C:\Users\Warhead-Designz\Documents\UnityProjects\Dinosaur Hunter\Assets\MapMagic\Main\Matrix2.cs:486
    3.   at MapMagic.VoxelandObjectsOutput.Process (MapMagic.CoordRect rect, MapMagic.Chunk+Results results, MapMagic.GeneratorsAsset gens, MapMagic.Chunk+Size terrainSize, System.Func`2[T,TResult] stop) [0x001b2] in C:\Users\Warhead-Designz\Documents\UnityProjects\Dinosaur Hunter\Assets\MapMagic\Generators\VoxelandOutputs.cs:453
    4.   at (wrapper delegate-invoke) MapMagic.Action`5[MapMagic.CoordRect,MapMagic.Chunk+Results,MapMagic.GeneratorsAsset,MapMagic.Chunk+Size,System.Func`2[System.Single,System.Boolean]].invoke_void_T1_T2_T3_T4_T5(MapMagic.CoordRect,MapMagic.Chunk/Results,MapMagic.GeneratorsAsset,MapMagic.Chunk/Size,System.Func`2<single, bool>)
    5.   at MapMagic.GeneratorsAsset.Process (MapMagic.CoordRect rect, MapMagic.Chunk+Results results, MapMagic.GeneratorsAsset gens, MapMagic.Chunk+Size terrainSize, System.Collections.Generic.HashSet`1[T] changedTypes, System.Func`2[T,TResult] stop) [0x0026b] in C:\Users\Warhead-Designz\Documents\UnityProjects\Dinosaur Hunter\Assets\MapMagic\Main\GeneratorsAsset.cs:496
    6.   at MapMagic.GeneratorsAsset.Calculate (MapMagic.CoordRect rect, MapMagic.Chunk+Results results, MapMagic.Chunk+Size terrainSize, System.Int32 seed, System.Func`2[T,TResult] stop) [0x00015] in C:\Users\Warhead-Designz\Documents\UnityProjects\Dinosaur Hunter\Assets\MapMagic\Main\GeneratorsAsset.cs:234
    7.   at MapMagic.GeneratorsAsset.Calculate (System.Int32 offsetX, System.Int32 offsetZ, System.Int32 size, MapMagic.Chunk+Results results, MapMagic.Chunk+Size terrainSize, System.Int32 seed, System.Func`2[T,TResult] stop) [0x00000] in C:\Users\Warhead-Designz\Documents\UnityProjects\Dinosaur Hunter\Assets\MapMagic\Main\GeneratorsAsset.cs:237
    8.   at Voxeland5.Generator.Generate (Voxeland5.Data+Area area, System.Func`2[T,TResult] stop) [0x00566] in C:\Users\Warhead-Designz\Documents\UnityProjects\Dinosaur Hunter\Assets\Voxeland\Main\Generator.cs:1023
    9.   at Voxeland5.Data+Area+<>c__DisplayClass19_0.<Init>b__0 () [0x00000] in C:\Users\Warhead-Designz\Documents\UnityProjects\Dinosaur Hunter\Assets\Voxeland\Main\Data.cs:87
    10.   at Voxeland5.ThreadWorker.ThreadFn () [0x00019] in C:\Users\Warhead-Designz\Documents\UnityProjects\Dinosaur Hunter\Assets\Voxeland\Tools\ThreadWorker.cs:533

    [Edit 4]
    I started a completely new project and imported ONLY Voxeland) and the same issue.. Stand inside the initial cave (80+ FPS), but the moment grass gets in - 15ish FPS again.

    [Edit 5]

    Here's an example below. Looking directly at this grass patch, and simply turning the camera around to where grass isn't in main field of view.

    Now turn the camera a bit, and now FPS sky rockets back up.

    [Edit 6]
    Tried turning off wind - that didn't help.

    [Edit 7]
    Below is a video showing the problem (figured this would be better). Apologize for some reason no recording program picks up my Mic, despite it working with Discord and such. So please just watch (all) of it to see what I'm doing to replicate and what I do to prove it's the grass and nothing else. (I Look down, and walk in and out of grass), I look at grass from a couple meters away. Show the FPS Differences doing that, then I completely remove Grass Blocks altogether and bam FPS is beautiful.
    Last edited: Aug 17, 2019
  44. NewMagic-Studio


    Feb 25, 2015
    Anyone knows how to make caves as deep as you want without needing making a huge or infinite terrain?
  45. GrobyKen


    Apr 9, 2019
    Would be interested in this tool but on loading the evaluation version I was presented with console errors. Any ideas why. See attached file.

    Attached Files:

  46. ericesteb


    Dec 31, 2018
    I was attempting to try out the Voxeland Evaluation and received the following 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'

    This was in an empty 3d project (not HDRP or LWRP) with only the Voxeland Evaluation imported in Unity 2019.2.6f1.

    EDIT: Same errors when importing to Unity 2019.2.5f1.
    Last edited: Sep 19, 2019
  47. Ascensi


    Sep 7, 2013
    Vegetation Studio Pro can work with Voxeland, I've set it up myself. Denis is just stating that he didn't make any particular integrations for it but it will work with it. There is a different workflow, unless things changed, you can't create biomes automatically/procedural based on land textures but there was talk about a Megasplat integration with VSP that allowed one developer to do it on Voxeland and was willing to share the process. I wish this workflow is mentioned in the Voxeland Wiki.
    EnriquePage91 and ftejada like this.
  48. Craptastic


    Dec 15, 2016
    Grass is a huge issue for me as well. I've tried mentioning it in the past to little effect. I've got an rx580 and can play optimized modern games with plenty of shader magic going on at full 60fps just fine, but one little patch of Voxeland grass anywhere near a camera tanks.

    One solution is to use a different shader than the one provided. The default Voxeland one seems to be pretty feature packed and so I assume also quite heavy. It does things like calculating light translucency at edges of each blade I think. Which I assume isn't that heavy. Regardless, simply changing the grass shader to a unity default one gave me my fps back. Its not plug and play and I recall having some issues but it was enough to show that the grass shader is the culprit.
  49. dinisd


    Nov 6, 2018
    Hi, downloaded the evaluation version today and it spitting out two 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'

    Unity 2019.1.3f1
  50. FrostedBrain


    Sep 26, 2019

    Hello, would you be able to modify this old script to find the Voxeland game object when the item the script is attached to is spawned?

    Code (CSharp):
    1. using UnityEngine;
    3. /// <summary>
    4. /// jasoncg
    5. /// </summary>
    6. public class TerrainExplosion : MonoBehaviour {
    8.     [SerializeField]
    9.     private Voxeland5.Voxeland voxeland;
    11.     [SerializeField]
    12.     private bool explodePosition = true;
    14.     public int setLandType = 0;
    16.     private Voxeland5.CoordDir coord = new Voxeland5.CoordDir();
    17.     private Voxeland5.Brush brush = new Voxeland5.Brush();
    19.     /// <summary>
    20.     /// Convert world coordinates to Voxeland integer coordinates
    21.     /// </summary>
    22.     /// <param name="voxeland"></param>
    23.     /// <param name="position"></param>
    24.     /// <returns></returns>
    25.     public static Vector3Int WorldToVoxeland(Voxeland5.Voxeland voxeland, Vector3 position) {
    26.         var resultf = position;
    27.         //Just in case Voxeland is not at origin or is scaled, handle that here
    28.         resultf -= voxeland.transform.position;
    29.         resultf.x /= voxeland.transform.localScale.x;
    30.         resultf.y /= voxeland.transform.localScale.y;
    31.         resultf.z /= voxeland.transform.localScale.z;
    33.         var result = new Vector3Int(Mathf.FloorToInt(resultf.x),
    34.             Mathf.FloorToInt(resultf.y),
    35.             Mathf.FloorToInt(resultf.z));
    37.         return result;
    38.     }
    40.     void OnEnable() {
    41.         //If Voxeland wasn't already set, try to set it now
    42.         if (voxeland == null)
    43.             voxeland = FindObjectOfType<Voxeland5.Voxeland>();
    45.         if (explodePosition)
    46.             ExplodeHere();
    47.         else
    48.             SetLandHere();
    49.     }
    50.     /// <summary>
    51.     /// Remove Voxeland terrain at the given center world coordinate,
    52.     /// and radius
    53.     /// </summary>
    54.     /// <param name="center"></param>
    55.     /// <param name="radius"></param>
    56.     public void Explode(Vector3 center, int radius) {
    57.         var voxelCoords = WorldToVoxeland(voxeland, center);
    58.         coord.x = voxelCoords.x;
    59.         coord.y = voxelCoords.y;
    60.         coord.z = voxelCoords.z;
    62.         brush.form = Voxeland5.Brush.Form.volume;
    63.         brush.extent = radius;
    64.         voxeland.Alter(coord, brush, Voxeland5.Voxeland.EditMode.dig, 0, -1, -1);
    65.     }
    66.     public void SetLand(Vector3 center, int radius, int landType) {
    67.         var voxelCoords = WorldToVoxeland(voxeland, center);
    68.         coord.x = voxelCoords.x;
    69.         coord.y = voxelCoords.y;
    70.         coord.z = voxelCoords.z;
    72.         brush.form = Voxeland5.Brush.Form.volume;
    73.         brush.extent = radius;
    74.         voxeland.Alter(coord, brush, Voxeland5.Voxeland.EditMode.add, landType, -1, -1);
    75.     }
    76.     /// <summary>
    77.     /// Calls explode treating this object as a sphere
    78.     /// </summary>
    79.     public void ExplodeHere() {
    80.         Explode(transform.position, (int)transform.localScale.x);
    81.     }
    82.     public void SetLandHere() {
    83.         SetLand(transform.position, (int)transform.localScale.x, setLandType);
    84.     }
    85. }