Skip to content

WebGPURenderer: compileAsync ignores the target scenes fogNode #32523

@SebastianTusk

Description

@SebastianTusk

Description

Renderer.compileAsync is advertised as asynchronously compiling materials. It actually does this only partially as some settings from the target scene aren't handled. One if them is Scene.fogNode and consequentially also Scene.fog. If the material is then later used it includes the fogNode and everything compileAsync did is obsolete. Without fog in the target scene it works as intended. Scene.environment is affected the same way.

There is some special handling for lights by including them from the target scene. Something like this might be necessary here too.

Reproduction steps

  1. Use the WebGL backend. WebGPURenderer({ forceWebGL: true })
  2. Have a scene with fogNode.
  3. Watch WebGLBackend._completeCompile with a breakpoint.
  4. Use await renderer.compileAsync(object, camera, targetScene).
  5. Add object to scene.
  6. Observe WebGLBackend._completeCompile being called twice for the same object and material.

Code

// code goes here

Live example

https://jsfiddle.net/Ljskxp1d/

Screenshots

No response

Version

0.181.2

Device

Desktop

Browser

Chrome

OS

Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions