diff options
author | Dave Parks <davep@lindenlab.com> | 2011-09-29 19:32:56 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2011-09-29 19:32:56 -0500 |
commit | 7238714634e72dacc4b09c1c4ee98b16fb0c91fe (patch) | |
tree | 89500aeb877bcf5b3d00f0c96ec0f0321834de1e /indra/newview/app_settings/shaders/class1/environment/terrainF.glsl | |
parent | 973fefc8d9014f6389b4c3f9633ce398fdf5399e (diff) |
SH-2507 Potential fix for basic shaders causing objects to disappear with some drivers (prune shader tree of unused shaders while we're at it)
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/environment/terrainF.glsl')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/environment/terrainF.glsl | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl index f0837dd4ca..18f6d91804 100644 --- a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl @@ -1,4 +1,4 @@ -/** +/** * @file terrainF.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ @@ -27,22 +27,38 @@ out vec4 gl_FragColor; #endif -uniform sampler2D detail0; -uniform sampler2D detail1; -uniform sampler2D alphaRamp; +VARYING vec4 vertex_color; +VARYING vec4 vary_texcoord0; +VARYING vec4 vary_texcoord1; -VARYING vec2 vary_texcoord0; -VARYING vec2 vary_texcoord1; -VARYING vec2 vary_texcoord2; -VARYING vec2 vary_texcoord3; +uniform sampler2D detail_0; +uniform sampler2D detail_1; +uniform sampler2D detail_2; +uniform sampler2D detail_3; +uniform sampler2D alpha_ramp; -void main() +vec3 atmosLighting(vec3 light); + +vec3 scaleSoftClip(vec3 color); + +void main() { - float a = texture2D(alphaRamp, vary_texcoord1.xy).a; - vec3 color = mix(texture2D(detail1, vary_texcoord2.xy).rgb, - texture2D(detail0, vary_texcoord0.xy).rgb, - a); + /// Note: This should duplicate the blending functionality currently used for the terrain rendering. + + /// TODO Confirm tex coords and bind them appropriately in vert shader. + vec4 color0 = texture2D(detail_0, vary_texcoord0.xy); + vec4 color1 = texture2D(detail_1, vary_texcoord0.xy); + vec4 color2 = texture2D(detail_2, vary_texcoord0.xy); + vec4 color3 = texture2D(detail_3, vary_texcoord0.xy); - gl_FragColor.rgb = color; - gl_FragColor.a = texture2D(alphaRamp, vary_texcoord3.xy).a; + float alpha1 = texture2D(alpha_ramp, vary_texcoord0.zw).a; + float alpha2 = texture2D(alpha_ramp,vary_texcoord1.xy).a; + float alphaFinal = texture2D(alpha_ramp, vary_texcoord1.zw).a; + vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal ); + + /// Add WL Components + outColor.rgb = atmosLighting(outColor.rgb * vertex_color.rgb); + + gl_FragColor = vec4(scaleSoftClip(outColor.rgb), 1.0); } + |