Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Voxeland - Voxel Terrain Tool

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

  1. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,260
    MarkusGod, Ascensi, twodave, ok, so the focus has been laid down for further Voxeland improvement: integrating with MegaSplat and Ultimate Survival.

    OlympusPorductions, you can export terrain heightmap, convert it to the texture Unity can read and then use it in a Heightmap Generator.

    chiefarchon, Voxeland has it's own generator, it can generate an infinite world, but it's way too simpler and limited than MMWG. It just uses some of MMWG generators in a fixed order.

    Odd thing. I will test Substance textures with RTP. BTW does it logs any error in the console?

    hoodoo, all, no more work around is needed since the fixed version (5.0.1) is now available in AS. Here is what it brings:
    - 5th and subsequent Block Types are now not displayed black
    - Terrain size spinner when using Static Terrain fix
    - Grass and Land Blocks order change fix
    - Unity 2017b1 compatibility
    - Horizon Mesh scale
    - Planar terrain fix
    - Stamp Brush error fix
     
    MarkusGod and Ascensi like this.
  2. BobOfTibia

    BobOfTibia

    Joined:
    Aug 24, 2016
    Posts:
    40
    @Wright can you convert a normal unity terrain over to a Voxeland terrain?

    Haven't bought it yet, but the description doesn't mention being able to do so.


    EDIT: Never-mind, I believe you just answered this question.


    EDIT 2: Purchased the asset, not quite sure actually how to import the heightmap.
     
    Last edited: Jun 7, 2017
  3. EvansSoftware

    EvansSoftware

    Joined:
    Apr 3, 2017
    Posts:
    64
    Oh no :(, I stopped modifying Voxeland V4 when I read you were multithreading V5 as that was the next thing on my list. I have been integrating Ultimate Survival with Voxeland V5 and MapMagic recently but guess I may as well stop if your doing it anyway. Still, plenty of other things I have to be getting on with :).
    Good luck with the integration work!
     
  4. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    579
    Awesome Denis! awesome!
    I was thinking again about allowing custom output setting for generating low res meshes rather than generating LODs as an option for tessellation mode but if the video card doesn't support tessellation Megasplat allows alternate shader to be specified.. so if tessellation isn't supported it would be good to automatically use your LOD system as well.
     
    Last edited: Jun 9, 2017
  5. Brandon_Powell

    Brandon_Powell

    Joined:
    Jul 24, 2016
    Posts:
    58
    sorry, but has this been answered? I just bought this asset and basically it is not working out of the box.(same problem as described above) i have been searching the forum and the documentation, and not finding an answer to this one.
    to be clear, i am not even trying to integrate anything else yet, just trying to get the demo to operate so i can begin to undestand how it all works
     
  6. WoodenDragon

    WoodenDragon

    Joined:
    Sep 28, 2015
    Posts:
    41
    @Brandon_Powell
    • It looks like the 'help' panel has not been updated to match the code.
      • Use alt+left click to add blocks
      • Use shift+left click to replace blocks
    • To correct the grass not painting on blocks, change line 74 in the Voxeland\Demo\Scripts\VoxelandController.cs to the following:
      • if (Input.GetKey("`")) { vertGrassInstrument.isOn = true; voxeland.grassTypes.selected=0; voxeland.landTypes.selected=-1; voxeland.objectsTypes.selected=-1; }

     
  7. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,260
    EvansSoftware, sorry! I'm glad to know that I'm on the right track since I do the things users really want and even do themselves, but I know how it hurts to know that the developer has made something that you were working on. I've made a GUI system for some project (and even made an AS plugin of it) just a couple of days before Unity finally released uGUI. Feels like a waste of time and efforts, very depressing. So I'm really sorry about that.
    However I have not even started to implement US support and I can't promise it soon.

    - Import the heightmap like a usual texture (place it anywhere in the assets folder),
    - Enable "read/write enabled" in import settings (and disable sRGB if you are using linear mode),
    - Switch Voxeland generate type to "Heightmap" in voxeland's Generate foldout
    - Extend "Heightmap" fouldout
    - Assign the imported texture and press "Reload"

    WoodenDragon, thanks for the hint (fixing this)! @Brandon_Powell, are you digging the terrain or adding new blocks with alt-click (or paint with shift-click)?
     
  8. Brandon_Powell

    Brandon_Powell

    Joined:
    Jul 24, 2016
    Posts:
    58
    Thanks! this is very helpful, and pointed me right where i needed to be!

    Yes, once WoodenDragon pointed out that the instructions were simply incorrect, I was able to sort that out. I would mention that the mapping seems a bit problematic, i ended up editing the voxeland controller script to eliminate use of the control, alt and shift, (i kept opening windows and tabs while editing) and instead use the 3 mouse buttons (for now) this is about the limit of my coding skill at the moment, so if i could ask,*** Edit- a better question, is the commented out code meant to be an alternate controller script? was not sure if it was an older version etc? *** (i'm slowly trimming the controller script down until i can basically use it as a "Nano-Rifle" for my Ultimate Survival character
     
    Last edited: Jun 9, 2017
  9. BobOfTibia

    BobOfTibia

    Joined:
    Aug 24, 2016
    Posts:
    40
    Tool is working great at importing heightmaps, the only thing I'm having trouble with is VoxelLand seems to be generating small bumps all over the heightmap.

    Would anyone know what feature is doing this, so I may turn it off?

    Example attached.
     

    Attached Files:

    • map.png
      map.png
      File size:
      468.5 KB
      Views:
      843
  10. EvansSoftware

    EvansSoftware

    Joined:
    Apr 3, 2017
    Posts:
    64
     
  11. csharpstudios

    csharpstudios

    Joined:
    Nov 21, 2016
    Posts:
    73
    @Wright Thanks(Its OlympusProductions, new name!) Thanks for the help! New Question!
    I'm trying to bake a nav mesh to the voxeland terrain, to do this I would go under Import/Export on the voxeland terrain script, and click bake meshes to scene, then go to navagation window and bake all the chunks to nav mesh? Or would I do something different?
     
  12. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,457
    That's the puberty feature. It'll turn itself off after a while.
     
  13. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    Check out the mesh without any relax/smooth settings, that might give you a clue
     
  14. BobOfTibia

    BobOfTibia

    Joined:
    Aug 24, 2016
    Posts:
    40
    Tried, don't believe it's tied to anything under those settings, at it doesn't seem to do anything to my terrain at any number set.
     
  15. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,260
    It's a floating point value. Like the height of 100.1f. Since Voxeland cannot set block at the height of 100.1 it sets 9 of 10 blocks at 100, and 1 block at 101. At random. This works fine for noise or gradient maps, preventing a "terrace" look, but I guess I should make this random switchable for planar heightmaps.

    Try changing the maximum height value a bit (under the seed field).

    csharpstudios, you'll have to turn on Navigation Static for Voxeland object, and make sure that "Copy Layers and Tags to chunks" is enabled in settings.
     
  16. Brandon_Powell

    Brandon_Powell

    Joined:
    Jul 24, 2016
    Posts:
    58
    could someone please point me at a working example of save/load for this asset, or current documents? i've been really happy with everything else about Voxeland (it's amazingly fun to just play with) but the documentation is not giving me a lot of help on this one. The example shown there is not shown "in use" in the demo, and as best i can tell, is not valid with the current version of voxeland. (any reference to VoxelandTerrain in visual studio shows up as namespace not found) ANY help would be appreciated, even pointing me at a basic coding tutorial that will explain to me what it is I'm not understanding.
     
  17. rain330047

    rain330047

    Joined:
    Jun 3, 2016
    Posts:
    10
    My colleague is stuck in a bad situation:
    1.jpg 2.png 3.jpg
    once he keep dig in, at some point, ground comes like this one. And unity will said the the vertices is more than 65000?
    pls help.

    we used the latest version plugin, and unity version is 5.4.5.
     
    Last edited: Jun 14, 2017
  18. sebou42240

    sebou42240

    Joined:
    Aug 21, 2015
    Posts:
    19
    Hello, how can i change the height On a land already created please Without digging by hand ...

    thanks
     

    Attached Files:

  19. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,260
    Brandon_Powell, here I wrote a small article on serializing Voxeland5 data.

    rain330047, this means that the terrain chunk has more then 65K vertices. This can occur if the chunk has an extremely complex structure - like the strips on the screen that go down infinitely. I guess they were made not intentionally. How did it happened, what was your colleague doing before these strips occurred?

    sebou42240, how do you generate your terrain?
     
    Brandon_Powell likes this.
  20. sebou42240

    sebou42240

    Joined:
    Aug 21, 2015
    Posts:
    19
    right click --> I change the values of the terrain and different Mountain appear...

    but i would like remove the big part where i have Nothing...
     
  21. Brandon_Powell

    Brandon_Powell

    Joined:
    Jul 24, 2016
    Posts:
    58
    Thanks much, I really appreciate it. *** :) and nevermind the question, i thought of a way to troubleshoot my work and got it running smooth. thanks for the code functions, and thanks for the amazing asset!!
     
    Last edited: Jun 14, 2017
  22. rain330047

    rain330047

    Joined:
    Jun 3, 2016
    Posts:
    10
    this occured when he try to dig a tunnel under ground.
    is there any way to increase vertices amount?
     
  23. Shockwolf

    Shockwolf

    Joined:
    Oct 11, 2016
    Posts:
    12
    @EvansSoftware I like what you've done with merging US and Voxeland! That's the kind of thing I am looking at doing.
    But does US and Voxeland have a load and save feature or are all of the changes lost when the game ends?

    How are you doing the Minecraft style blocks? Are they a built in feature of US?

    Cheers.
     
  24. Don-Gray

    Don-Gray

    Joined:
    Mar 18, 2009
    Posts:
    2,278
    After building a larger terrain and rotating the scene using the Alt-Left Mouse button, it takes ten or more seconds for the rotate scene function to release after releasing the mouse button. I have a fairly powerful machine.
    Is there a way to get this to be more real time on the release of the rotate function?
    Actually, it doesn't take a larger terrain, it seems to come with the complexity of the graph (with Map Magic) or options in VL.
     
    Last edited: Jun 15, 2017
  25. EvansSoftware

    EvansSoftware

    Joined:
    Apr 3, 2017
    Posts:
    64
    US does not currently have save/load (in next version I believe) and Voxeland does not have the actual functions but does have functions to serialize and deserialize from byte arrays which you can use to save/load from file. I wrote my own save/load functions for both my modified version of US and Voxeland along with the other components I created for my game. Unless you just intend to use an asset 'as is' you will inevitably need to write some save/load functions yourself.
    US has different prefabs for building, walls, ceiling, floors etc, I prefer to use blocks though so I replaced their prefabs with my own and modified the building code as necessary to accommodate them and to use Voxeland terrain.
     
  26. Brandon_Powell

    Brandon_Powell

    Joined:
    Jul 24, 2016
    Posts:
    58
    Muahahaha... i found a different trick that works well.. In voxeland you can set up placeable objects with the edit brush. I added cubes to that and made a larger instrument list. short version, find the section of input functions for the instruments in the code, just duplicate the one for torch and change the inputs, and the index for object type. texture then add the cube prefabs to your voxeland inspector , and boom. cubic "voxels in voxeland

    *** downside, it does not do doors** but you *can* change the settings on your door frame prefab to not require sockets (will still work with the sockets) and place it, or a trimmed down version of it, using the existing US building system. i found some tricky spots around the edges of the US building components where you can't target voxels, but I will figure out raycast masking, and just make the voxel raycast ignore them.. rambling now....
    :)
     
    Last edited: Jun 16, 2017
  27. Migueljb

    Migueljb

    Joined:
    Feb 27, 2008
    Posts:
    562
    Last edited: Jun 15, 2017
    dyox likes this.
  28. dyox

    dyox

    Joined:
    Aug 19, 2011
    Posts:
    621
    This one yes.

    Yes it's possible. The base of the island must be a perlin noise with min/max (0.3/1) or a simple circle with perturbation.
    The top is a RidgedMultiFractal with a min/max value (0.5 to 1) powered depending of the distance of the island center (center of the circle or max perlin here 1f).
    And elevation of the middle of the island is an height depending of the distance to the border of the circle or the perlin squared elevation with a power or a simple curve.

    Manually also it's pretty simple. (Except for the castle inside the mountain, without a procedural building system it will take too much time to be achieved.
     
  29. dyox

    dyox

    Joined:
    Aug 19, 2011
    Posts:
    621
    I've tried something, i'm able to do that in 10-20 min : (total island, it's around 1-2 hours of code)
    Desktop 06.16.2017 - 03.01.49.17.png Desktop 06.16.2017 - 02.55.43.16.jpg Desktop 06.16.2017 - 03.03.26.19.jpg
     

    Attached Files:

    Last edited: Jun 16, 2017
  30. Migueljb

    Migueljb

    Joined:
    Feb 27, 2008
    Posts:
    562
    Wow Voxels are so cool makes using unity terrain so boring.

    I was just talking shaping pure land mass with that many cutouts. So how would each island be formed them? Would you have the main island shape it as it is get the results you want then start a new mass and carve away etc for all land masses wanted. Or is the system one big solid box so to speak and you carve away deleting adding til you get the shape you want based on how high poly you dictate the mesh to be.

    BTW thanks for taking that on and showing this, very cool. Also how does a scene like that run so for even VR purposes. I'm mainly wanting this to perform and run in a VR scene as well. Thanks.
     
    dyox likes this.
  31. dyox

    dyox

    Joined:
    Aug 19, 2011
    Posts:
    621
    Hey, sorry. I'm not using Voxeland actually. So i can not answer to your question.
    Technically, voxels allow you to create any shapes in any directions. So with voxeland you can sculpt everything by hand.
    For the VR part. It depend of your resolution and the shader used.
    When possible (don't know if it's possible with voxeland), use 2-3 different materials.
    Chunks close to you : Maximum detail, only for 10-30 meters
    Medium distance : Very simple material
    Far : Simple material with distant noise.

    VR only need a correct LOD system. Everything is killing GPU, dispatch your tasks on your CPU .
     
    neoshaman likes this.
  32. Migueljb

    Migueljb

    Joined:
    Feb 27, 2008
    Posts:
    562
    Hello Wright.

    Could you answer the questions about the VR part. Is this VR friendly to be able to run good and can Voxeland shape that type of land mass as well.
     
    dyox likes this.
  33. Shockwolf

    Shockwolf

    Joined:
    Oct 11, 2016
    Posts:
    12
    Thanks for your reply, @EvanSoftware. I currently use EasySave. Is it hard to work out how to save the Voxeland functions for a N00b programmer or is it quite complex?

    I'm still pondering whether to get this Asset and hope that I can figure out how to add clusters of ore in the terrain generation or just go with a Minecraft blocky terrain tutorial and use detailed textures.

    Cheers.
     
  34. MuckSponge

    MuckSponge

    Joined:
    Jul 11, 2015
    Posts:
    41
    Loving the Voxeland 5 update! Voxeland has been pretty much an essential solution for the project I'm working on, which requires a series of detailed, hand crafted floating islands with rocky overhangs, etc. The terrain needs to be sculptable in the editor otherwise the workflow is just not fast enough to prototype and tweak levels.

    01.jpg 02.jpg 03.jpg 04.jpg 05.jpg

    I've integrated StixGame's DirectX 11 Grass by essentially hooking into the event that occurs after each chunk mesh is generated. It's performant enough but could be a lot faster if it was directly integrated into the grass generation process (so instead of generating a number of grass mesh instances and combining them, generate a direct copy of the chunk mesh with only the grass vertices in it).

    Overall very happy with the look and the workflow, except starting the island sculpting process is a nightmare, as you must build up from the bottom, then remove all the blocks underneath and massage it to look like it's been ripped from the ground. Would be nice to have a simple layer generator that generates layers at x height with y position offset.

    Soon I'll look into adding parallax mapping. I'd love to have tessellation displacement mapping instead but it's essentially not possible with a triplanar surface shader from what I've seen. Perhaps the almighty (alwrighty?) Wright can help ;)

    EDIT: Wright, are you still using the BitBucket issue tracker? Posted a number of issues but occurred to me that is hasn't seen any updates in a little while and you mentioned you might have to move to GitHub. Is this still the correct place for issue tracking?
     
  35. Gunsrequiem

    Gunsrequiem

    Joined:
    May 17, 2017
    Posts:
    71
    Is there currently any way to create "biomes" utilizing Voxeland? I know that there are different types of generators, but I meant more in terms of placing certain objects in certain places. The "Scatter" features seems to only allow me to place one "set" of objects at a time. For the single-player version of my game, I can simply create different Voxeland terrains and implement it all that way, but I mean more in terms of infinite generation.
     
  36. Dwight_Everhart

    Dwight_Everhart

    Joined:
    May 11, 2014
    Posts:
    123
    He moved it to GitLab: https://gitlab.com/denispahunov/voxeland/issues
     
    Wright likes this.
  37. Dwight_Everhart

    Dwight_Everhart

    Joined:
    May 11, 2014
    Posts:
    123
    MapMagic supports biomes, and it integrates with Voxeland.
     
    Wright likes this.
  38. Gunsrequiem

    Gunsrequiem

    Joined:
    May 17, 2017
    Posts:
    71
    Thanks, Dwight.

    One last question, guys n' gals--I recently purchased Crux, and then I realize that it will not read the Voxeland textures because the Voxeland object is not technically a "terrain." Any thoughts on how to get around this, or save the Voxeland mesh as a terrain so that Crux can read it?
     
    Last edited: Jun 18, 2017
    Dwight_Everhart likes this.
  39. Gunsrequiem

    Gunsrequiem

    Joined:
    May 17, 2017
    Posts:
    71
    Also, I just purchased MM and created two separate "biomes" utilizing the Voxeland terrains and saved them as copied .asset files. However, now I am trying to combine two of those "biomes" together and can't figure out how (the traditional way utilizing the MM object doesn't seem to work). Can we get some kind of tutorial on how to do this?
     
  40. MarkusGod

    MarkusGod

    Joined:
    Jan 10, 2017
    Posts:
    168
    Can you describe a bit more how you integrate dx11grass? My way is not very smart, i just changed grass material in settings and set grass mesh to 2 tris 4 verts planemesh.
     
  41. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,260
    That should not happen when digging an underground tunnel. 65K is really a lot, and I guess that that error is a a consequence of some data glitch that created that infinite well. Can't you recall how did you get it? I would gladly fix it if only there is a way to reproduce it (at least every 10-th time).

    Migueljb, I have not tested Voxeland with VR, but I can provide you a copy so you could test it yourself - with an exchange of publishing the results here :)
    You can sculpt floating islands in Voxeland, but, more important, you can create the dynamic infinite world of floating islands using Voxeland+MapMagic. No scripting is required. I plan to make a tutorial on this soon.

    I like that idea. Adding to to-do list. And yes, I've switched to GitLab, and very like it so far. Got to say bye-bye to BitBucket by closing all of the repositories here.

    I'd rather rely on Jason, the terrains materials wizard, the author of MegaSplat. This asset has a tessellation feature, and I plan to add it's support to Voxeland.

    Gunsrequiem, Voxeland biomes could be added the way the standard biomes do, except that you should use Voxeland Outputs instead of the standard ones in your biomes graphs (and I guess you already do):

    (Here is more basic tutorial from beta, sorry for low res).
     
    Gunsrequiem likes this.
  42. MuckSponge

    MuckSponge

    Joined:
    Jul 11, 2015
    Posts:
    41
    Assuming you have the DX11 Grass asset (if not you're in for some intense shader coding), the process is conceptually simple. The way I did it only really works for non-infinite terrains but you can do it with infinite too (I'll explain later). My approach doesn't require any modifications to Voxeland's source code, though it makes the code a bit convoluted. Wright, would be cool to see a slick API to be able to listen for any chunk events (such as their meshWorker's Apply events) straight from Voxeland with an API:

    Code (CSharp):
    1. class Voxeland
    2. {
    3.     public event Action<Chunk> OnChunkMeshStart; // fires whenever a chunk's mesh has started generating
    4.     public event Action<Chunk> OnChunkMeshApply; // fires whenever a chunk's mesh has finished generating
    5. }
    At the moment you have to do it this way:

    Code (CSharp):
    1.  
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using Voxeland5;
    5. using System;
    6.  
    7. [ExecuteInEditMode]
    8. public class GrassPostProcessor : MonoBehaviour
    9. {
    10.     Voxeland voxeland;
    11.  
    12.     HashSet<Coord> chunks = new HashSet<Coord>();
    13.     List<Action> unsubsribers = new List<Action>();
    14.  
    15.     void OnEnable()
    16.     {
    17.         GetComponent<Voxeland>().OnRebuildEvent += Subscribe;
    18.         Subscribe();
    19.     }
    20.  
    21.     void OnDisable()
    22.     {
    23.         GetComponent<Voxeland>().OnRebuildEvent -= Subscribe;
    24.         Unsubscribe();
    25.     }
    26.  
    27.    // hook into every chunk's meshWorker's Apply event so we can copy and
    28.    // modify the chunk's mesh after it's updated
    29.     void Subscribe()
    30.     {
    31.         Unsubscribe();
    32.  
    33.         foreach (var c in GetComponent<Voxeland>().chunks.All().Where(c => !c.Contains(c.coord))
    34.         {
    35.             var chunk = c; // capture var so it can be passed to delegate
    36.             ThreadWorker.ActionDelegate action = () => ApplyGrassTo(chunk); // create action to handle event
    37.             chunk.meshWorker.Apply += action; // subscribe to event
    38.             unsubsribers.Add(() => chunk.meshWorker.Apply -= action); // provide a means of unsubscribing
    39.         }
    40.     }
    41.  
    42.    // unsubscribe from meshWorker events and clear everything
    43.     void Unsubscribe()
    44.     {
    45.         foreach (var unsub in unsubsribers)
    46.             unsub();
    47.  
    48.         unsubsribers.Clear();
    49.         chunks.Clear();
    50.     }
    51.  
    52.    // Copy's chunk's mesh and removes non-grassy areas, puts grass density
    53.    // into vertex colors and assigns to grassFilter
    54.     void ApplyGrassTo(Chunk chunk)
    55.     {
    56.         Mesh m = chunk.hiMesh;
    57.         var verts = m.vertices;
    58.         var normals = m.normals;
    59.         var tangents = m.tangents;
    60.         var indices = m.triangles;
    61.  
    62.         var added = new Dictionary<Vector3, int>();
    63.         var newVerts = new List<Vector3>();
    64.         var newIndices = new List<int>();
    65.         var newNormals = new List<Vector3>();
    66.         var newColors = new List<Color32>();
    67.  
    68.         for (int i = 0; i < indices.Length; i += 3)
    69.         {
    70.             int i1 = indices[i];
    71.             int i2 = indices[i + 1];
    72.             int i3 = indices[i + 2];
    73.  
    74.             // extract blend values from vertex tangents (>> 4 means second block type, >> 8 for 3rd, etc.)
    75.             // use whatever value corresponds to your grass block type
    76.             // as you can see, block type blends are encoded into the mesh's tangents (kinda cool!)
    77.             float blend1 = (((int)tangents[i1].x >> 4) & 0xF) / 16f;
    78.             float blend2 = (((int)tangents[i2].x >> 4) & 0xF) / 16f;
    79.             float blend3 = (((int)tangents[i3].x >> 4) & 0xF) / 16f;
    80.  
    81.             // only add to grass mesh if all 3 vertices in the triangle are touching a grass block
    82.             if (blend1 > 0 && blend2 > 0 && blend3 > 0)
    83.             {
    84.                 Vector3 vert = verts[i1];
    85.  
    86.                 // vertex already in our new mesh, so just set up faces for it
    87.                 if (added.ContainsKey(vert))
    88.                 {
    89.                     int indexToAdd = added[vert];
    90.                     newIndices.Add(indexToAdd);
    91.                 }
    92.                // vertex not found, so we need to add it to mesh and set up faces for it
    93.                 else
    94.                 {
    95.                     int indexToAdd = newVerts.Count;
    96.                     newVerts.Add(vert);
    97.                     added.Add(vert, indexToAdd);
    98.                     newIndices.Add(indexToAdd);
    99.                     newNormals.Add(normals[i1]);
    100.                     newColors.Add(GetGrassDensity(blend1)); // assign grass density from blend
    101.                 }
    102.              
    103.                // do the same for second and third verts below (3 per triangle)
    104.                 vert = verts[i2];
    105.  
    106.                 if (added.ContainsKey(vert))
    107.                 {
    108.                     int indexToAdd = added[vert];
    109.                     newIndices.Add(indexToAdd);
    110.                 }
    111.                 else
    112.                 {
    113.                     int indexToAdd = newVerts.Count;
    114.                     newVerts.Add(vert);
    115.                     added.Add(vert, indexToAdd);
    116.                     newIndices.Add(indexToAdd);
    117.                     newNormals.Add(normals[i2]);
    118.                     newColors.Add(GetGrassDensity(blend2));
    119.                 }
    120.  
    121.                 vert = verts[i3];
    122.  
    123.                 // grass!
    124.                 if (added.ContainsKey(vert))
    125.                 {
    126.                     int indexToAdd = added[vert];
    127.                     newIndices.Add(indexToAdd);
    128.                 }
    129.                 else
    130.                 {
    131.                     int indexToAdd = newVerts.Count;
    132.                     newVerts.Add(vert);
    133.                     added.Add(vert, indexToAdd);
    134.                     newIndices.Add(indexToAdd);
    135.                     newNormals.Add(normals[i3]);
    136.                     newColors.Add(GetGrassDensity(blend3));
    137.                 }
    138.             }
    139.         }
    140.  
    141.          // create our new grass mesh
    142.         var m2 = new Mesh();
    143.         m2.vertices = newVerts.ToArray();
    144.         m2.triangles = newIndices.ToArray();
    145.         m2.normals = newNormals.ToArray();
    146.         m2.colors32 = newColors.ToArray();
    147.  
    148.          // assign it to chunk's grass filter (which should have your DX11 grass shader on it with vertex density)
    149.         chunk.grassFilter.sharedMesh = m2;
    150.     }
    151.  
    152.    // tightens the grass spread so it is less likely to overlap non-grassy blocks
    153.    // also randomises grass density slightly so grass appears more patchy and realistic
    154.     Color GetGrassDensity(float raw)
    155.     {
    156.         return Color.white * Mathf.Clamp01((Mathf.Pow(raw, 4f) - .1f) * 10f) * UnityEngine.Random.Range(.2f, 1f);
    157.     }
    158. }
    159.  
    Place that on your Voxeland object.

    If you're using infinite terrain, you just need to put ApplyGrassTo inside Chunk.cs and call it in ApplyMesh and make sure you comment out the other grassFilter code in there to ensure our grass doesn't get cleared.
     
    Wright and MarkusGod like this.
  43. Gunsrequiem

    Gunsrequiem

    Joined:
    May 17, 2017
    Posts:
    71
    Perfect! Thank you :)
     
  44. Will-D-Ramsey

    Will-D-Ramsey

    Joined:
    Dec 9, 2012
    Posts:
    221
    So I just bought Voxeland a few hours ago and while looking for tutorials and other documentation I appear to have stumbled upon it leaked here
     
    Last edited by a moderator: Jun 22, 2017
  45. Will-D-Ramsey

    Will-D-Ramsey

    Joined:
    Dec 9, 2012
    Posts:
    221
    Also anyone have any ideas as to how generate caves with the rest of the data proceduraly?
     
  46. Gunsrequiem

    Gunsrequiem

    Joined:
    May 17, 2017
    Posts:
    71
    If you use MM to create the terrain, you can utilize a layer to produce caves procedurally.

    As for how to implement Voxeland biomes, do I use a base Voxeland terrain to import the biomes, or should I use a MM object? Just curious because when I try to add the biome masks from the asset files it doesn't bring over the data. Should I be using a Voxeland object with all the blocks set already? I tried that, but the land keeps switching my land blocks around. I'm sorry to bug you I'm just very new to MM.

    I'm also getting a very high terrace effect with Voxeland--hoping there's some way to reduce this. I know it comes with the territory when using voxels, but reducing it would help add to the terrain's aesthetic appeal. Thanks!
     
    Last edited: Jun 19, 2017
    Kappytn likes this.
  47. Kappytn

    Kappytn

    Joined:
    May 22, 2017
    Posts:
    8
    @Wright
    I just purchased Voxeland and am not totally into the way the landscape looks with the bumps and terrace effects, I wouldn't like my projects to look this way. It doesn't give me the realistic look I aim for like with MM. Is there any way possible to edit an existing MM terrain with Voxeland so I can just put caves into a more realistically smooth terrain? If not, will there be a way to do this in the future?
     
  48. MarkusGod

    MarkusGod

    Joined:
    Jan 10, 2017
    Posts:
    168
    You can try to tweak Relax strenght, iterations and normal smoth in voxeland settings to reduce terrace looking.
     
    Gunsrequiem likes this.
  49. chiefarchon

    chiefarchon

    Joined:
    Jun 22, 2009
    Posts:
    80
    In my game I want to have a scene that the character is teleported to that is an endless cavern. There will be no surface just infinite caves. There should be able to be monsters and structures within this infinite terrain too. Can this be done with Voxeland

    There would be no surface, just an underground world.
     
  50. Gunsrequiem

    Gunsrequiem

    Joined:
    May 17, 2017
    Posts:
    71
    If you're not going to have a surface, I would just use one of the assets that can spawn endless caverns/dungeons procedurally. Voxeland can do it, technically, but I'm not sure that it's guaranteed to go on forever. You may get to a point where it ends due to the procedural method not being a sure thing.