morphReference
In TSL, references and applies the Morph Target data defined on a Mesh, enabling efficient, GPU-accelerated non-skeletal animations like facial expressions.
Core Advantages
Its core value is encapsulating complex morph target blending logic into a simple node. This allows developers to easily compose morph animations with other effects in TSL without writing low-level shader code, unifying performance and development efficiency.
Common Uses
Implementing real-time blending and animation of character facial expressions.
Used in character or product customization systems to adjust model shapes in real-time with sliders.
Driving procedural animations for organic objects, such as a waving flag or a breathing creature.
How to adjust
The effect of this node is controlled by adjusting the `mesh.morphTargetInfluences` array in JavaScript. For instance, gradually changing the weight for a specific expression from 0 to 1 will cause the model to smoothly transition from its default state to the full expression.
Code Examples
1// Apply the mesh's built-in morph result to the material's vertex position
2material.positionNode = morphReference(mesh);