Skip to content

unitycoder/UnityVoxelEngine

 
 

UnityVoxelEngine

This is my first voxel implementation in Unity. It is still a work in progress. Image Image

👀 In progress...

🏃 Making generation faster! (This might take a bit)

  • Threading made possible with guidance from Logyrac

Setting it up

There a couple of things you need to set up before a voxel world is created:

  1. Create an empty Game Object. You can call it anything, but something like GenerationManager can help with organization
  2. Add the Generation script to the empty object
  3. Add a Block List, Contentalness To Height spline, Terrain Material, specify whether or not you want to Use Greedy Meshing (it is recommended), and then add the Main Block, Underwater Block, Stone Block , and `Dirt Block
    • The terrain material, TerrainMat is in the Shaders folder
  4. (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

📋 Setting up a Block List

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!

Creating different Block types

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, and DirtBlock. Make sure to place these in the coresponding fields in the Generation inspector

📈 Setting up a Contenentalness to Height spline

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:
Image

About

My first 3D voxel implementation for the Unity game engine [WIP]

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%