Skip to content

WebGPURenderer: WebGL2 backend: moving directional light causes shadow flickering #30066

@srfall

Description

@srfall

Description

I am using a DirectionalLight and update its position when the camera has moved. This works fine with the WebGlRenderer, but I try the same thing with the WebGPURenderer (in Firefox), every time the light is moved, the shadows glitch. I would expect the same behavior in the WebGL2 fallback as when directly using the WebGlRenderer.

Reproduction steps

  1. Copy / open the two shadowmap examples for WebGl and WebGPU
  2. Insert e.g:
scene.add(dirLight.target);
const cameraLightOffset = new THREE.Vector3().copy(camera.position).sub(dirLight.position);
controls.addEventListener('change', () => {
    dirLight.position.copy(camera.position).sub(cameraLightOffset);
    dirLight.target.position.copy(controls.target);
});

or any other code that updates the dirLight position when the camera position changes.

  1. Notice that the shadows look fine in the webGL version, but in the WebGPU->WebGL2 fallback version, they glitch

Code

// see live example

Live example

Screenshots

No response

Version

r171

Device

Desktop

Browser

Firefox

OS

Windows

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions