-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
WebGPURenderer: Tree-shaking 1/2 #29187
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
Related: #29156 |
Some TSL operators can now be chained and others cannot. IMO, this results in a confusing API. Users will be annoyed that they can't remember which ones can, and which ones cannot, be chained. Can we solve this -- even if it hurts tree-shaking somewhat? |
@WestLangley Can you list the TSL operators you are currently using that are no longer available? This might help me get a second understanding of the issue. |
@sunag I rewrote my code to accommodate this PR, but I believe this was the original set.
|
There’s also more here: #29238. Also I would say that all of these feel quite niche and case-specific, making them more suitable as third-party nodes. And if a developer wants to use them as chainabable it is still possible in user-land through addMethodChaining. |
Maybe these nodes should be addons instead of being in core? Maybe that'll help to understand what's chainable and whats not. |
Would we then have two imports? Or would it be something else? import { texture, uniform } from 'three/tsl';
import { saturation, posterize } from 'three/addons/nodes/TSLAddons.js'; |
Or something like this... import { texture, uniform } from 'three/tsl';
import { posterize } from 'three/addons/tsl/display/posterize.js';
import { saturation } from 'three/addons/tsl/display/saturation.js'; |
I think I need more one day to review some items in this PR 😇 |
`normalMap` is no longer a node element, we use this as an individual node instead This should work also in r167 See: mrdoob/three.js#29187
Related issue: #28328
Description
This PR prepares the architecture for
three.webgpu.nodes.js
which will be done in another PR, some chaning methods have been removed in favor of tree-shaking and should be imported now.We have
StandardNodeLibrary
all the Three.js shader inclusions from Materials to ToneMappings, this static part is only assigned tothree.webgpu.js
which will not have full support forthree-shaking
.This is a big change and may impact some existing projects, but I think it will be the last big change until release.
NodeMaterials
out ofNodes
NodeLibrary
andStandardNodeLibrary
supportNodeLibrary
NodeLoader
out ofNodes
TSLBase.js
TSL.js
Nodes
Examples
NodeLoader