Converting Unity terrains to Voxel Play Environment

Modified on Sat, 16 Jun 2018 at 11:33 PM

Voxel Play includes a special terrain generator called "UnityTerrainGenerator" that translates terrain heightmap and its resources (splatmaps, trees and vegetations) to voxel definitions and models (for trees) with a few clicks.


To convert an existing terrain (eg. generated by Gaia or any other terrain generator tool), please watch the video below:





Unity Terrain Generator options



  • Terrain Data: drop here the TerrainData object used by your terrain.
  • Sea Level: adjust the sea altitude level.
  • Thumbnail Size: size for the texture thumbnails below - just useful for presentation in this window.


Terrain Textures


Each terrain texture will produce a Voxel Definition. 

In Voxel Play, terrain voxel definitions are composed of two voxel definitions: one for the surface voxel and another for the underground voxel. The surface voxel uses 3 different textures (one for the top side, a second one for the side textures and a third for the bottom side) while the underground voxel usually uses the same texture around the cube.


  • Texture Size: the size of the generated textures that will be used in the new voxel definitions for each terrain texture.
  • Voxel Top: this property links to the voxel definition for the surface voxel (once it's generated).
  • Smooth: blurs the original texture. Some textures present too much noise when reduced. In the screenshot above, the Texture Size is set to 16 pixels (16x16) which can result in lot of noise so applying smooth can help produce a better looking result.
  • Dirt With: specify the second texture used to mix with to produce the side texture for the surface voxel. Most surface voxels have a side texture that blends between the top texture and the bottom texture.
  • Blend Power: the intensity of the blend between the top and "Dirt With" texture. A value of 0 will result in using only the top texture for the sides of the surface voxel.
  • Voxel Dirt: this is the voxel definition used for the underground voxel (once generated). It uses the texture pointed by the Dirt With option.
  • Action: Create / Assigned or Ignored. Create will generate the two voxel definitions (top and dirt or underground). Assigned means the voxel definitions have been generated and will be used. Ignored means this terrain texture will not produce any voxel definition.


Trees



Each tree will produce a Model Definition which contains a collection of voxels of different types. The converter will produce on voxel definition per each material included in the tree prefab.


  • Texture Size: the size of the generated textures that will be used by the new voxel definitions used in the tree model definition.
  • Frond Density: the "opacity" of the frond textures. Frond or leaves textures use CutOut shaders so the density related to the amount of "holes" in these textures. A lower value means less density hence more holes.
  • Tree Scale: an optional scale that's applied to the tree prefab before converting it to voxels (the original tree prefab is not modified).
  • Model Definition: the resulting model definition.
  • Smooth: blurs the original texture. Some textures present too much noise when reduced so smoothing the texture can help produce a better looking result.
  • Action: Create / Assigned or Ignored. Create will generate the tree model definition. Assigned means the model definition has been generated and will be used. Ignored means this tree will not produce any model and won't be used.


Vegetation


Similarly to terrain voxels, the converter creates one voxel definition for each vegetation texture used in the terrain.



  • Vegetation Density: the probability to place a vegetation of this type on the proper terrain position. A value of 1 will match the vegetation density of the original terrain. Reducing this value will produce clear areas.
  • Texture Size: the size of the generated textures that will be used in the new voxel definition.
  • Voxel Definition: the voxel definition for this grass texture, once it's been generated.
  • Action: Create / Assigned or Ignored. Create will generate the vegetation voxel definition. Assigned means the voxel definition has been generated and will be used. Ignored means this vegetation will not produce any voxel definition and won't be used.



Remarks


Please note that the UnityTerrainGenerator tries to approximate the look of the original terrain. The elements to consider are:


- Heightmap: the original heightmap will be used so no differences here.

- Sea Level: you need to adjust the water level in the Terrain Generator field, just under TerrainData field (shown above).

- Textures: the textures generated by the converter can be fully replaced by you. Just select the voxel definitions generated by the generator and assign or supply your own textures to match your style and preferences.



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article