home/ atoms/ bounding-volume-sdf-optimization

A cheap bounding primitive tested first can skip the full SDF evaluation for the majority of ray steps

Complex characters (creature body + arms + head + wrinkles + ears) have expensive SDF evaluations. For most ray steps outside the creature, only the simpler floor/terrain SDF needs evaluation. A bounding volume test (e.g. inflate the body ellipsoid by 1–2 units) runs first; if the point is farther than the bound from the creature, skip the full character SDF entirely. This can 2× or more reduce per-step cost. The bounding volume must fully contain all creature parts including dynamic arm positions. A bounding plane (y=3) terminates rays that escaped above the scene.

Examples

float bound=sdEllipsoid(p-center, bodyRad+1.5); if(bound<thr) creature=evalCreatureSDF(p);

Assessment

An optimized shader uses a bounding sphere of radius 1.5 around a character. The character’s outstretched arm reaches 1.7 units from center. Describe the visual artifact that will occur and how to fix it.

“inflate it a little bit, to make sure that it embeds everything in the creature, including the arms and the head, and use that inflated body ellipsoid as bounding volume”
corpus · inigo-quilez-live-coding-happy-jumping-video · chunk 31