diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred')
| -rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl | 22 | ||||
| -rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl | 8 | 
2 files changed, 7 insertions, 23 deletions
| diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl index a4f144faba..63ab0b9b38 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl @@ -438,9 +438,10 @@ float geometricOcclusion(PBRInfo pbrInputs)      float NdotL = pbrInputs.NdotL;      float NdotV = pbrInputs.NdotV;      float r = pbrInputs.alphaRoughness; +    float r2 = r * r; -    float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL))); -    float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV))); +    float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r2 + (1.0 - r2) * (NdotL * NdotL))); +    float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r2 + (1.0 - r2) * (NdotV * NdotV)));      return attenuationL * attenuationV;  } @@ -625,24 +626,11 @@ vec3 pbrBaseLight(vec3 diffuseColor, vec3 specularColor, float metallic, vec3 v,  uniform vec4 waterPlane;  uniform float waterSign; -// discard if given position in eye space is on the wrong side of the waterPlane according to waterSign  void waterClip(vec3 pos)  { -    // TODO: make this less branchy -    if (waterSign > 0.0) +    if (((dot(pos.xyz, waterPlane.xyz) + waterPlane.w) * waterSign) < 0.0)      { -        if ((dot(pos.xyz, waterPlane.xyz) + waterPlane.w) < 0.0) -        { -            discard; -        } -    } -    else -    { -        if ((dot(pos.xyz, waterPlane.xyz) + waterPlane.w) > 0.0) -        { -            discard; -        } +        discard;      } -  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl index 4acab159cb..4331418b33 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl @@ -37,14 +37,10 @@ uniform sampler2D emissiveRect;  uniform sampler2D normalMap;  uniform float diffuse_luminance_scale; -float lum(vec3 col) -{ -    vec3 l = vec3(0.2126, 0.7152, 0.0722); -    return dot(l, col); -}  void main()  { +    const vec3 l = vec3(0.2126, 0.7152, 0.0722);      vec2 tc = vary_fragcoord*0.6+0.2;      tc.y -= 0.1; // HACK - nudge exposure sample down a little bit to favor ground over sky      vec3 c = texture(diffuseRect, tc).rgb; @@ -62,7 +58,7 @@ void main()      c += texture(emissiveRect, tc).rgb; -    float L = lum(c); +    float L = dot(l, c);      frag_color = vec4(max(L, 0.0));  } | 
