8000 Single-pass IBL shadow voxelization for WebGPU by MiiBond · Pull Request #17270 · BabylonJS/Babylon.js · GitHub
[go: up one dir, main page]

Skip to content

Conversation

MiiBond
Copy link
Contributor
@MiiBond MiiBond commented Oct 10, 2025

This changes the voxelization strategy for WebGPU to allow it to be done in a single pass (though, generation of mips still takes additional steps). This is possible using textureStore to write to arbitrary texels in a 3D texture. It also uses vertex pulling to correctly determine the provoking vertex for each triangle and retrieve adjacent vertices so that we can calculate the triangle's normal. This is used to swizzle the xyz components to maximize the rasterized area and not miss voxels.

Anywho, this makes updating shadows for animated meshes much more plausible. I'm not sure the best way to do this but currently, in my playground, I'm doing this:

const frameSkip = 1;
let frame = 0;
scene.onAfterAnimationsObservable.add(() => {
    if (enableIblShadows) {
        if (frame == 0 && scene.animatables.find((anim) => !anim.paused)) {
            iblShadowsPipeline.updateVoxelization();
            iblShadowsPipeline.resetAccumulation();
        }
        if (frame === frameSkip) {
            frame = 0;
        } else {
            frame++;
        }
    }
});

Is there a better way to query whether there is currently an animation happening?

@bjsplat
Copy link
Collaborator
bjsplat commented Oct 10, 2025

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@bjsplat
Copy link
Collaborator
bjsplat commented Oct 10, 2025

@bjsplat
Copy link
Collaborator
bjsplat commented Oct 10, 2025

@bjsplat
Copy link
Collaborator
bjsplat commented Oct 10, 2025

@bjsplat
Copy link
Collaborator
bjsplat commented Oct 10, 2025

@bjsplat
Copy link
Collaborator
bjsplat commented Oct 10, 2025

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

0