TSL: Remove transformed* prefix - WIP#31177
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
|
Curious about why you called it "namespace". Wondering if there are more intuitive names... |
I slept thinking about it too hehe. Namespace is used to separate blocks and generate prefixes, it is one of the things that happens although the execution behavior is very specific, executing within one namespace and another. It is a named flow control referring to the input of the material, perhaps we could link it to a naming referring to this process. |
|
Yeah, are there alternatives? Would |
| <script type="module"> | ||
|
|
||
| import * as THREE from 'three'; | ||
| import { Fn, time, vec2, vec3, uv, texture, mix, checker, normalLocal, namespace, positionLocal, color, oscSine, attribute } from 'three/tsl'; |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
| import * as THREE from 'three'; | ||
| import { Fn, time, vec2, vec3, uv, texture, mix, checker, normalLocal, namespace, positionLocal, color, oscSine, attribute } from 'three/tsl'; | ||
|
|
||
| import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
| import { normalView } from './Normal.js'; | ||
| import { tangentView } from './Tangent.js'; | ||
| import { mat3 } from '../tsl/TSLBase.js'; | ||
| import { Fn, mat3 } from '../tsl/TSLBase.js'; |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
| const name = builder.getNodeProperty( this, this.name ); | ||
|
|
||
| const isWebGPUBackend = renderer.backend.isWebGPUBackend === true; | ||
|
|
Check failure
Code scanning / CodeQL
Assignment to constant Error
|
I need to simplify this approach, I'm making little progress even after working all these days, at least the decisions I'll have to make are clearer now. I'm going to redo this implementation and revert the namespace implementation to something that can relate the material input and sub-build layers. |
|
Sound good! |
Related issue: #30849
Description
Removing the
transformedprefix from normals also simplifies the shader creation process, making it less confusing.For those who need normals without the fine surface transformations (fragment), a suffix called
Geometryhas been added, such asnormalViewGeometry.With the implementation of
namespace, thenormalViewnode, for example, will return the same asnormalViewGeometryif used inside thematerial.normalNodeinput, and if used outside, it will use the final calculation.This is also more in line with the strategy of moving the vertex calculations from
skinningandmorphtocompute()and leaving it with the fewest possible modifications, perhaps none for the target developer.