cameraWorldMatrix
Provides the camera's World Matrix, used to transform coordinates from the camera's local coordinate system (View Space) back to World Space. It is the inverse operation of cameraViewMatrix.
Core Advantages
Automatically provides and updates the camera's world matrix, simplifying material code with clear semantics. It is a key tool for implementing advanced effects like reconstructing world coordinates from screen or depth information.
Common Uses
Reconstructing world coordinates from a depth map in post-processing
Calculating the virtual camera matrix for planar reflections
Converting head-mounted objects from relative to world coordinates in VR/AR
Calculating view direction vectors in world space
Serving as the transform matrix for a camera debug gizmo
How to adjust
This node's value is controlled by the THREE.Camera object in the scene and cannot be adjusted directly in the shader. Moving or rotating the camera automatically updates this matrix, ensuring that any world-space-based logic (like coloring by height) remains correct regardless of viewpoint changes.
Code Examples
1
2// Reconstruct world-space coordinates from view-space coordinates
3const worldPosition = cameraWorldMatrix.mul(positionView);
4```