Skip to content

TSL: Introduce varying.setInterpolation() #30582

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 11 commits into from
Apr 4, 2025

Conversation

cmhhelgeson
Copy link
Contributor

@cmhhelgeson cmhhelgeson commented Feb 21, 2025

Related issue: #30576

Description

Modifies VaryingNode, allowing the user to directly define interpolation and sampling types for a varying node. In cases where no interpolation is defined, the default optimizations/behavior stays in place.

Copy link

github-actions bot commented Feb 21, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 336.39
78.35
336.44
78.37
+52 B
+16 B
WebGPU 540.78
149.8
541.67
150.04
+893 B
+236 B
WebGPU Nodes 540.25
149.7
541.14
149.93
+893 B
+236 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 465.37
112.21
465.37
112.21
+0 B
+0 B
WebGPU 613.67
165.87
614.51
166.09
+841 B
+219 B
WebGPU Nodes 568.66
155.28
569.5
155.49
+841 B
+210 B

@cmhhelgeson
Copy link
Contributor Author

I decided to just use @isaac-mason's basic sample for now, leaving the creation of a more dynamic sample for a later time. If possible, please include Isaac as a contributor to this PR.

@cmhhelgeson cmhhelgeson marked this pull request as ready for review February 22, 2025 00:12
@sunag sunag added this to the r175 milestone Mar 6, 2025
@sunag
Copy link
Collaborator

sunag commented Mar 11, 2025

It would be interesting to have the variables in the constants. For example: THREE.InterpolationType.PERSPECTIVE, THREE.InterpolationSampling.CENTROID...

@mrdoob mrdoob modified the milestones: r175, r176 Mar 28, 2025
@sunag sunag changed the title Nodes - Define Interpolation Type and Sampling Type of a VaryingNode TSL: Introduce varying.setInterpolation() Apr 4, 2025
@sunag sunag merged commit 32e12df into mrdoob:dev Apr 4, 2025
12 checks passed
@Mugen87
Copy link
Collaborator

Mugen87 commented Jun 3, 2025

@cmhhelgeson It seems the options flat first and flat either in webgpu_centroid_sampling produce shader errors:

Error while parsing WGSL: :27:37 error: expected interpolation sampling name
Did you mean 'first'?
Possible values: 'center', 'centroid', 'either', 'first', 'sample'
@location( 3 ) @interpolate( flat, flat first ) testUV : vec2,

Is that a regression?

@cmhhelgeson
Copy link
Contributor Author

Collaborator

No this behavior is incorrect. The @interpolate tag should only be (flat, first), not (flat, flat first). This would be an error in how the code is being constructed.

@cmhhelgeson
Copy link
Contributor Author

I think this might actually just be an issue with the sample, I'll look into it.

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