mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:53:51 +00:00
Use linear interpolation instead of abrupt transitions for groundcover lighting
This commit is contained in:
parent
14cf0ce1dc
commit
5124e81348
1 changed files with 14 additions and 5 deletions
|
@ -14,11 +14,20 @@ void perLight(out vec3 ambientOut, out vec3 diffuseOut, int lightIndex, vec3 vie
|
||||||
lambert = max(lambert, 0.0);
|
lambert = max(lambert, 0.0);
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
// might need to be < 0 depending on direction of viewPos
|
float cosine = dot(normalize(viewPos), normalize(viewNormal.xyz));
|
||||||
if (dot(viewPos, viewNormal.xyz) > 0)
|
if (lambert >= 0.0)
|
||||||
lambert = -lambert;
|
cosine = -cosine;
|
||||||
if (lambert < 0)
|
|
||||||
lambert *= -0.3;
|
float mult = 1.0;
|
||||||
|
float divisor = 8.0;
|
||||||
|
|
||||||
|
if (cosine < 0.0 && cosine >= -1.0/divisor)
|
||||||
|
mult = mix(1.0, 0.3, -cosine*divisor);
|
||||||
|
else if (cosine < -1.0/divisor)
|
||||||
|
mult = 0.3;
|
||||||
|
|
||||||
|
lambert *= mult;
|
||||||
|
lambert = abs(lambert);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
diffuseOut = gl_LightSource[lightIndex].diffuse.xyz * lambert;
|
diffuseOut = gl_LightSource[lightIndex].diffuse.xyz * lambert;
|
||||||
|
|
Loading…
Reference in a new issue