13
\$\begingroup\$

I am in the process of developing a Minecraft-like world where the terrain is divided into voxels. However, I would also like for unstable configurations of landscapes to collapse predictably. For example, an overhang that is too heavy would fracture and break off at 'high stress' voxels, as would a pillar formation with an asymmetrically eroded base. I was thinking about adding a 'stress vector' field to each voxel in the terrain, and doing the following (pseudocode):

foreach voxel in terrain
    foreach neighbor in voxel.neighbor_voxels()
        if magnitude(voxel.stress - neighbor.stress) > stressThreshold
            detach_voxels(voxel, neighbor)

But the problem is that I don't know how I would go about calculating these individual stresses. Is there some kind of FEA-based algorithm specialized for voxel discretizations that I can use to calculate the stresses on a per-voxel basis? Or am I approaching this all wrong and there's some other way to do this?

\$\endgroup\$
1
\$\begingroup\$

You may consider a DFS search of all of the connected voxels and determine the voxel that is the single most depended on or "branched" from. And then run your nice little pseudo code. :)

\$\endgroup\$

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.