Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep a small history of 'light counts' for each cluster used for sampling lights (for #226) #234

Merged
merged 5 commits into from
Dec 6, 2022

Conversation

res2k
Copy link
Contributor

@res2k res2k commented Jul 17, 2022

This is a different approach at addressing #226 after the changes #227 fell short in other scenarios.

I introduced a small history of "cluster light counts" used for light selection.
Now, if light sampling is performed with an "old" RNG seed, we can pull out the light count used at that time from that history we're keeping around (based on the frame number, which is conveniently stored in the RNG seed as well).

This seems to work quite well - it fixes both the problem from #226 but crucially doesn't seem to make things worse if the number of lights in a cluster changes, as previously visible in e.g. the single-player entrance of the security map.
(Actually, I'd like to argue that security looks better now, as now the "flashing" at the start, due to jumps in the max light count, is completely absent with this change!)

Other changes:

  • Since we don't need the "max light count" any more, cluster lights are tightly packed (again)
  • The frame number was almost already contained in the RNG seed; I changed it to contain the unadulterated frame number, and for that I packed it a bit "tighter" as well.

res2k added 5 commits July 17, 2022 20:26
…ect_model_lights()

...but still keep track of the max. number of lights, upload those to the light buffer,
and have sample_polygonal_lights() explicitly use those.
Make room for that extra bit by using few less bits for the x/y values
crammed in there as well.
(And replace magic shift values with constants while we're at it.)
…ling lights

...instead of just always using the 'max' number seen.
@res2k
Copy link
Contributor Author

res2k commented Dec 4, 2022

@apanteleev Ping?

@apanteleev apanteleev merged commit 5bc0736 into NVIDIA:master Dec 6, 2022
@apanteleev
Copy link
Collaborator

Merged - thank you.

And apologies about the long delay... I was mostly focusing on Portal with RTX in the last few months.

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