How does No Man's Sky break apart terrain when you harvest it?

This is my first time posting here on the Unity forums, but I have been racking my brain and googling everything I could think of to figure this out for a while now… I eventually want to create a mining system similar to No Mans’s Sky’s but first I need to understand how it is that they cause whole mountains within the terrain to break down and reshape as you mine into it. Does the mining laser directly reshape and scale the mesh vertices of the mountain/terrain’s game object in relation to the point of impact from the mining laser or what? And if so, how do they do it?

Please help

As far as I know, there are 2 ways to achieve this:

  1. compute shaders (gpu)
    MinimalCompute/Assets at master · cinight/MinimalCompute · GitHub

  2. Voxel system using ECS (multi core CPU)
    GitHub - keijiro/Voxelman: Unity DOTS/ECS example

this is the idea,

there are many free alternatives too, search for unity marching cubes or voxel terrains.
(not all have ready to use modify terrain features though)

1 Like

Yes, marching cubes algorithm can be used in compute shaders. I found this sample project https://github.com/keijiro/ComputeMarchingCubes

Also if you are planning to use voxel system in your game, I encourage you to create your own system in order to be able to control it.

Here is another one Unity project implementing marching cubes GitHub - luizppa/game-dev-techniques: 🎮 A collection of game development algorithms and techniques

1 Like