Skip to content

add light identity resolve to fix sparse reuse problem - #44

Open
DQLin wants to merge 3 commits into
NVIDIA-RTX:remixfrom
DQLin:light-identity-fix
Open

add light identity resolve to fix sparse reuse problem#44
DQLin wants to merge 3 commits into
NVIDIA-RTX:remixfrom
DQLin:light-identity-fix

Conversation

@DQLin

@DQLin DQLin commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

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).

@YaobinOuyang YaobinOuyang left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just leave some comments

prevReservoir.lightIdx = RTXDI_INVALID_LIGHT_INDEX;
prevReservoirValid = RAB_ResolveReservoirLightIndex(prevReservoir, exactIndexMatch);
}
else

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the light identity match and light index translation cannot work at the same time? I see if else structure here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants