cameraViewMatrix
Provides the View Matrix, used to transform coordinates from World Space to View Space (the camera's own coordinate system). This is a critical step in the vertex transformation pipeline.
Core Advantages
Provides clear semantics ('View Matrix') instead of a low-level concept ('camera's inverse world matrix') and automatically adapts to both single-camera and multi-camera (e.g., VR) setups, greatly simplifying developer code and logic.
Common Uses
Transforming vertices from world to view space in the MVP pipeline
Unifying all vectors (positions, normals, etc.) into View Space for lighting calculations
Creating 'infinitely distant' skybox effects by removing the matrix's translation component
Serving as a rotational reference for building billboarding effects
Reconstructing world coordinates from view-space coordinates in post-processing
How to adjust
This node's value is not adjusted directly in the shader; it's entirely controlled by the THREE.Camera object in the scene. Moving or rotating the camera automatically updates this matrix. For instance, moving the camera to the right is equivalent to this matrix transforming the entire world to the left, causing objects to shift left on the screen.
Code Examples
1
2// Transform a world-space position into view-space
3const positionView = cameraViewMatrix.mul(positionWorld);
4