mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
Some small shader optimizations
This commit is contained in:
parent
8ef25301cb
commit
9ad9c070f8
2 changed files with 4 additions and 10 deletions
|
@ -20,7 +20,6 @@
|
|||
<@include LightAmbient.slh@>
|
||||
<@include LightDirectional.slh@>
|
||||
|
||||
|
||||
<@func fetchGlobalLight()@>
|
||||
// Get light
|
||||
Light light = getKeyLight();
|
||||
|
@ -193,14 +192,13 @@ vec3 evalGlobalLightingAlphaBlended(mat4 invViewMat, float shadowAttenuation, fl
|
|||
vec3 ambientSpecular;
|
||||
evalLightingAmbient(ambientDiffuse, ambientSpecular, lightAmbient, surfaceWS, metallic, fresnel, albedo, obscurance);
|
||||
color += ambientDiffuse;
|
||||
color += ambientSpecular / opacity;
|
||||
|
||||
// Directional
|
||||
vec3 directionalDiffuse;
|
||||
vec3 directionalSpecular;
|
||||
evalLightingDirectional(directionalDiffuse, directionalSpecular, lightDirection, lightIrradiance, surfaceWS, metallic, fresnel, albedo, shadowAttenuation);
|
||||
color += directionalDiffuse;
|
||||
color += directionalSpecular / opacity;
|
||||
color += (ambientSpecular + directionalSpecular) / opacity;
|
||||
|
||||
return color;
|
||||
}
|
||||
|
@ -227,14 +225,13 @@ vec3 evalGlobalLightingAlphaBlendedWithHaze(
|
|||
vec3 ambientSpecular;
|
||||
evalLightingAmbient(ambientDiffuse, ambientSpecular, lightAmbient, surfaceWS, metallic, fresnel, albedo, obscurance);
|
||||
color += ambientDiffuse;
|
||||
color += ambientSpecular / opacity;
|
||||
|
||||
// Directional
|
||||
vec3 directionalDiffuse;
|
||||
vec3 directionalSpecular;
|
||||
evalLightingDirectional(directionalDiffuse, directionalSpecular, lightDirection, lightIrradiance, surfaceWS, metallic, fresnel, albedo, shadowAttenuation);
|
||||
color += directionalDiffuse;
|
||||
color += directionalSpecular / opacity;
|
||||
color += (ambientSpecular + directionalSpecular) / opacity;
|
||||
|
||||
// Haze
|
||||
if ((hazeParams.hazeMode & HAZE_MODE_IS_ACTIVE) == HAZE_MODE_IS_ACTIVE) {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
<@include LightAmbient.slh@>
|
||||
<@include LightDirectional.slh@>
|
||||
|
||||
|
||||
<@func prepareGlobalLight(positionES, normalWS)@>
|
||||
// prepareGlobalLight
|
||||
// Transform directions to worldspace
|
||||
|
@ -192,14 +191,13 @@ vec3 evalGlobalLightingAlphaBlended(mat4 invViewMat, float shadowAttenuation, fl
|
|||
vec3 ambientSpecular;
|
||||
evalLightingAmbient(ambientDiffuse, ambientSpecular, lightAmbient, surfaceWS, metallic, fresnel, albedo, obscurance);
|
||||
color += ambientDiffuse;
|
||||
color += ambientSpecular / opacity;
|
||||
|
||||
// Directional
|
||||
vec3 directionalDiffuse;
|
||||
vec3 directionalSpecular;
|
||||
evalLightingDirectional(directionalDiffuse, directionalSpecular, lightDirection, lightIrradiance, surfaceWS, metallic, fresnel, albedo, shadowAttenuation);
|
||||
color += directionalDiffuse;
|
||||
color += directionalSpecular / opacity;
|
||||
color += (ambientSpecular + directionalSpecular) / opacity;
|
||||
|
||||
return color;
|
||||
}
|
||||
|
@ -219,14 +217,13 @@ vec3 evalGlobalLightingAlphaBlendedWithHaze(
|
|||
vec3 ambientSpecular;
|
||||
evalLightingAmbient(ambientDiffuse, ambientSpecular, lightAmbient, surfaceWS, metallic, fresnel, albedo, obscurance);
|
||||
color += ambientDiffuse;
|
||||
color += ambientSpecular / opacity;
|
||||
|
||||
// Directional
|
||||
vec3 directionalDiffuse;
|
||||
vec3 directionalSpecular;
|
||||
evalLightingDirectional(directionalDiffuse, directionalSpecular, lightDirection, lightIrradiance, surfaceWS, metallic, fresnel, albedo, shadowAttenuation);
|
||||
color += directionalDiffuse;
|
||||
color += directionalSpecular / opacity;
|
||||
color += (ambientSpecular + directionalSpecular) / opacity;
|
||||
|
||||
// Haze
|
||||
// FIXME - temporarily removed until we support it for forward...
|
||||
|
|
Loading…
Reference in a new issue