modelViewProjection
Provides the final clip space coordinate (vec4) of a vertex after transformation by the model, view, and projection matrices, equivalent to `gl_Position` in GLSL.
Core Advantages
It encapsulates the entire MVP (Model-View-Projection) transform. As a varying, its interpolated value is available in the fragment shader, making it the foundation for all screen-space effects without manual setup.
Common Uses
Creating post-processing effects like vignettes and color correction by calculating screen UVs from its output.
Implementing custom vertex animations, such as a waving flag, by modifying this final position in the vertex shader.
Generating shadow maps by calculating vertex depth from the light's point of view.
How to adjust
This node's output is the result of the full MVP transform and cannot be adjusted directly. Its value is determined by the object's transform, the camera's transform, and the camera's projection settings (e.g., `fov`, `near`, `far`). Modify these properties in JavaScript to change its value.
Code Examples
1// In the fragment shader, derive screen UVs from the interpolated clip space position
2const ndc = modelViewProjection.xy.div( modelViewProjection.w );
3const screenUV = ndc.mul( 0.5 ).add( 0.5 );
4
5// Create a vignette effect based on the distance from the center
6const vignette = smoothstep( 0.6, 0.3, length( screenUV.sub( 0.5 ) ) );
7material.colorNode = baseColor.mul( vignette );