-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Optimize lightmapper using triangle clusters on the acceleration structure. #83284
Optimize lightmapper using triangle clusters on the acceleration structure. #83284
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, it works as expected.
With quality set to Ultra and denoiser disabled, these are the bake times on the scene below on an i9-13900K + RTX 4090 on Linux:
master |
This PR |
---|---|
54 seconds | 26 seconds |
Visuals are identical.
Testing project: test_lightmap_preview_bake_4.x.zip
The scene has 52k vertices and 86k triangles according to Blender, which is relatively low by modern standards.
…cture. Add an additional layer of indirection to the grid used by the lightmapper to store fixed-size triangle clusters. Greatly speeds up baking times on scenes with high triangle density, as the clusters will help to avoid unnecessary checks when the triangle density is high on the scene.
8c44b33
to
47214ea
Compare
Rebased to fix conflicts with indirect bounces PR that just got merged, taking it out of drafts for further testing. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Re-ran the test (with higher quality settings) with the rebased version, the performance differential remains pretty much the same in the Unreal Sun Temple.
|
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me!
Let's go ahead and merge this for 4.2 as it is a small change that has big benefits.
In light of the many changes to lightmapping this release, let's not try to cherrypick it though
Thanks! |
Originally suggested by @reduz in this post.
Add an additional layer of indirection to the grid used by the lightmapper to store fixed-size triangle clusters. Greatly speeds up baking times on scenes with high triangle density, as the clusters will help to avoid unnecessary checks when the triangle density is high on the scene.
Unreal Sun Temple (from #75440).
Sponza
So far I haven't been able to see if this introduces any errors as the results look identical to me (which is good news as the results would be invalidated otherwise). We should double check as much as possible that nothing breaks before we're sure we want this merged.
Feel free to test it out if you get similar reductions in baking speed and ensuring nothing breaks. Don't expect much gains in scenes with low geometry density, as the optimizations are oriented entirely around reducing ray-triangle intersections in scenes where there was a significant amount of triangles per cell.