orthographic: Orthographic Projection Matrix
Parallel projection transformation
The orthographic projection creates a 4×4 transformation matrix that maps a 3D rectangular frustum to the normalized device coordinate (NDC) cube. Unlike perspective projection, orthographic maintains parallel lines and uniform scaling:
This transforms coordinates from the frustum to NDC .
Frustum Parameter Mapping
Parameter | Description | Typical Range |
---|---|---|
l | Left bound | Negative |
r | Right bound | Positive |
b | Bottom bound | Negative |
t | Top bound | Positive |
n | Near plane | Positive |
f | Far plane | > Near |
ライブエディター
const fragment = () => { const scale = sin(iTime).mul(0.5).add(1.5) const ortho = orthographic(scale.negate(), scale, scale.negate(), scale, 0.1, 10) const coord = vec3(uv.sub(0.5).mul(3), 1) const transformed = ortho.mul(vec4(coord, 1)).xyz const color = abs(transformed).clamp(0, 1) return vec4(color, 1) }