aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
diff options
context:
space:
mode:
authorArmin Weatherwax2010-09-07 13:41:02 +0200
committerArmin Weatherwax2010-09-23 15:42:40 +0200
commit087e15e89930d51c3964329befb273ae3b2d330d (patch)
tree684c49a772b0097ed88a25660e1fd3dd10b264cc /linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
parentRobin Cornelius: fixes for building plugins on Linux 64bit (diff)
downloadmeta-impy-087e15e89930d51c3964329befb273ae3b2d330d.zip
meta-impy-087e15e89930d51c3964329befb273ae3b2d330d.tar.gz
meta-impy-087e15e89930d51c3964329befb273ae3b2d330d.tar.bz2
meta-impy-087e15e89930d51c3964329befb273ae3b2d330d.tar.xz
port of LL renderpipeline/Kirstens S19 pipeline for bridging to Viewer 2 texture system
Diffstat (limited to 'linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl')
-rw-r--r--linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl28
1 files changed, 19 insertions, 9 deletions
diff --git a/linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
index 2a811c5..e518bdd 100644
--- a/linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
+++ b/linden/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
@@ -8,14 +8,9 @@
8#extension GL_ARB_texture_rectangle : enable 8#extension GL_ARB_texture_rectangle : enable
9 9
10uniform sampler2D diffuseMap; 10uniform sampler2D diffuseMap;
11uniform sampler2DShadow shadowMap0; 11uniform sampler2DRect depthMap;
12uniform sampler2DShadow shadowMap1;
13uniform sampler2DShadow shadowMap2;
14uniform sampler2DShadow shadowMap3;
15uniform sampler2D noiseMap; 12uniform sampler2D noiseMap;
16uniform sampler2DRect positionMap;
17 13
18uniform mat4 shadow_matrix[4];
19uniform vec4 shadow_clip; 14uniform vec4 shadow_clip;
20uniform vec2 screen_res; 15uniform vec2 screen_res;
21 16
@@ -30,12 +25,27 @@ varying vec3 vary_fragcoord;
30 25
31uniform float alpha_soften; 26uniform float alpha_soften;
32 27
28uniform mat4 inv_proj;
29
30vec4 getPosition(vec2 pos_screen)
31{
32 float depth = texture2DRect(depthMap, pos_screen.xy).a;
33 vec2 sc = pos_screen.xy*2.0;
34 sc /= screen_res;
35 sc -= vec2(1.0,1.0);
36 vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0);
37 vec4 pos = inv_proj * ndc;
38 pos /= pos.w;
39 pos.w = 1.0;
40 return pos;
41}
42
33void main() 43void main()
34{ 44{
35 vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; 45 vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
36 frag *= screen_res; 46 frag *= screen_res;
37 47
38 vec3 samp_pos = texture2DRect(positionMap, frag).xyz; 48 vec3 samp_pos = getPosition(frag).xyz;
39 49
40 float shadow = 1.0; 50 float shadow = 1.0;
41 vec4 pos = vary_position; 51 vec4 pos = vary_position;
@@ -46,10 +56,10 @@ void main()
46 56
47 color.rgb = fullbrightScaleSoftClip(color.rgb); 57 color.rgb = fullbrightScaleSoftClip(color.rgb);
48 58
49 if (samp_pos.z != 0.0) 59 if (samp_pos.z != 0.0 && color.a < 1.0)
50 { 60 {
51 float dist_factor = alpha_soften; 61 float dist_factor = alpha_soften;
52 float a = gl_Color.a; 62 float a = color.a;
53 a *= a; 63 a *= a;
54 dist_factor *= 1.0/(1.0-a); 64 dist_factor *= 1.0/(1.0-a);
55 color.a *= min((pos.z-samp_pos.z)*dist_factor, 1.0); 65 color.a *= min((pos.z-samp_pos.z)*dist_factor, 1.0);