Skip to content

Shaders: Improve types. #30789

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

Merged
merged 1 commit into from
Mar 24, 2025
Merged

Conversation

s-rigaud
Copy link
Contributor

Description

I am trying to improve the types for Shader passes. I try to make a single type that can be used and reference everywhere but I found some inconsistencies:

  • some passes are missing a name property
  • LuminosityHighPassShader is using an old shaderID property (outdated I think)
  • ConvolutionShader is defining a buildKernel function that might just be passed as an utils like other shaders

@Mugen87
Copy link
Collaborator

Mugen87 commented Mar 24, 2025

some passes are missing a name property

Ideally, each shader object has a name. That also improves shader debugging.

LuminosityHighPassShader is using an old shaderID property (outdated I think)

Yes, I think it's safe to remove the property in this PR.

ConvolutionShader is defining a buildKernel function that might just be passed as an utils like other shaders

I think we should move buildKernel() into BloomPass as a module scope function.

@Mugen87 Mugen87 changed the title Pass: improve types Shaders: Improve types. Mar 24, 2025
@s-rigaud s-rigaud force-pushed the improve-shader-pass-types branch from e5befdb to 206756f Compare March 24, 2025 22:19
Copy link

github-actions bot commented Mar 24, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 336.08
78.29
336.08
78.29
+0 B
+0 B
WebGPU 530.63
147.4
530.63
147.4
+0 B
+0 B
WebGPU Nodes 530.1
147.29
530.1
147.29
+0 B
+0 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 465.15
112.18
465.15
112.18
+0 B
+0 B
WebGPU 602.31
163.4
602.31
163.4
+0 B
+0 B
WebGPU Nodes 557.35
152.84
557.35
152.84
+0 B
+0 B

@s-rigaud s-rigaud force-pushed the improve-shader-pass-types branch from 206756f to df987b2 Compare March 24, 2025 22:24
@Mugen87 Mugen87 added this to the r175 milestone Mar 24, 2025
@Mugen87 Mugen87 merged commit 9563913 into mrdoob:dev Mar 24, 2025
12 checks passed
@Mugen87 Mugen87 mentioned this pull request Mar 25, 2025
@s-rigaud s-rigaud deleted the improve-shader-pass-types branch April 15, 2025 02: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.

2 participants