Something huge is coming to Threejs. Today I achieved an N-tile shadow render in a single draw call using RenderBundle, Depth 2D Array FBO, and CameraArray.
Basically, here one draw call and one command renders and stores shadows for 16 different parts of the scene.
Basically, here one draw call and one command renders and stores shadows for 16 different parts of the scene.
Comments
On the right, a real-time 16K split in 16 sections shadow map takes an extra 4ms. Now consider this technology with CSM and dynamic tiling logic.
From 16 to 268 millions px!π€©
And trying to tile the classic way would require rendering the scene 16 times, not to mention the bind limit of 16 samplers per shader stage, which would conflict with other maps.
I went way too far, lol.
Then the idea for CSM would be to split it into like 4 depth textures arrays of decreasing width and height, based on the distance to the camera?
Also I think CSM just renders four 4K maps with incrementally increasing surface coverage, so same.
Anyway I got you now, thanks for the explanation (and thanks to @gnikoloff.bsky.social as well).
Using render bundles for shadow maps has been on my to-do list for a while. I definitely need to try that.
You can achieve this with vertex amplification as well, which WebGPU sadly does not support AFAIK.
https://toji.dev/webgpu-best-practices/render-bundles.html