modelPosition
Provides the 3D object's origin (pivot point) in world space coordinates. This value is constant for all pixels of the same object.
Core Advantages
Drastically simplifies getting an object's world position. It replaces the tedious manual process of extracting the position from the matrix in JS and managing a uniform with a single, self-explanatory node, decoupling shader logic from scene logic.
Common Uses
Creating color gradients or effects based on an object's height (Y-coordinate) in the world.
Calculating the distance from the object's center to a target point to drive interactive effects like glows.
Serving as a 'seed' for procedural effects to add random variations in position, color, or animation phase to many identical objects (e.g., grass, trees).
Defining the center for radial effects that expand from the object's origin, such as a shockwave.
How to adjust
The output of this node cannot be adjusted with parameters. Its value is determined entirely by the position of the 3D object to which its material is applied. To change the `modelPosition` vector, move the object in the scene.
Code Examples
1// Remap world Y-position from the [0, 10] range to [0, 1]
2const blendFactor = saturate( modelPosition.y.div( 10 ) );
3
4// Mix colors based on the object's world height
5material.colorNode = mix( groundColor, skyColor, blendFactor );