Voxel Terrain Part 3 - Dynamic Components
Took some time to figure out the best approach to do this but I've got it now.
To start with I created components that are all the same size. I am using 16x16x16 components. The voxel terrain is 128^3 so dividing that evenly is 8^3 components. In this image there is 512 of them. The red are inactive and the green are active (they have a model the represents the surface). This posed a problem for very large terrains. I would need a component size small enough so that LOD and real-time editing are fast but too small and the component count would become unmanageable.
So I made an option to create dynamic components.
This means instead of a component being exactly 16m cubed in size (the lowest LOD level would have 4 vertices and two triangles for a flat plane) it would now be resized to have a mesh that is 16 nodes cubed (16x16 vertices for a flat plane regardless of LOD level). Which mean it now looks like this;
Instead of 512 components there is only 36 and 10 of them are active. It means I can lower the component size to something really small like 8x8x8 or even 2x2x2. I can experiment with this to find a balance between speed of LOD updates and editing updates.
And the terrain can be represented by a minimum of 1 component. It also means I can try creating steaming voxel terrain which would be fun!
I need to finalise the real-time LOD system to work with this and then I can begin making large terrains and test it's performance.