diff options
author | Brad Kittenbrink <brad@lindenlab.com> | 2008-02-27 18:58:14 +0000 |
---|---|---|
committer | Brad Kittenbrink <brad@lindenlab.com> | 2008-02-27 18:58:14 +0000 |
commit | 6d52efe452aa8469e0343da1c7d108f3f52ab651 (patch) | |
tree | a87be48e9840d7fc1f7ee514d7c7f994e71fdb3c /indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl | |
parent | 6027ad2630b8650cabcf00628ee9b0d25bedd67f (diff) |
Merge of windlight into release (QAR-286). This includes all changes in
windlight14 which have passed QA (up through r79932).
svn merge -r 80831:80833 svn+ssh://svn.lindenlab.com/svn/linden/branches/merge_windlight14_r80620
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl new file mode 100644 index 0000000000..f1740a4dcd --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl @@ -0,0 +1,45 @@ +/** + * @file underWaterF.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +uniform sampler2D diffuseMap; +uniform sampler2D bumpMap; +uniform sampler2D screenTex; + +uniform float refScale; +uniform vec4 waterFogColor; + +//bigWave is (refCoord.w, view.w); +varying vec4 refCoord; +varying vec4 littleWave; +varying vec4 view; + +void main() +{ + vec4 color; + + //get bigwave normal + vec3 wavef = texture2D(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0; + + //get detail normals + vec3 dcol = texture2D(bumpMap, littleWave.xy).rgb*0.75; + dcol += texture2D(bumpMap, littleWave.zw).rgb*1.25; + + //interpolate between big waves and little waves (big waves in deep water) + wavef = (wavef+dcol)*0.5; + + //crunch normal to range [-1,1] + wavef -= vec3(1,1,1); + + //figure out distortion vector (ripply) + vec2 distort = (refCoord.xy/refCoord.z) * 0.5 + 0.5; + distort = distort+wavef.xy*refScale; + + vec4 fb = texture2D(screenTex, distort); + + gl_FragColor.rgb = mix(waterFogColor.rgb, fb.rgb, waterFogColor.a * 0.001 + 0.999); + gl_FragColor.a = fb.a; +} |