WebGPURenderer: Fix compileAsync() with target scenes.#32530
WebGPURenderer: Fix compileAsync() with target scenes.#32530sunag merged 1 commit intomrdoob:devfrom
compileAsync() with target scenes.#32530Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
| // | ||
|
|
||
| this._background.update( sceneRef, renderList, renderContext ); | ||
| if ( targetScene !== scene ) { |
There was a problem hiding this comment.
@sunag This new code block makes sure the correct scene reference is used but it turned out that precompiling scene's with environment maps as backgrounds did not work in general with WebGPURenderer.
The root cause is this._handleObjectFunction. This function is overwritten in compileAsync() with a stripped down version of _renderObjectDirect() that just prepares resources like bindings and pipelines for rendering. However, when 3D objects perform nested renderings like the background mesh, the override of this._handleObjectFunction breaks the related rendering. Meaning the background is unable to convert the equirect env map to a cube map.
I have changed the renderer such that this._handleObjectFunction does not apply to nested rendering. It is always resetted to _renderObjectDirect() in renderScene().
Fixed #32523.
Description
When
compileAsync()is used with a target scene, the background must be updated with this scene to honor the respective fog, environment and background settings. Unlike with lights, background settings can not be additive. MeaningcompileAsync()must update the background either with scene to compile or the target scene.