mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-24 04:11:50 -04:00
Merge branch 'better-ambient-term' into 'master'
Draft: Better per-pixel lighting ambient term See merge request OpenMW/openmw!3972
This commit is contained in:
commit
c836f257d3
@ -42,8 +42,21 @@ void doLighting(vec3 viewPos, vec3 viewNormal, float shininess, out vec3 diffuse
|
|||||||
shininess = max(shininess, 1e-4);
|
shininess = max(shininess, 1e-4);
|
||||||
|
|
||||||
vec3 sunDir = normalize(lcalcPosition(0));
|
vec3 sunDir = normalize(lcalcPosition(0));
|
||||||
diffuseLight = lcalcDiffuse(0) * calcLambert(viewNormal, sunDir, viewDir);
|
vec3 sunColor = lcalcDiffuse(0);
|
||||||
|
float sunIntensity = calcLambert(viewNormal, sunDir, viewDir);
|
||||||
|
diffuseLight = sunColor * sunIntensity;
|
||||||
|
|
||||||
|
#if PER_PIXEL_LIGHTING
|
||||||
|
ambientLight = mix(
|
||||||
|
gl_LightModel.ambient.xyz,
|
||||||
|
mix(sunColor, gl_LightModel.ambient.xyz, shadowing),
|
||||||
|
sunIntensity * 0.5
|
||||||
|
);
|
||||||
|
#else
|
||||||
ambientLight = gl_LightModel.ambient.xyz;
|
ambientLight = gl_LightModel.ambient.xyz;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
specularLight = lcalcSpecular(0).xyz * calcSpecIntensity(viewNormal, viewDir, shininess, sunDir);
|
specularLight = lcalcSpecular(0).xyz * calcSpecIntensity(viewNormal, viewDir, shininess, sunDir);
|
||||||
#if PER_PIXEL_LIGHTING
|
#if PER_PIXEL_LIGHTING
|
||||||
diffuseLight *= shadowing;
|
diffuseLight *= shadowing;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user