Skip to content

TSL: Introduce namespace #31168

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 5 commits into from
May 26, 2025
Merged

TSL: Introduce namespace #31168

merged 5 commits into from
May 26, 2025

Conversation

sunag
Copy link
Collaborator

@sunag sunag commented May 26, 2025

Related issue: #30105

Description

Important for TSL functions that use .once( namespace ) to ensure that the namespace will run twice,
once when the node is build in the specific namespace and once when the node is built in the others namespace.

This is useful for nodes like positionWorld that need to be re-updated if used in material.positionNode and outside of it in the same material.

It was initially done here for positionNode, but now the API can be used for other inputs like the one planned for the normals solution.

Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 337.26
78.64
337.26
78.64
+0 B
+0 B
WebGPU 551.5
152.93
551.78
153.04
+287 B
+110 B
WebGPU Nodes 550.85
152.78
551.13
152.89
+287 B
+110 B

🌳 Bundle size after tree-shaking

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

Before After Diff
WebGL 468.44
113.28
468.44
113.28
+0 B
+0 B
WebGPU 626.53
169.61
626.8
169.72
+270 B
+112 B
WebGPU Nodes 581.38
158.94
581.65
159.06
+270 B
+118 B

@sunag sunag marked this pull request as ready for review May 26, 2025 06:40
@sunag sunag added this to the r177 milestone May 26, 2025
@sunag sunag merged commit ba6091f into mrdoob:dev May 26, 2025
12 checks passed
@sunag sunag deleted the dev-namespace branch May 26, 2025 06:50
RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
* Nodes: use `.global`

* introduce `namespace`

* update description

* use namespace to `material.positionNode`

* add `docs`
RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
* Nodes: use `.global`

* introduce `namespace`

* update description

* use namespace to `material.positionNode`

* add `docs`
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.

1 participant