Skip to content

Conversation

@sunag
Copy link
Collaborator

@sunag sunag commented Dec 20, 2025

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

github-actions bot commented Dec 20, 2025

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

@Mugen87 Mugen87 left a comment

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

@sunag
Copy link
Collaborator Author

sunag commented Dec 21, 2025

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

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

2 participants