mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +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);
|
||||
#else
|
||||
{
|
||||
// might need to be < 0 depending on direction of viewPos
|
||||
if (dot(viewPos, viewNormal.xyz) > 0)
|
||||
lambert = -lambert;
|
||||
if (lambert < 0)
|
||||
lambert *= -0.3;
|
||||
float cosine = dot(normalize(viewPos), normalize(viewNormal.xyz));
|
||||
if (lambert >= 0.0)
|
||||
cosine = -cosine;
|
||||
|
||||
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
|
||||
diffuseOut = gl_LightSource[lightIndex].diffuse.xyz * lambert;
|
||||
|
|
Loading…
Reference in a new issue