mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-16 01:21:17 +00:00
- fixed precision issue with dot product.
Apparently the shader math is not precise enough to ensure that two supposedly orthogonal vectors are truly orthogonal, resulting in a non-zero dot product
(cherry picked from commit cce6c9a085
)
This commit is contained in:
parent
c637d32113
commit
b3da533033
1 changed files with 1 additions and 1 deletions
|
@ -12,7 +12,7 @@ vec3 lightContribution(int i, vec3 normal)
|
||||||
|
|
||||||
vec3 lightdir = normalize(lightpos.xyz - pixelpos.xyz);
|
vec3 lightdir = normalize(lightpos.xyz - pixelpos.xyz);
|
||||||
float dotprod = dot(normal, lightdir);
|
float dotprod = dot(normal, lightdir);
|
||||||
if (dotprod < 0.0) return vec3(0.0); // light hits from the backside. This can happen with full sector light lists and must be rejected for all cases.
|
if (dotprod < -0.0001) return vec3(0.0); // light hits from the backside. This can happen with full sector light lists and must be rejected for all cases. Note that this can cause precision issues.
|
||||||
|
|
||||||
float attenuation = clamp((lightpos.w - lightdistance) / lightpos.w, 0.0, 1.0);
|
float attenuation = clamp((lightpos.w - lightdistance) / lightpos.w, 0.0, 1.0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue