summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/skyF.glsl')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/skyF.glsl35
1 files changed, 13 insertions, 22 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
index de22312d3c..cc4c3b5dce 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
@@ -22,12 +22,10 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-
-/*[EXTRA_CODE_HERE]*/
// Inputs
-VARYING vec4 vary_HazeColor;
-VARYING float vary_LightNormPosDot;
+in vec3 vary_HazeColor;
+in float vary_LightNormPosDot;
uniform sampler2D rainbow_map;
uniform sampler2D halo_map;
@@ -36,16 +34,15 @@ uniform float moisture_level;
uniform float droplet_radius;
uniform float ice_level;
-#ifdef DEFINE_GL_FRAGCOLOR
-out vec4 frag_data[3];
-#else
-#define frag_data gl_FragData
-#endif
+out vec4 frag_data[4];
+
+vec3 srgb_to_linear(vec3 c);
/////////////////////////////////////////////////////////////////////////
// The fragment shader for the sky
/////////////////////////////////////////////////////////////////////////
+
vec3 rainbow(float d)
{
// 'Interesting' values of d are -0.75 .. -0.825, i.e. when view vec nearly opposite of sun vec
@@ -62,19 +59,16 @@ vec3 rainbow(float d)
d = clamp(d, 0.0, 0.25) + interior_coord;
float rad = (droplet_radius - 5.0f) / 1024.0f;
- return pow(texture2D(rainbow_map, vec2(rad+0.5, d)).rgb, vec3(1.8)) * moisture_level;
+ return pow(texture(rainbow_map, vec2(rad+0.5, d)).rgb, vec3(1.8)) * moisture_level;
}
vec3 halo22(float d)
{
d = clamp(d, 0.1, 1.0);
float v = sqrt(clamp(1 - (d * d), 0, 1));
- return texture2D(halo_map, vec2(0, v)).rgb * ice_level;
+ return texture(halo_map, vec2(0, v)).rgb * ice_level;
}
-/// Soft clips the light with a gamma correction
-vec3 scaleSoftClip(vec3 light);
-
void main()
{
// Potential Fill-rate optimization. Add cloud calculation
@@ -82,7 +76,7 @@ void main()
// the fragment) if the sky wouldn't show up because the clouds
// are fully opaque.
- vec4 color = vary_HazeColor;
+ vec3 color = vary_HazeColor;
float rel_pos_lightnorm = vary_LightNormPosDot;
float optic_d = rel_pos_lightnorm;
@@ -90,13 +84,10 @@ void main()
color.rgb += rainbow(optic_d);
color.rgb += halo_22;
color.rgb *= 2.;
- color.rgb = scaleSoftClip(color.rgb);
-
- // Gamma correct for WL (soft clip effect).
- frag_data[0] = vec4(color.rgb, 1.0);
- frag_data[1] = vec4(0.0,0.0,0.0,0.0);
- frag_data[2] = vec4(0.0,0.0,0.0,1.0); //1.0 in norm.w masks off fog
- gl_FragDepth = 0.99999f;
+ frag_data[0] = vec4(0);
+ frag_data[1] = vec4(0);
+ frag_data[2] = vec4(0.0,0.0,0.0,GBUFFER_FLAG_SKIP_ATMOS); //1.0 in norm.w masks off fog
+ frag_data[3] = vec4(color.rgb, 1.0);
}