eulerView: Euler Angle View Transform
Combined rotation and translation matrix
The Euler view transformation creates a 4x4 matrix from 3D position and Euler angles. The transformation applies rotations in YXZ order (yaw-pitch-roll) then combines with translation:
The final transformation matrix combines rotation and translation:
Where is the position vector and .
Rotation Order Specification
Component | Axis | Angle Range | Description |
---|---|---|---|
euler.x | X | Pitch (elevation) | |
euler.y | Y | Yaw (azimuth) | |
euler.z | Z | Roll (bank) |
Orbiting View Matrix
ライブエディター
const fragment = () => { const time = iTime.mul(0.3) const pos = vec3(cos(time).mul(3), sin(time.mul(1.3)).mul(2), 2) const euler = vec3(sin(time.mul(0.7)).mul(0.3), time, cos(time.mul(0.5)).mul(0.2)) const viewMatrix = eulerView(pos.sin(), euler) const transformed = viewMatrix.mul(vec4(uv, 1, 1)).xyz const color = transformed.mul(0.5).add(0.5) return vec4(color, 1) }