Skip to content

PMREMGenerator: Add fromSceneAsync()#29951

Merged
sunag merged 2 commits intomrdoob:devfrom
sunag:dev-pmrem-rev
Nov 24, 2024
Merged

PMREMGenerator: Add fromSceneAsync()#29951
sunag merged 2 commits intomrdoob:devfrom
sunag:dev-pmrem-rev

Conversation

@sunag
Copy link
Copy Markdown
Collaborator

@sunag sunag commented Nov 23, 2024

Related issue: #29942

Description

Based on the PR we can see that the webgl_animation_keyframes example emits a lot of error messages that may not make much sense to the user and it doesn't load the IBL properly.

image

This is because PMREMGenerator is being used without the WebGPU Backend being initialized. This PR aims to improve the error messages by guiding the user to replace functions like pmremGenerator.fromScene() with pmremGenerator.fromSceneAsync().

After this PR.

image

The user can fix it using:

scene.environment = ( await pmremGenerator.fromSceneAsync( new RoomEnvironment(), 0.04 ) ).texture;

image

@sunag sunag added this to the r171 milestone Nov 23, 2024
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Nov 23, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 339.13
79
339.13
79
+0 B
+0 B
WebGPU 483.69
134.01
484.71
134.2
+1.02 kB
+191 B
WebGPU Nodes 483.16
133.9
484.18
134.1
+1.02 kB
+192 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 464.59
111.96
464.59
111.96
+0 B
+0 B
WebGPU 550.99
149.23
552.01
149.42
+1.02 kB
+194 B
WebGPU Nodes 506.87
138.94
507.89
139.13
+1.02 kB
+192 B

@sunag sunag marked this pull request as ready for review November 24, 2024 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant