mediumpModelViewMatrix
Provides a medium-precision model-view matrix to transform vertices directly from model space to view space. It serves as a convenient alias for the product of `cameraViewMatrix` and `modelWorldMatrix`.
Core Advantages
As a standardized shortcut, it eliminates the tedious and error-prone task of manual matrix multiplication in the shader, enhances code readability with its descriptive name, and hints at its suitability for medium-precision scenarios.
Common Uses
In classic lighting models, to transform vertices and normals into view space for calculations.
To provide a basis for calculating incident and reflection vectors for environment mapping.
In rim lighting or Fresnel effects, for efficiently calculating the geometric relationship between normals and the view direction.
To calculate the correct orientation for billboards or particle systems to always face the camera.
How to adjust
This node has no adjustable parameters. Its value is a direct reflection of the object and camera transforms in the scene. By changing the object's position/rotation or moving the camera in JavaScript, you can observe corresponding changes in the rendered output, such as object rotation or a shifting perspective.
Code Examples
1
2// Transform local vertex coordinates to view space
3const positionView = mediumpModelViewMatrix * positionLocal();
4