diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
10 files changed, 56 insertions, 57 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index 7f2c5add16..1cfc19267c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -88,7 +88,7 @@ vec3 linear_to_srgb(vec3 cl); vec2 encode_normal (vec3 n); vec3 decode_normal (vec2 enc); -vec3 scaleFragSoftClip(vec3 l); +vec3 scaleSoftClipFrag(vec3 l); vec3 atmosFragAmbient(vec3 light, vec3 sunlit); vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten); vec3 atmosFragAffectDirectionalLight(float light, vec3 sunlit); @@ -312,7 +312,7 @@ void main() //color.rgb = mix(diff.rgb, color.rgb, final_alpha); color.rgb = atmosFragLighting(color.rgb, additive, atten); - color.rgb = scaleFragSoftClip(color.rgb); + color.rgb = scaleSoftClipFrag(color.rgb); vec4 light = vec4(0,0,0,0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 6e06453a5b..c001ff9ac8 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -42,8 +42,8 @@ vec3 linear_to_srgb(vec3 cl); vec3 atmosFragAmbient(vec3 l, vec3 ambient); vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten); -vec3 scaleFragSoftClip(vec3 l); -vec3 atmosFragAffectDirectionalLight(float intensity, vec3 sunlit); +vec3 scaleSoftClipFrag(vec3 l); + void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten); #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) @@ -406,7 +406,7 @@ void main() col.rgb *= ambient; - col.rgb = col.rgb + atmosFragAffectDirectionalLight(final_da, sunlit); + col.rgb = col.rgb + (final_da * sunlit); col.rgb *= gamma_diff.rgb; @@ -455,7 +455,7 @@ void main() //col = mix(scaleSoftClip(col), fullbrightScaleSoftClip(col), diffuse.a); col = atmosFragLighting(col, additive, atten); - col = scaleFragSoftClip(col); + col = scaleSoftClipFrag(col); //convert to linear space before adding local lights col = srgb_to_linear(col); diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index c3827e3a56..5627275df6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -69,13 +69,7 @@ vec3 srgb_to_linear(vec3 cs); vec3 linear_to_srgb(vec3 cl); vec3 decode_normal (vec2 enc); -vec3 atmosFragAmbient(vec3 l, vec3 ambient); vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten); -vec3 scaleFragSoftClip(vec3 l); -vec3 atmosFragAffectDirectionalLight(float intensity, vec3 sunlit); -vec3 fullbrightFragAtmosTransport(vec3 l, vec3 additive, vec3 atten); -vec3 fullbrightScaleSoftClipFrag(vec3 l, vec3 atten); - void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten); vec4 getPosition_d(vec2 pos_screen, float depth) @@ -123,22 +117,20 @@ void main() vec3 col; float bloom = 0.0; { - vec3 sunlit; - vec3 amblit; - vec3 additive; - vec3 atten; + vec3 sunlit; + vec3 amblit; + vec3 additive; + vec3 atten; calcFragAtmospherics(pos.xyz, 1.0, sunlit, amblit, additive, atten); - col = atmosFragAmbient(vec3(0), amblit); float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); ambient *= 0.5; ambient *= ambient; - ambient = (1.0-ambient); - - col.rgb *= ambient; + ambient = (1.0 - ambient); - col += atmosFragAffectDirectionalLight(final_da, sunlit); - + col = amblit; + col += (final_da * sunlit); + col *= ambient; col *= diffuse.rgb; vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); @@ -174,9 +166,7 @@ void main() if (norm.w < 0.5) { - vec3 add = additive; - col = mix(atmosFragLighting(col, add, atten), fullbrightFragAtmosTransport(col, atten, add), diffuse.a); - col = mix(scaleFragSoftClip(col), fullbrightScaleSoftClipFrag(col, atten), diffuse.a); + col = atmosFragLighting(col, additive, atten); } #ifdef WATER_FOG @@ -187,7 +177,6 @@ void main() col = srgb_to_linear(col); - //col = vec3(1,0,1); //col.g = envIntensity; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/srgb.glsl b/indra/newview/app_settings/shaders/class1/deferred/srgb.glsl index 587f3d5a94..00ba0e8fad 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/srgb.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/srgb.glsl @@ -23,6 +23,24 @@ * $/LicenseInfo$ */ +vec3 rgb2hsv(vec3 c) +{ + vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); + vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); + vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); + + float d = q.x - min(q.w, q.y); + float e = 1.0e-10; + return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); +} + +vec3 hsv2rgb(vec3 c) +{ + vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); + vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); + return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); +} + vec3 srgb_to_linear(vec3 cs) { vec3 low_range = cs / vec3(12.92); diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl index a29acb3e7d..73f6d9fec3 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl @@ -73,6 +73,7 @@ VARYING vec4 vary_position; vec3 srgb_to_linear(vec3 cs); vec2 encode_normal(vec3 n); +vec3 scaleSoftClipFrag(vec3 l); vec3 BlendNormal(vec3 bump1, vec3 bump2) { @@ -175,7 +176,7 @@ void main() color.rgb += spec * specular; color.rgb = atmosTransport(color.rgb); - color.rgb = scaleSoftClip(color.rgb); + color.rgb = scaleSoftClipFrag(color.rgb); color.a = spec * sunAngle2; vec3 screenspacewavef = normalize((norm_mat*vec4(wavef, 1.0)).xyz); diff --git a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl index 835662732a..f98b3a5edf 100644 --- a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl @@ -60,3 +60,7 @@ vec3 linear_to_srgb(vec3 cl) } +vec3 ColorFromRadiance(vec3 radiance) +{ + return vec3(1.0) - exp(-radiance * 0.0001); +} diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl index 668a710c04..46bde7f308 100644 --- a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl @@ -59,8 +59,10 @@ void main() vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal ); /// Add WL Components - outColor.rgb = atmosLighting(outColor.rgb * vertex_color.rgb); + //outColor.rgb = atmosLighting(outColor.rgb * vertex_color.rgb); + outColor.rgb = atmosLighting(outColor.rgb); + frag_color = vec4(scaleSoftClip(outColor.rgb), 1.0); } diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl index d09c5f9247..5ffe464172 100644 --- a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl @@ -71,7 +71,7 @@ void main() /// Potentially better without it for water. pos /= pos.w; - vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0)); + vec4 color = calcLighting(pos.xyz, norm, vec4(0), vec4(1)); vertex_color = color; diff --git a/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl index b7f117fc5f..768d93f005 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl @@ -26,7 +26,7 @@ uniform int no_atmo; uniform vec4 gamma; -vec3 scaleFragSoftClip(vec3 light) +vec3 scaleSoftClipFrag(vec3 light) { // For compatibility with lower cards. Do nothing. return light; @@ -35,16 +35,19 @@ vec3 scaleFragSoftClip(vec3 light) /// Soft clips the light with a gamma correction vec3 scaleSoftClip(vec3 light) { - // For compatibility with lower cards. Do nothing. - return scaleFragSoftClip(light); + // For compatibility with lower cards. Do nothing + return light; } -vec3 fullbrightScaleSoftClipFrag(vec3 light, vec3 atten) +vec3 fullbrightScaleSoftClipFrag(vec3 light) { - return (no_atmo == 1) ? light : mix(scaleFragSoftClip(light.rgb), light.rgb, atten); + // For compatibility with lower cards. Do nothing + return light; } -vec3 fullbrightScaleSoftClip(vec3 light) { - return fullbrightScaleSoftClipFrag(light, vec3(1)); +vec3 fullbrightScaleSoftClip(vec3 light) +{ + // For compatibility with lower cards. Do nothing + return light; } diff --git a/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl index c3c8329017..ebce9ea91d 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl @@ -25,37 +25,19 @@ uniform int no_atmo; -vec3 atmosFragTransport(vec3 light, vec3 atten, vec3 additive) -{ - /* stub function for fallback compatibility on class1 hardware */ - return light; -} - -vec3 fullbrightFragAtmosTransport(vec3 light, vec3 atten, vec3 additive) -{ - /* stub function for fallback compatibility on class1 hardware */ - return light; -} - -vec3 fullbrightFragShinyAtmosTransport(vec3 light, vec3 atten, vec3 additive) -{ - /* stub function for fallback compatibility on class1 hardware */ - return light; -} - vec3 atmosTransport(vec3 light) { /* stub function for fallback compatibility on class1 hardware */ - return atmosFragTransport(light, vec3(1), vec3(0)); + return light; } vec3 fullbrightAtmosTransport(vec3 light) { - return fullbrightFragAtmosTransport(light, vec3(1), vec3(0)); + return light; } vec3 fullbrightShinyAtmosTransport(vec3 light) { - return fullbrightFragShinyAtmosTransport(light, vec3(1), vec3(0)); + return light; } |