Hello (and happy new year),
I find global distance field trace can sometimes cause light leaking when two objects are close to each other. And after some research I found it’s caused by surface cache sampling error. For example in the image below, the radiosity probes rays (and also visualization rays in debug view) that intersected with the cube mistakenly sample surface cache from outside the wall.
[Image Removed]
I look into the code and get quite confused about the math behind surface cache sampling bias. I notice DISTANCE_FIELD_OBJECT_GRID_CARD_INTERPOLATION_RANGE_IN_VOXELS is 3.0f, which seems too high under this circumstance. I know that during tracing the objects will be expanded at most one ClipmapVoxelExtent, so 2.0f seems to be a more reasonable value to reject those out-of-card hits here:
[Image Removed]
I notice the interpolation range was raisen from 2.f to 3.f in a history commit 196daca “Lumen Software Ray Tracing - improved global distance field hit evaluation”. Wonder what the case was then? Were there other leaking issues for 2.f? And I also notice not all changes in the commit are respected today, e.g. the CardSampleWorldPosition is not actually used anymore.
[Image Removed]
[Image Removed]Also I am quite confused by the visibilty weighting math below. It seems both NormalizedHitDistanced and TexelDepth are scaled into the [0, 1] range, but not the BiasThreshold.
[Image Removed]
TBH I feel like use BiasFalloff to compare with the depth diff feels like more reasonable -- BiasFalloff = BiasThreshold x 0.5 (so it becomes truely the distance field expansion amount) x 0.5 (to be normalized into the [0, 1] depth range). Not sure if this is a typo or something.
[Image Removed]
Thanks for any help!
Sicong
[Attachment Removed]