Function onCsmReceiverUpdate
-
Parameters
- sg: ShadowGenerator
A cascaded-shadow generator from createCsmDirectionalShadowGenerator.
- cb: (data: Float32Array) => void
Receiver-sync callback.
Returns () => void
A disposer that unregisters this callback.
- sg: ShadowGenerator
Register a callback fired each frame the CSM cascades are recomputed, right after the receiver UBO is updated and uploaded — and before the shadow map and main pass are rendered.
Custom
ShaderMaterialreceivers that mirror the cascade transforms into their own uniforms (rather than binding the generator's receiver UBO directly, as the built-in standard/PBR/node receivers do) MUST sync from inside this callback. Syncing from anonBeforeRendercallback reads the previous frame's transforms — a one-frame lag that makes those shadows visibly swim while the camera moves (the cascade window can slide many texels per frame during a zoom).Multiple receivers may register on the same generator; every registered callback is invoked each frame. The callback receives the 80-float receiver UBO (layout: four
mat4x4cascade transforms,viewFrustumZ,frustumLengths,shadowsInfo,csmParams— see the cascaded-shadow architecture doc). The array is reused each frame; copy what you need.