$ ./guess_the_languageGame Dev
Game Dev · hard · #222

Why does the direction use w = 0?

vec4 dir = vec4(d, 0.0);
vec4 pos = vec4(p, 1.0);
  1. So it gets normalised automatically
  2. So the GPU stores it in fewer bits
  3. So translation has no effect on it
  4. So it always points at the camera
A 4x4 transform multiplies its translation column by w, so w = 0 keeps rotation and scale but ignores position offsets.
Play Game Dev ▸