This is my first voxel implementation in Unity. It is still a work in progress.
🏃 Making generation faster! (This might take a bit)
- Threading made possible with guidance from Logyrac
There a couple of things you need to set up before a voxel world is created:
- Create an empty Game Object. You can call it anything, but something like GenerationManager can help with organization
- Add the Generation script to the empty object
- Add a
Block List
,Contentalness To Height
spline,Terrain Material
, specify whether or not you want toUse Greedy Meshing
(it is recommended), and then add theMain Block
,Underwater Block
,Stone Block
, and `Dirt Block- The terrain material,
TerrainMat
is in theShaders
folder
- The terrain material,
- (Optional) Input whatever you want for your seed in the
Input Seed
field! This can be a int or a string. A float will be converted to a string.- If left blank, a random seed will be generated
In the Blocks
folder, right click, Create > VoxelStuff > BlockList you can name it whatever you like (Recomended: BlockList)
Now you can add block types to the Blocks
field in the block list!
In the Blocks
folder, right click, Create > VoxelStuff > Block you can name it whatever you like (Recomended: [BlockName])
As of right now, there is only one field: Vertex Color
. This is the color the voxel will apear in the world
- Create a
GrassBlock
,SandBlock
,StoneBlock
, andDirtBlock
. Make sure to place these in the coresponding fields in the Generation inspector
In the Splines
folder, right click, Create > VoxelStuff > Spline you can name it whatever you like (Recomended: ContenentalnessToHeight)
In the Spline field, you can manipulate the spline to represent how terrain height will respond to "contentalness" (the perlin noise values)
- The spline have x-values going from 0-10, and y-values going from 0-100
- Imagine the x-value of 0 as the bottom of the ocean
- y = 20 is coastline
Below is a good example for a Contentalness to Height spline: