Skip to content

WebGPURenderer: Introduce RenderTarget3D and RenderTargetArray#30155

Merged
sunag merged 20 commits into
mrdoob:devfrom
RenaudRohlinger:utsubo/feat/rendertarget-2darray-3d
Dec 23, 2024
Merged

WebGPURenderer: Introduce RenderTarget3D and RenderTargetArray#30155
sunag merged 20 commits into
mrdoob:devfrom
RenaudRohlinger:utsubo/feat/rendertarget-2darray-3d

Conversation

@RenaudRohlinger

@RenaudRohlinger RenaudRohlinger commented Dec 18, 2024

Copy link
Copy Markdown
Collaborator

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 suffix instead of prefix (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

@github-actions

github-actions Bot commented Dec 18, 2024

Copy link
Copy Markdown

📦 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.31
135.17
488.69
135.58
+1.39 kB
+415 B
WebGPU Nodes 486.77
135.07
488.16
135.47
+1.39 kB
+399 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.47
150.87
558.65
151.23
+1.18 kB
+364 B
WebGPU Nodes 513.54
140.64
514.73
141.01
+1.18 kB
+366 B

@RenaudRohlinger RenaudRohlinger marked this pull request as draft December 18, 2024 08:14
Comment thread examples/webgpu_rendertarget_2d-array-3d.html Fixed
Comment thread src/renderers/webgpu/WebGPUBackend.js Outdated
@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
Copy Markdown
Collaborator Author

Maybe Render3DTarget and RenderArrayTarget? /cc @mrdoob

Comment thread src/renderers/webgpu/WebGPUBackend.js
@sunag sunag merged commit 05dbc5d into mrdoob:dev Dec 23, 2024
@mrdoob

mrdoob commented Dec 24, 2024

Copy link
Copy Markdown
Owner

Maybe Render3DTarget and RenderArrayTarget? /cc @mrdoob

I think using suffix may be the best yeah.

RenderTarget3D
RenderTargetArray
RenderTargetCube // We'll have to rename this one

/cc @elalish

@Mugen87

Mugen87 commented Jan 9, 2025

Copy link
Copy Markdown
Collaborator

It seems this PR has introduced a regression: #30283

Rolling back right before the merge restores the shadows in webgpu_lights_physical.

@RenaudRohlinger

Copy link
Copy Markdown
Collaborator Author

Oh, probably related to the update I did on RenderContext.

@RenaudRohlinger

Copy link
Copy Markdown
Collaborator Author

I can check later this week, my bad on this one! The issue is only on the WebGPU Backend so puppeteer didn't catch this one.

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.

5 participants