Skip to content

TSL: Introduce varying.setInterpolation()#30582

Merged
sunag merged 11 commits into
mrdoob:devfrom
cmhhelgeson:webgpu_varying_interpolation
Apr 4, 2025
Merged

TSL: Introduce varying.setInterpolation()#30582
sunag merged 11 commits into
mrdoob:devfrom
cmhhelgeson:webgpu_varying_interpolation

Conversation

@cmhhelgeson

@cmhhelgeson cmhhelgeson commented Feb 21, 2025

Copy link
Copy Markdown
Contributor

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.

@github-actions

github-actions Bot commented Feb 21, 2025

Copy link
Copy Markdown

📦 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

Comment thread examples/webgpu_centroid_sampling.html Fixed
Comment thread examples/webgpu_centroid_sampling.html Fixed
Comment thread examples/webgpu_centroid_sampling.html Fixed
@cmhhelgeson

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

sunag commented Mar 11, 2025

Copy link
Copy Markdown
Collaborator

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

Mugen87 commented Jun 3, 2025

Copy link
Copy Markdown
Collaborator

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

5 participants