[client] Add a comment on light attenuation

Saves me having to look in the shader every time.
This commit is contained in:
Bill Currie 2023-01-29 11:38:04 +09:00
parent 2a28b342ee
commit 99d32d5e54
1 changed files with 6 additions and 0 deletions

View File

@ -216,6 +216,12 @@ parse_light (light_t *light, int *style, const plitem_t *entity,
}
}
// The light's intensity is calculated as
// I = (1 - a.w * r.y) / dot (a, r)
// where a is attenuation and r = vec4 (d*d, d, 1, 0)
// thus giving linear falloff for a = vec4 (0, 0, 1, 1/maxdist)
// and 1/(A*d*d + B*d + C) for a = vec4 (A, B, C, 0)
// Other factors contribute to the final intensity (cone angle etc)
vec4f_t attenuation = { // inverse square
1, 0, 0,
0,