mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +00:00
Merge branch 'vertex_lighting_fix' into 'master'
Correct vertex lighting Closes #5973 See merge request OpenMW/openmw!770
This commit is contained in:
commit
90fecdeda2
8 changed files with 16 additions and 23 deletions
|
@ -73,12 +73,7 @@ void main()
|
||||||
vec3 diffuseLight, ambientLight;
|
vec3 diffuseLight, ambientLight;
|
||||||
doLighting(passViewPos, normalize(viewNormal), shadowing, diffuseLight, ambientLight);
|
doLighting(passViewPos, normalize(viewNormal), shadowing, diffuseLight, ambientLight);
|
||||||
lighting = diffuseLight + ambientLight;
|
lighting = diffuseLight + ambientLight;
|
||||||
#endif
|
clampLightingResult(lighting);
|
||||||
|
|
||||||
#if @clamp
|
|
||||||
lighting = clamp(lighting, vec3(0.0), vec3(1.0));
|
|
||||||
#else
|
|
||||||
lighting = max(lighting, 0.0);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gl_FragData[0].xyz *= lighting;
|
gl_FragData[0].xyz *= lighting;
|
||||||
|
|
|
@ -165,6 +165,7 @@ void main(void)
|
||||||
vec3 diffuseLight, ambientLight;
|
vec3 diffuseLight, ambientLight;
|
||||||
doLighting(viewPos.xyz, viewNormal, diffuseLight, ambientLight, shadowDiffuseLighting);
|
doLighting(viewPos.xyz, viewNormal, diffuseLight, ambientLight, shadowDiffuseLighting);
|
||||||
passLighting = diffuseLight + ambientLight;
|
passLighting = diffuseLight + ambientLight;
|
||||||
|
clampLightingResult(passLighting);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (@shadows_enabled)
|
#if (@shadows_enabled)
|
||||||
|
|
|
@ -129,3 +129,12 @@ vec4 lcalcSpecular(int lightIndex)
|
||||||
return @getLight[lightIndex].specular;
|
return @getLight[lightIndex].specular;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clampLightingResult(inout vec3 lighting)
|
||||||
|
{
|
||||||
|
#if @clamp
|
||||||
|
lighting = clamp(lighting, vec3(0.0), vec3(1.0));
|
||||||
|
#else
|
||||||
|
lighting = max(lighting, 0.0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
|
@ -78,11 +78,7 @@ void main()
|
||||||
#endif
|
#endif
|
||||||
vec3 lighting = diffuseColor.xyz * diffuseLight + getAmbientColor().xyz * ambientLight + emission;
|
vec3 lighting = diffuseColor.xyz * diffuseLight + getAmbientColor().xyz * ambientLight + emission;
|
||||||
|
|
||||||
#if @clamp
|
clampLightingResult(lighting);
|
||||||
lighting = clamp(lighting, vec3(0.0), vec3(1.0));
|
|
||||||
#else
|
|
||||||
lighting = max(lighting, 0.0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gl_FragData[0].xyz *= lighting;
|
gl_FragData[0].xyz *= lighting;
|
||||||
|
|
||||||
|
|
|
@ -176,12 +176,7 @@ void main()
|
||||||
doLighting(passViewPos, normalize(viewNormal), shadowing, diffuseLight, ambientLight);
|
doLighting(passViewPos, normalize(viewNormal), shadowing, diffuseLight, ambientLight);
|
||||||
vec3 emission = getEmissionColor().xyz * emissiveMult;
|
vec3 emission = getEmissionColor().xyz * emissiveMult;
|
||||||
lighting = diffuseColor.xyz * diffuseLight + getAmbientColor().xyz * ambientLight + emission;
|
lighting = diffuseColor.xyz * diffuseLight + getAmbientColor().xyz * ambientLight + emission;
|
||||||
#endif
|
clampLightingResult(lighting);
|
||||||
|
|
||||||
#if @clamp
|
|
||||||
lighting = clamp(lighting, vec3(0.0), vec3(1.0));
|
|
||||||
#else
|
|
||||||
lighting = max(lighting, 0.0);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gl_FragData[0].xyz *= lighting;
|
gl_FragData[0].xyz *= lighting;
|
||||||
|
|
|
@ -125,6 +125,7 @@ void main(void)
|
||||||
doLighting(viewPos.xyz, viewNormal, diffuseLight, ambientLight, shadowDiffuseLighting);
|
doLighting(viewPos.xyz, viewNormal, diffuseLight, ambientLight, shadowDiffuseLighting);
|
||||||
vec3 emission = getEmissionColor().xyz * emissiveMult;
|
vec3 emission = getEmissionColor().xyz * emissiveMult;
|
||||||
passLighting = getDiffuseColor().xyz * diffuseLight + getAmbientColor().xyz * ambientLight + emission;
|
passLighting = getDiffuseColor().xyz * diffuseLight + getAmbientColor().xyz * ambientLight + emission;
|
||||||
|
clampLightingResult(passLighting);
|
||||||
shadowDiffuseLighting *= getDiffuseColor().xyz;
|
shadowDiffuseLighting *= getDiffuseColor().xyz;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -87,12 +87,7 @@ void main()
|
||||||
vec3 diffuseLight, ambientLight;
|
vec3 diffuseLight, ambientLight;
|
||||||
doLighting(passViewPos, normalize(viewNormal), shadowing, diffuseLight, ambientLight);
|
doLighting(passViewPos, normalize(viewNormal), shadowing, diffuseLight, ambientLight);
|
||||||
lighting = diffuseColor.xyz * diffuseLight + getAmbientColor().xyz * ambientLight + getEmissionColor().xyz;
|
lighting = diffuseColor.xyz * diffuseLight + getAmbientColor().xyz * ambientLight + getEmissionColor().xyz;
|
||||||
#endif
|
clampLightingResult(lighting);
|
||||||
|
|
||||||
#if @clamp
|
|
||||||
lighting = clamp(lighting, vec3(0.0), vec3(1.0));
|
|
||||||
#else
|
|
||||||
lighting = max(lighting, 0.0);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gl_FragData[0].xyz *= lighting;
|
gl_FragData[0].xyz *= lighting;
|
||||||
|
|
|
@ -47,6 +47,7 @@ void main(void)
|
||||||
vec3 diffuseLight, ambientLight;
|
vec3 diffuseLight, ambientLight;
|
||||||
doLighting(viewPos.xyz, viewNormal, diffuseLight, ambientLight, shadowDiffuseLighting);
|
doLighting(viewPos.xyz, viewNormal, diffuseLight, ambientLight, shadowDiffuseLighting);
|
||||||
passLighting = getDiffuseColor().xyz * diffuseLight + getAmbientColor().xyz * ambientLight + getEmissionColor().xyz;
|
passLighting = getDiffuseColor().xyz * diffuseLight + getAmbientColor().xyz * ambientLight + getEmissionColor().xyz;
|
||||||
|
clampLightingResult(passLighting);
|
||||||
shadowDiffuseLighting *= getDiffuseColor().xyz;
|
shadowDiffuseLighting *= getDiffuseColor().xyz;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue