cameraProjectionMatrix
Provides the camera's projection matrix, which transforms 3D vertices from view space to clip space, creating the perspective effect.
Core Advantages
Ultimate adaptability. It automatically provides the correct projection matrix for single-camera, multi-camera (split-screen), and VR (MultiView) rendering scenarios, allowing a single shader to work everywhere without modification.
Common Uses
Standard vertex transformation, projecting vertices from view space to clip space to create perspective.
Reconstructing 3D view-space coordinates from screen position and depth for post-processing effects.
Counteracting perspective to make objects like particles appear a constant size on screen.
Serving as the projection matrix for a light source during shadow map generation.
Creating custom, non-realistic distorted perspective effects like fisheye lenses.
How to adjust
This node cannot be adjusted directly. Its value is controlled by the active camera's properties in JavaScript. To change the projection, modify properties like `camera.fov`, `camera.aspect`, `camera.near`, or `camera.far`, and then call `camera.updateProjectionMatrix()`.
Code Examples
1
2// Transform a vertex from view space to clip space
3const clipPosition = viewPosition.mul( cameraProjectionMatrix );
4