diff options
Diffstat (limited to 'linden/indra/newview/app_settings/shaders/class3/environment/scatterF.glsl')
-rw-r--r-- | linden/indra/newview/app_settings/shaders/class3/environment/scatterF.glsl | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/linden/indra/newview/app_settings/shaders/class3/environment/scatterF.glsl b/linden/indra/newview/app_settings/shaders/class3/environment/scatterF.glsl new file mode 100644 index 0000000..7a9245f --- /dev/null +++ b/linden/indra/newview/app_settings/shaders/class3/environment/scatterF.glsl | |||
@@ -0,0 +1,25 @@ | |||
1 | uniform sampler2D scatterMap; | ||
2 | |||
3 | //for per-pixel scatter | ||
4 | vec4 getScatter(vec3 viewVec, vec3 lightDir) | ||
5 | { | ||
6 | vec2 scatterCoord; | ||
7 | scatterCoord.x = length(viewVec); | ||
8 | vec3 normVec = viewVec / scatterCoord.x; | ||
9 | scatterCoord.y = dot(normVec, lightDir)*0.5 + 0.5; | ||
10 | scatterCoord.x = scatterCoord.x / gl_Fog.end; | ||
11 | scatterCoord.x *= scatterCoord.x; // HACK!! Remove this when we can push the view distance farther out | ||
12 | return texture2D(scatterMap, scatterCoord) * vec4(gl_Fog.color.rgb, 1.0); | ||
13 | } | ||
14 | |||
15 | void applyScatter(inout vec3 color, vec4 haze) | ||
16 | { | ||
17 | color.rgb = haze.rgb + haze.a * color.rgb; | ||
18 | } | ||
19 | |||
20 | //for per-vertex scatter | ||
21 | void applyScatter(inout vec3 color) | ||
22 | { | ||
23 | vec4 haze = texture2D(scatterMap, gl_TexCoord[5].xy) * vec4(gl_Fog.color.rgb, 1.0); | ||
24 | color.rgb = haze.rgb + haze.a * color.rgb; | ||
25 | } | ||