Learn WebGPU C++ Guide by Elie Michel
Learn OpenGL by Joey de Vries
From the WebGPU C++ guide:
- in.position is the local coordinates, or model coordinates of the object. It describes the geometry as if the object was alone and centered around the origin.
- modelMatrix * in.position gives the world coordinates of the points, telling where it is relatively to a global static frame.
- viewMatrix * modelMatrix * in.position gives the camera coordinates, or view coordinates. This is the coordinates of the point as seen from the camera. You can think of it as if instead of moving the eye, we actually move and rotate the whole scene in the opposite direction.
- multiplying by projectionMatrix applies the projection [...] to give us clip coordinates.
- the fixed pipeline divides the clip coordinates by its w, which gives the NDC (normalized device coordinates).
- x is the West to East axis (-x = West, +x = East)
- y is the South to North axis (-y = South, +y = North)
- z is the down to up axis (-z = down, +z = up)
Relative to NDC, the world needs to be
- rotated around the x axis by -90°g
- mirrored on the y axis
... I guess?
- pitch = local x
- roll = local y
- yaw = local z
Right handed coordinate system -> rotation angles go counter-clockwise.
- -1.0 ≤ x ≤ 1.0
- -1.0 ≤ y ≤ 1.0
- 0.0 ≤ z ≤ 1.0
position output of a vertex shader
If point p = (p.x, p.y, p.z, p.w) is in the clip volume, then its normalized device coordinates are (p.x ÷ p.w, p.y ÷ p.w, p.z ÷ p.w).
match window coordinates
pixel coordinates on screen
match fragment coordinates
framebuffer coordinates + z depth
0.0 ≤ z ≤ 1.0, can be changed
- 0 ≤ u ≤ 1.0
- 0 ≤ v ≤ 1.0
- 0 ≤ w ≤ 1.0 (3D coordinates)
(0.0, 0.0, 0.0) is in the first texel in texture memory address order.
(1.0, 1.0, 1.0) is in the last texel texture memory address order.
advantages:
- well known
- fast (proven, at least with LuaJit)
- simple
disadvantages:
- anemic type system
- quirky syntax with gotchas
- lots of variants with different features and performance characteristics
https://github.com/vtereshkov/umka-lang
advantages
- static types
- interfaces
- fast (it says so)
- relatively well readable
disadvantages
- some weird syntax
- not well known
- questionable support
advantages
- static types
- fast (it says so)
- well readable
disadvantages
- not well known
- questionable support
advantages
- fast (it says so)
- well readable
disadvantages
- not well known
- questionable support