Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXRExporter: Add support for WebGPURenderer. #29302

Merged
merged 1 commit into from
Sep 3, 2024
Merged

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Sep 3, 2024

Related issue: #29295

Description

To make EXRExporter work with WebGPURenderer, it is required to make the parse method async.

Besides, the readback did not initially work as expected for both backends. In WebGPUTextureUtils is was required to change the typed array type to Uint16Array for FP16 formats. WebGLTextureUtils required a fix in _getBytesPerTexel() since the method did not account for the data type so far.

Copy link

github-actions bot commented Sep 3, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 685.1 kB
169.6 kB
685.1 kB
169.6 kB
+0 B
+0 B
WebGPU 821.7 kB
220.6 kB
822 kB
220.6 kB
+254 B
+40 B
WebGPU Nodes 821.3 kB
220.5 kB
821.5 kB
220.5 kB
+673 B
+132 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 461.9 kB
111.4 kB
461.9 kB
111.4 kB
+0 B
+0 B
WebGPU 522.1 kB
140.7 kB
522.4 kB
140.8 kB
+254 B
+53 B
WebGPU Nodes 478.8 kB
130.5 kB
479 kB
130.6 kB
-43.09 kB
+52 B


}

renderer.readRenderTargetPixels( rtt, 0, 0, info.width, info.height, dataBuffer );
Copy link
Collaborator Author

@Mugen87 Mugen87 Sep 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gkjohnson My plan was to use WebGLRenderer.readRenderTargetPixelsAsync() here as well but using it produces a WebGL feedback loop warning when exporting the PMREM in misc_exporter_exr. The screen also gets black.

misc_exporter_exr.html:1 [.WebGL-0x128005ba800] GL_INVALID_OPERATION: Feedback loop formed between Framebuffer and active Texture.

I did not find the root cause so far so the WebGLRenderer code path still uses the sync approach for now. It would be great if you could provide a second pair of eyes and have a look^^.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have a minimal repro for how to cause the issue? Does it just require setting or rendering to RenderTarget A and then calling "readRenderTargetPixels"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just switch to readRenderTargetPixelsAsync() in EXRExporter any try to export the PMREM in misc_exporter_exr. That should trigger the feedback loop.

@sunag sunag added this to the r169 milestone Sep 3, 2024
@Mugen87 Mugen87 merged commit 59c9820 into mrdoob:dev Sep 3, 2024
12 checks passed
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.

3 participants