syuilo
April 16, 2026, 4:20am
1
When using a shadow generator with a refresh rate set in Snapshot Rendering, the rendering flickers and the following error is displayed in the console:
I attempted to reproduce this in the Playground but was unable to trigger the error. However, I was able to reproduce the rendering glitch.
here is the repro: Babylon.js Playground
Off topic:
Is there any point in setting the refresh rate for the shadow generator in Snapshot Rendering?
Even if there isn’t, in my use case, I need to dynamically toggle Snapshot Rendering on and off, so changing the refresh rate setting every time is cumbersome.
Thank you for this great framework!
I don’t get any error from your PG?
syuilo
April 16, 2026, 7:37am
3
Thank you for reply.
It seems the issue occurs randomly. Would setting the refreshRate value to 30, for example, help reproduce the issue?
syuilo
April 16, 2026, 7:40am
4
Recording of the reproduction:
Thanks, I was able to repro after refreshing the page.
I’m going to investigate.
1 Like
This PR will fix the problem:
master ← Popov72:fix/snapshot-rendering-refreshrate-desync
opened 08:42AM - 16 Apr 26 UTC
## Description
Fixes flickering when a shadow generator with a non-default `ref… reshRate` is used under WebGPU snapshot rendering.
**Root cause:** WebGPU snapshot rendering records GPU render pass bundles during one frame, then replays them by index on subsequent frames. `ObjectRenderer.shouldRender()` uses a counter to skip rendering based on `refreshRate`. If the counter state differs between the recording frame and a playback frame, the render pass topology changes and bundle list indices become misaligned -- causing the main scene pass to replay the wrong bundle (or none), resulting in flickering.
**Fix:** `ObjectRenderer.shouldRender()` now returns `true` when `engine.snapshotRendering` is active, ensuring consistent render pass topology. During playback the RTT isn't truly re-rendered (bundles are replayed), so the cost is minimal. The refresh counter is frozen during snapshot mode and resumes correctly when snapshot rendering is disabled.
**Testing:**
- Unit tests added for `ObjectRenderer.shouldRender()` covering normal refresh rate behavior, snapshot override, and counter freeze/resume.
Forum report: https://forum.babylonjs.com/t/63183
Repro playgrounds: https://playground.babylonjs.com/#BX2Y9K#0 / https://playground.babylonjs.com/#BX2Y9K#1
1 Like
syuilo
April 16, 2026, 8:43am
9
It looks like you posted your comment in the wrong place
I think the correct link is here:
Hey I’m integrating selection outliner in Babylon.js Editor and I noticed a small bug.
When creating an instance of a mesh which contains LODs, the outline disappears when the first LOD level awakes. This behavior is the same when outline is applied on source mesh or the instance ifself. If you remove the instance, you’ll see that everything works fine
Link to the playground, unzoom to trigger new LOD levels and you’ll see the outline disappears: https://playground.babylonjs.com/#QE7KM#246
Th…
1 Like
Yes, sorry, I fixed the link above!
1 Like
syuilo
April 16, 2026, 8:47am
11
Thank you for your quick fix!