Skip to content

TSL: Introduce clipSpace#32594

Merged
sunag merged 17 commits into
mrdoob:devfrom
sunag:dev-clipSpace
Dec 22, 2025
Merged

TSL: Introduce clipSpace#32594
sunag merged 17 commits into
mrdoob:devfrom
sunag:dev-clipSpace

Conversation

@sunag

@sunag sunag commented Dec 20, 2025

Copy link
Copy Markdown
Collaborator

Fixes #32583 (comment)

Description

Adds clipSpace and rebuilds positionView from clipSpace if material.vertexNode is used.

This should correct view-z discrepancies in custom shaders at the vertexNode.

@github-actions

github-actions Bot commented Dec 20, 2025

Copy link
Copy Markdown

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 355.34
84.47
355.34
84.47
+0 B
+0 B
WebGPU 617.86
171.37
618.29
171.69
+434 B
+316 B
WebGPU Nodes 616.46
171.13
616.89
171.44
+434 B
+312 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 487.5
119.33
487.5
119.33
+0 B
+0 B
WebGPU 689.3
187.14
690.55
187.34
+1.25 kB
+198 B
WebGPU Nodes 639.15
174.35
640.39
174.58
+1.25 kB
+224 B

@sunag sunag changed the title TSL: Introduce clipSpace and viewZ TSL: Introduce clipSpace Dec 20, 2025
@sunag sunag marked this pull request as ready for review December 20, 2025 20:05
@sunag sunag added this to the r183 milestone Dec 20, 2025
@sunag sunag requested a review from Mugen87 December 20, 2025 20:10

@Mugen87 Mugen87 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally with the repro case from the OP and the issue is indeed fixed! 🎉

Comment thread src/nodes/accessors/Position.js
@sunag

sunag commented Dec 21, 2025

Copy link
Copy Markdown
Collaborator Author

I also need to optimize it so that clipSpace is only declared when it is used.

Comment thread src/materials/nodes/NodeMaterial.js Fixed
@sunag sunag merged commit ecf6e9c into mrdoob:dev Dec 22, 2025
10 checks passed
@sunag sunag deleted the dev-clipSpace branch December 22, 2025 01:38
@Mugen87

Mugen87 commented Jan 10, 2026

Copy link
Copy Markdown
Collaborator

While testing the latest shadow map changes, I've realized webgpu_shadowmap_progressive is broken on dev. The light map isn't properly applied to the scene anymore. After some testing it turned out this particular change is the root cause.

I'm not sure how to fix this but ProgressiveLightMap assigns custom code to vertexNode. Is that a help? Unfortunately, #32691 does not fix the example.

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.

Line2NodeMaterial: Incompatible with logarithmic depth buffer.

3 participants