Skip to content

WebGPURenderer does not detect dynamic light addition/removal #30044

@Sicndu

Description

@Sicndu

Description

When using WebGPURenderer, dynamically adding or removing lights in the scene does not update the lighting effect on objects in the viewport. While the changes are reflected in the scene graph (verified through debugging), there is no visual update.

In contrast, WebGLRenderer handles dynamic lighting updates automatically without requiring manual intervention (e.g., setting needsUpdate = true for materials). This functionality seems to be missing in the current WebGPURenderer implementation.

I discussed this issue in the Three.js Discourse forum, and it was pointed out that this functionality is not currently present in the WebGPURenderer. It would be great to know:
• If this feature is planned for future versions.
• If there are any workarounds for achieving this with the current implementation.

Thank you for considering this issue!

Reproduction steps

1.Create a scene using WebGPURenderer.
2.Dynamically add or remove lights (e.g., DirectionalLight).
3.Observe that the scene graph updates correctly, but the visual output remains unchanged.

Code

function addLight() {
  const light = new THREE.DirectionalLight(0xddffdd, 3);
  light.name = "DynamicLight";
  light.position.set(5, 5, 5);
  scene.add(light);
}

function removeLight() {
  const light = scene.getObjectByName("DynamicLight");
  if (light) {
    scene.remove(light);
    light.dispose?.();
  }
}

// After calling addLight() or removeLight(), the scene doesn't update visually.

Live example

Here are related JSFiddle examples for testing the issue:
jsfiddle-dev WebGLRenderer (dynamic lighting works)
jsfiddle-dev WebGPURenderer (issue exists)

For comparison, the WebGL examples demonstrate expected behavior where dynamic light addition/removal is automatically detected. However, in the WebGPU examples, these updates are not reflected in the rendered scene.

Screenshots

No response

Version

r171

Device

Desktop

Browser

Chrome

OS

MacOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions