add light identity resolve to fix sparse reuse problem - #44
Conversation
| prevReservoir.lightIdx = RTXDI_INVALID_LIGHT_INDEX; | ||
| prevReservoirValid = RAB_ResolveReservoirLightIndex(prevReservoir, exactIndexMatch); | ||
| } | ||
| else |
There was a problem hiding this comment.
So the light identity match and light index translation cannot work at the same time? I see if else structure here.
There was a problem hiding this comment.
Yes. There is actually a light index translation inside RAB_ResolveReservoirLightIndex as a backup case for dynamic lights (because the hash is position-dependent). The main reason that a if-else is used here is that we don't know which reservoirs were active last frame. So we cannot guarantee that translate light index gives correct result.
|
|
||
| RAB_Surface virtualTemporalSurface = temporalSurface; | ||
| #if !RTXDI_NO_PORTALS | ||
| if (state.portalIdx != RTXDI_INVALID_PORTAL_INDEX) |
There was a problem hiding this comment.
The portal handling code should be independent from the multiple frame light ID match code. What it's doing here is to calculate the virtual surface with respect to portal space. It's still needed when you are matching light ID across multiple frames.
Fix RTXDI direct-lighting flicker on light add/remove under sparse rendering (+ skip inactive pixel for temporal reuse) by storing a stable 64-bit light identity in the reservoir's unused data1.zw and resolving a stale lightIdx via a per-frame identity->index table. Gated to sparse rendering with inactive-pixel reuse off; all other modes keep the original path (no behavior/cost change, no reservoir growth).