mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-31 08:41:11 +00:00
[vulkan] Implement linear falloff
It's possibly too bright, but it might be the lights themselves. Still, it looks better than the no-falloff implementation.
This commit is contained in:
parent
33575f93d5
commit
fd97bb1456
1 changed files with 3 additions and 3 deletions
|
@ -29,12 +29,12 @@ calc_light (LightData light, vec3 position, vec3 normal)
|
||||||
vec3 incoming = normalize (dist);
|
vec3 incoming = normalize (dist);
|
||||||
float spotdot = -dot (incoming, light.direction);
|
float spotdot = -dot (incoming, light.direction);
|
||||||
float lightdot = dot (incoming, normal);
|
float lightdot = dot (incoming, normal);
|
||||||
float d = dot (dist, dist);
|
float d = sqrt (dot (dist, dist));
|
||||||
float r = light.radius;
|
float r = light.radius;
|
||||||
|
|
||||||
float intensity = light.intensity * step (d, r * r);
|
float intensity = light.intensity * step (d, r);
|
||||||
intensity *= step (spotdot, light.cone) * clamp (lightdot, 0, 1);
|
intensity *= step (spotdot, light.cone) * clamp (lightdot, 0, 1);
|
||||||
return light.color * intensity;
|
return light.color * intensity * (r - d);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue