mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-16 17:11:03 +00:00
GL3: Fix missing dynamic lights on floor for grenades/rockets
Apparently the lightsource for exploding rockets/grenades is very close to the surface, so the dot-Product between surface-normal and the vector between the light and the pixel returns 0, basically disabling the dynamic light for that surface. As a workaround, move the lightposition (only for that dot product) a bit above the surface, 32*surfaceNormal looks good. fixes #386
This commit is contained in:
parent
4f20ac97d1
commit
178fcff36e
1 changed files with 7 additions and 1 deletions
|
@ -488,8 +488,14 @@ static const char* fragmentSrc3Dlm = MULTILINE_STRING(
|
|||
float distLightToPos = length(lightToPos);
|
||||
float fact = max(0, intens - distLightToPos - 52);
|
||||
|
||||
// move the light source a bit further above the surface
|
||||
// => helps if the lightsource is so close to the surface (e.g. grenades, rockets)
|
||||
// that the dot product below would return 0
|
||||
// (light sources that are below the surface are filtered out by lightFlags)
|
||||
lightToPos += passNormal*32.0;
|
||||
|
||||
// also factor in angle between light and point on surface
|
||||
fact *= max(0, dot(passNormal, lightToPos/distLightToPos));
|
||||
fact *= max(0, dot(passNormal, normalize(lightToPos)));
|
||||
|
||||
|
||||
lmTex.rgb += dynLights[i].lightColor.rgb * fact * (1.0/256.0);
|
||||
|
|
Loading…
Reference in a new issue