Hi there Unity3D. I’m a student working on my FYP, and I decided to tackle a bit more than I set out to. As this isn’t intended to be an “original” project or IP, I decided to attempt a Minecraft clone in the hopes to bring my Unity knowledge past what it is.
As of now, I have procedural world generation created, the ability to place blocks, mine them (and pick up the mined blocks), a basic inventory with GUI and block selection, generated trees (though buggy still), and some other features. However, the biggest problem is performance.
I have researched extensively into greedy meshing and occluding unseen cube sides, however it goes slightly over my head. What I need help with is advice on how to better optimise my engine upon world generation. I followed tutorials and open source code for my world generation since I’m completely new to it, so I’ll add the code below.
So some of the things I have tried are:
- Occluding blocks that aren’t seen using a basic culling script [link]
- Reducing render distance of my chunk (however I really want to raise it)
- Reducing FOV
- Optimizing textures and cubes (using less quaded cubes, in place for cube primitives)
- Locking frame rate
- Some other minor improvements
What I need help with is:
- Potentially converting the generated cubed world into a mesh (greedy meshing
- Allowing the user to still mine the individual elements once the mesh is rendered
- Hiding unseen faces
- Any other possible performance tips when it comes to creating a voxel engine.
The scirpts used to create the world generation are:
[Chunk.cs]
A lot of this code comes from tutorials and/or things I found when researching world generation. However as I say, this is all a learning experience. Any help on how to optimise this or implement a system whereby the engine is only rendering seen faces and/or some form of greedy meshing funtionality would be extremely helpful and aid me in learning more. Any help is massively appreciated, thanks guys!