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

WebGPURenderer: Introduce RenderTarget3D and RenderTargetArray #30155

Open
wants to merge 16 commits into
base: dev
Choose a base branch
from

Conversation

RenaudRohlinger
Copy link
Collaborator

@RenaudRohlinger RenaudRohlinger commented Dec 18, 2024

Description
Introduce support for 3D textures and texture arrays in multi-render target (MRT) setups for both WebGPU and WebGL backends.

Unlike WebGLRenderer I used prefix instead of suffix (WebGLArrayRenderTarget -> RenderTargetArray) as a 3DRenderTarget felt wrong.

Made a example while working on it that displays 4 meshes:
image

  • A mesh rendering a 3D texture.
  • A mesh rendering a 2D array texture.
  • A mesh rendering a 3D FBO texture.
  • A mesh rendering a 2D array FBO texture.

Each slice of both RenderTarget is incremented and rendered every 50ms.

This contribution is funded by Utsubo

Copy link

github-actions bot commented Dec 18, 2024

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 339.4
79.05
339.44
79.06
+33 B
+7 B
WebGPU 487.04
135.09
488.43
135.49
+1.39 kB
+402 B
WebGPU Nodes 486.51
134.99
487.9
135.39
+1.39 kB
+404 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 465.3
112.11
465.3
112.11
+0 B
+0 B
WebGPU 557.21
150.78
558.39
151.15
+1.18 kB
+362 B
WebGPU Nodes 513.28
140.56
514.46
140.93
+1.18 kB
+363 B

@RenaudRohlinger RenaudRohlinger marked this pull request as draft December 18, 2024 08:14

if ( color ) {

for ( const texture of renderTargetData.textures ) {
const descriptor = this._getRenderPassDescriptor( renderTargetContext );
Copy link
Collaborator Author

@RenaudRohlinger RenaudRohlinger Dec 20, 2024

Choose a reason for hiding this comment

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

@sunag FYI here I updated the RenderContext to support RenderTarget that has not been rendered yet.

This way this prevent issues where the clear Pass doesn't match the correct descriptor associated to a texture and reuse how we setup a descriptor with _getRenderPassDescriptor which also makes the code cleaner.

@RenaudRohlinger RenaudRohlinger added this to the r172 milestone Dec 20, 2024
@RenaudRohlinger RenaudRohlinger marked this pull request as ready for review December 20, 2024 06:23
@RenaudRohlinger
Copy link
Collaborator Author

Maybe Render3DTarget and RenderArrayTarget? /cc @mrdoob

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