r/GraphicsProgramming • u/H0useOfC4rds • Apr 16 '26
Video Real-time Path Tracing of 100000 Dynamic Cubes
Stress testing my path tracer's capability to handle dynamic objects. For this test, 100k cube instances are dynamically moved each frame, requiring frequent TLAS updates. Typically, TLAS updates can be split into refit and rebuild. In this test, only refitting results in severe tracing performance degradation, which is why the tlas is rebuilt after ~2s of refitting.
10k of the cube instance are assigned a emissive material. The path tracer uses a light tree to improve NEE, and this helps especially in a scene like this. As the light tree is CPU-built, it's not feasable to update it in the main thread as it takes ~0.1-0.5s per TLAS build. Currently, the engine uses a thread pool to update the TLAS and potentially BLASes (in case of instance specific brightness changes or startup build).
Compared to my previous posts, i tested this on a 4060 laptop, which is roughly 10x slower than a 5090. To keep the framerate above 30 fps, DLSS RR quality preset and 2x frame gen are used.
If you are interested to test it out yourself, check out https://github.com/ML200/RoyalTracer-DX
92
u/ComputationallyBased Apr 16 '26
What a time to be alive! :D
56
u/Firm-Concentrate5967 Apr 16 '26
No. I won't hold on to my papers
12
9
5
u/TibRib0 Apr 16 '26
I can’t believe this is raytraced, almost on par with rasterization performance with such an amount of objects. I am not a graphics programmer but I think Pete shirley would be proud
2
u/HasGreatVocabulary Apr 17 '26
this post made me realize that all the mad stuff I've been trying just to get my gpu instanced unity cubes to do shadows was under the incorrect assumption that it's a trivial task
(trying to run on quest 2 at 72 fps with 50k+ independently scalable / movable cuboids using Graphics.renderprimitives, I have the cubes, but the shadowpass and motion vectors have been too complex for my brain even with ai help)
1
1
u/SnurflePuffinz Apr 20 '26
this is oddly pretty, it reminds me of BioShock.
why don't you add some music and make something out of this?
1
Apr 18 '26
[removed] — view removed comment
1
u/H0useOfC4rds Apr 18 '26
This example is on a laptop 4060, and some random intel cpu. Ive since improved performance and quality even more, should run faster now.
16
u/DeviantPlayeer Apr 16 '26
I think I need to revisit my project and finish it finally.
Btw, could you explain in short how your boiling filter works?