Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
|
I'm thinking of adding a I'm still undecided about the names... but the concept should be similar import { transform, instance, skinning } from ...
material.transformNode = Fn( ( { object } ) => {
let finalTransform = transform;
// transform is a struct or object with position,normal,tangent,bitangent
if ( object.isSkinnedMesh ) finalTransform = skinning( finalTransform );
if ( object.isInstancedMesh ) finalTransform = instance( finalTransform );
// ...
return finalTransform ;
} )();or maybe only import { instance, skinning } from ...
material.transformNode = Fn( ( { object } ) => {
if ( object.isSkinnedMesh ) skinning( object );
if ( object.isInstancedMesh ) instance( object );
// ...
} )();In this sense, we have access to any stage of vertex transformation, like, position, normal, etc. |
|
@sunag Looks good to me. However, if I call this: if ( object.isInstancedMesh ) finalTransform = instance( finalTransform );Does this create a second three.js/src/materials/nodes/NodeMaterial.js Lines 832 to 836 in 399951c I'm worried about unnecessary creation of extra |
|
That would be so useful and make learning a lot easier. |
In my opinion, |
|
@Mugen87 When I run These are the circular dependencies that are listed: Why does |
|
These warning come from rollup so you only see them when the build is executed. Since it's just a warning, the CI does not fail if circular dependencies occur. Nevertheless, the PR needs a refactoring so no circular dependencies occur. |
Related issue: #32465
Description
This PR adds
instancePositionNodetoNodeMaterialto allow for accessing or settingpositionLocalimmediately after it is transformed by the instance matrix.