Escape displaced body shells while marching

This commit is contained in:
Meta Vens 2026-05-08 11:52:46 +01:00
commit 0fdbcbbe83
2 changed files with 11 additions and 2 deletions

View file

@ -53,7 +53,9 @@ Current frame order:
Empty froxels skip body SDF work entirely.
5. Displaced body SDFs report a noisy hit distance separately from a conservative
envelope step distance, so high-frequency surface detail can shape the
silhouette without letting rays skip over it.
silhouette without letting rays skip over it. When a ray is inside the
conservative envelope but outside the noisy surface, it takes a shell escape
step instead of starving on the minimum stride.
6. Terrain marching uses heightfield crossing and slope-aware steps instead of
pretending `z - height(xy)` is a true Euclidean SDF. Body objects still use
SDF distance steps.

View file

@ -530,7 +530,14 @@ bool raymarch(float3 rayOrigin, float3 rayDirection, out float3 hitPosition, out
: 0.026;
terrainStep = min(terrainStep * 0.62, max(gridRadius * 0.08, 0.026));
float bodyStep = bodyStepDistance < 99999.0 ? max(bodyStepDistance * 0.68, 0.004) : 100000.0;
float bodyStep = 100000.0;
if (bodyStepDistance < 99999.0)
{
bodyStep = bodyStepDistance > hitEpsilon
? bodyStepDistance * 0.68
: max(bodyDistance * 0.42, 0.045);
}
float distanceToScene = min(bodyStep, terrainStep);
previousTravel = travel;
previousTerrainGap = terrainGap;