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

Merged
merged 20 commits into from
Dec 23, 2024

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 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

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.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
@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

@sunag sunag merged commit 05dbc5d into mrdoob:dev Dec 23, 2024
12 checks passed
@mrdoob
Copy link
Owner

mrdoob commented Dec 24, 2024

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
Copy link
Collaborator

Mugen87 commented Jan 9, 2025

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
Collaborator Author

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

@RenaudRohlinger
Copy link
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.

4 participants