0
\$\begingroup\$

Meet my octree world:

enter image description here

My end goal is to have this world destructible, and I am having an issue warping my head around how this can be done when you have LOD. The basic principle of LOD (as I understand it) is to collapse nodes that are further away from the camera (removing them from RAM completely), and divide nodes that are closer (allocating new memory in RAM), by doing this you only have X amount of memory allocated at once.

The issue arrives when you think about how to generate the LOD back after collapsing the tree. The only way I can think of is to use the same Noise function to sample the tree at the node you are dividing (like in the initial generation of the world) and use that to figure out how the children of the tree need to look.

But what happens when a user has modified that node beyond the Noise function? How can you collapse the tree and then divide it down again while restoring the user's modifications?

(Is the only way to keep separate track of all voxels changed by the user?)

That's all folks, thanks :)

(Language: C++)

\$\endgroup\$
3
\$\begingroup\$

The primary goal of LOD is to reduce the cost of drawing by not drawing unnecessarily fine detail. It is not usually about discarding information from RAM. In fact, in a conventional polygonal-model art style, it may mean using more memory to have low-detail and high-detail models ready to use as the camera moves.

In your case, since you have destructible terrain, you must either not use lower detail levels for modified areas, or generate low detail levels from the modified terrain. This is analogous to generating mipmaps automatically for a texture, only in 3D. Neither of these lets you discard the full-detail state from the octree — that is always needed, since players should be able to leave and come back to the same changes they made.

If you have a large modifiable world and you want to limit the amount of RAM used to a specific maximum, you must save the modifications to disk and load them back as the player(s) move about the world, like Minecraft does. This component of the system is entirely separate from rendering LODs.

\$\endgroup\$
2
  • \$\begingroup\$ So basically the best way is to save the changes to the world and apply them on top of the noise function? and you are right I misunderstood LOD \$\endgroup\$ Mar 12 at 18:36
  • \$\begingroup\$ @AmitAssaraf "Best" depends on the details of the situation — for example, if you have a very costly terrain generation you might want to save that too even if there are no changes — but that's what I meant, yes. \$\endgroup\$
    – Kevin Reid
    Mar 12 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.