diff options
author | Graham Linden <graham@lindenlab.com> | 2018-11-01 20:28:47 +0100 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2018-11-01 20:28:47 +0100 |
commit | 4f267a5723e7da2de36b9f2295e4942a4c8bf6c5 (patch) | |
tree | c186a8888794732f32bba406b7bb66b4cafd4d11 /indra/newview/app_settings/shaders/class2/windlight | |
parent | a67cf385d763325119f4d2a37beb96c9c6a80282 (diff) |
SL-9994
Make shaders use consistent naming and parameter order for transport and atmospheric helpers.
Share transport and gamma correction code where possible.
Add lots of asserts and other validation for when things don't go as planned.
Engage dumpShaderSource to get more source output with shader compilation fail.
Diffstat (limited to 'indra/newview/app_settings/shaders/class2/windlight')
-rw-r--r-- | indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl | 12 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl | 19 |
2 files changed, 13 insertions, 18 deletions
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl index 20c4d82ded..89bdbfc0e6 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl @@ -43,17 +43,7 @@ uniform float scene_light_strength; uniform mat3 ssao_effect_mat; uniform int no_atmo; -vec3 scaleFragSoftClip(vec3 light) -{ - if (no_atmo == 1) - { - return light; - } - //soft clip effect: - light = 1. - clamp(light, vec3(0.), vec3(1.)); - light = 1. - pow(light, gamma.xxx); - return light; -} +vec3 scaleSoftClipFrag(vec3 light); vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten) { diff --git a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl index f2764b72c3..187876acf7 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl @@ -30,8 +30,8 @@ uniform int no_atmo; vec3 getAtmosAttenuation(); -/// Soft clips the light with a gamma correction -vec3 scaleSoftClip(vec3 light) { +vec3 scaleSoftClipFrag(vec3 light) +{ if (no_atmo == 1) { return light; @@ -39,16 +39,21 @@ vec3 scaleSoftClip(vec3 light) { //soft clip effect: light = 1. - clamp(light, vec3(0.), vec3(1.)); light = 1. - pow(light, gamma.xxx); - return light; } -vec3 fullbrightScaleSoftClipFrag(vec3 light, vec3 atten) +vec3 scaleSoftClip(vec3 light) +{ + return scaleSoftClipFrag(light); +} + +vec3 fullbrightScaleSoftClipFrag(vec3 light) { - return (no_atmo == 1) ? light : mix(scaleSoftClip(light.rgb), light.rgb, atten); + return scaleSoftClipFrag(light.rgb); } -vec3 fullbrightScaleSoftClip(vec3 light) { - return (no_atmo == 1) ? light : fullbrightScaleSoftClipFrag(light.rgb, getAtmosAttenuation()); +vec3 fullbrightScaleSoftClip(vec3 light) +{ + return fullbrightScaleSoftClipFrag(light.rgb); } |