Changeset 2884 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders
- Timestamp:
- 08/29/08 15:46:36 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/antialiasing.cg
r2868 r2884 11 11 12 12 // the barrier for detecting a discontinuity 13 uniform float4 e_barrier = float4(5e- 4, 5e-4, 0, 0); // x = normal, y = depth13 uniform float4 e_barrier = float4(5e-5, 5e-5, 0, 0); // x = normal, y = depth 14 14 // the weights for normal / depth discontinuity 15 //uniform float4 e_weights = float4(10.0f, 0.1f, 1.0f, 1.0f); // x = normal, y = depth 15 16 uniform float4 e_weights = float4(1.0f, 1.0f, 1.0f, 1.0f); // x = normal, y = depth 16 17 uniform float4 e_kernel = float4(0.35f, 1.0f, 1.0f, 1.0f); … … 23 24 { 24 25 //return tex2D(colors, IN.c.xy); 26 25 27 // normal discontinuity filter 26 28 float3 nc = (float3)tex2D(normals, IN.c.xy); … … 37 39 float ne = saturate(dot(nd, e_weights.x)); 38 40 39 // opposite coordinates41 // construct opposite coordinates 40 42 float4 lrr = IN.lr.wzyx; 41 43 float4 tbr = IN.tb.wzyx; … … 66 68 67 69 dd = abs(2.0f * dc - dd) - e_barrier.y; 68 dd = step(dd, 0.0f);70 dd = step(dd, (float4)0.0f); 69 71 70 72 float de = saturate(dot(dd, e_weights.y)); … … 77 79 float2 offset = IN.c.xy * (1.0f - w); 78 80 79 float4 s0 = tex2D (colors, offset + IN.lt.xy * w);80 float4 s1 = tex2D (colors, offset + IN.rb.xy * w);81 float4 s2 = tex2D (colors, offset + IN.rt.xy * w);82 float4 s3 = tex2D (colors, offset + IN.lb.xy * w);81 float4 s0 = tex2Dlod(colors, float4(offset + IN.lt.xy * w, 0, 0)); 82 float4 s1 = tex2Dlod(colors, float4(offset + IN.rb.xy * w, 0, 0)); 83 float4 s2 = tex2Dlod(colors, float4(offset + IN.rt.xy * w, 0, 0)); 84 float4 s3 = tex2Dlod(colors, float4(offset + IN.lb.xy * w, 0, 0)); 83 85 84 return (s0 + s1 + s2 + s3) / 4.0f; 86 float4 sx = tex2D(colors, IN.c.xy); 87 88 //return (sx + sx) * 0.5f; 89 90 return (s0 + s1 + s2 + s3) * 0.25f; 91 //return (s0 + s1 + s2 + s3) * 0.25f; 92 85 93 //return float4(w); 86 94 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r2882 r2884 54 54 55 55 float4 norm = tex2D(normals, IN.texCoord.xy); 56 float4 color = tex2D (colors, IN.texCoord.xy);56 float4 color = tex2Dlod(colors, float4(IN.texCoord.xy, 0, 0)); 57 57 float4 position = tex2D(positions, IN.texCoord.xy); 58 58 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/globillum.cg
r2882 r2884 1 1 //////////////////// 2 // S creen Spaced Ambient Occlusionshader2 // SSAO + color bleeding shader 3 3 // based on shader of Alexander Kusternig 4 4 5 #define NUM_SAMPLES 10 6 //#define NUM_SAMPLES 16 7 8 // rule of thumb: approx 1 / NUM_SAMPLES 9 //#define SAMPLE_INTENSITY 0.15f 10 #define SAMPLE_INTENSITY 0.22f 11 12 #define AREA_SIZE 7e-1f 13 //#define AREA_SIZE 3e-1f 14 #define VIEW_CORRECTION_SCALE 0.3f 15 //#define VIEW_CORRECTION_SCALE 0.5f 16 #define DISTANCE_SCALE 1e-6f 17 18 #define ILLUM_INTENSITY 5e-1f; 5 #include "../shaderenv.h" 19 6 20 7 … … 83 70 84 71 //sample noisetex; r stores costheta, g stores sintheta 72 //float2 mynoise = tex2D(noiseTexture, IN.texCoord.xy * noiseMultiplier).xy * 2.0f - 1.0f; 85 73 float2 mynoise = tex2D(noiseTexture, IN.texCoord.xy * noiseMultiplier).xy; 86 74 … … 210 198 211 199 OUT.illum_col = (col + illum) * ao; 200 OUT.illum_col.w = col.w; 212 201 213 202 return OUT; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r2882 r2884 1 #include "../shaderenv.h" 2 1 3 //////////////////// 2 4 // Screen Spaced Ambient Occlusion shader 3 5 // based on shader of Alexander Kusternig 4 6 5 #define NUM_SAMPLES 106 //#define NUM_SAMPLES 167 8 // rule of thumb: approx 1 / NUM_SAMPLES9 //#define SAMPLE_INTENSITY 0.15f10 #define SAMPLE_INTENSITY 0.22f11 12 #define AREA_SIZE 7e-1f13 //#define AREA_SIZE 3e-1f14 #define VIEW_CORRECTION_SCALE 0.3f15 //#define VIEW_CORRECTION_SCALE 0.5f16 #define DISTANCE_SCALE 1e-6f17 7 18 8 … … 66 56 for (int i = 0; i < NUM_SAMPLES; ++ i) 67 57 { 68 float2 offset = samples[i];58 const float2 offset = samples[i]; 69 59 70 60 //////////////////// 71 61 // add random noise: r stores costheta, g stores sintheta 72 62 73 // float2 mynoise = tex2D(noiseTexture, IN.texCoord.xy * noiseMultiplier).xy * 2.0f - 1.0f;63 //const float2 mynoise = tex2D(noiseTexture, IN.texCoord.xy * noiseMultiplier).xy * 2.0f - 1.0f; 74 64 float2 mynoise = tex2D(noiseTexture, IN.texCoord.xy * noiseMultiplier).xy; 75 65 76 float2 offsetTransformed = reflect(offset, mynoise);66 const float2 offsetTransformed = reflect(offset, mynoise); 77 67 78 68 // weight with projected coordinate to reach similar kernel size for near and far … … 165 155 (abs(depthDif) < 1e-3f)) 166 156 { 167 OUT.illum_col .x =ao * expFactor + oldCol.x * (1.0f - expFactor);157 OUT.illum_col = (float4)ao * expFactor + oldCol.x * (1.0f - expFactor); 168 158 } 169 159 else 170 160 { 171 OUT.illum_col .x =ao;161 OUT.illum_col = (float4)ao; 172 162 } 173 163 … … 178 168 179 169 180 181 170 pixel combine(fragment IN, 182 171 uniform sampler2D colors, … … 185 174 pixel OUT; 186 175 187 float4 col = tex2D (colors, IN.texCoord.xy);176 float4 col = tex2Dlod(colors, float4(IN.texCoord.xy, 0, 0)); 188 177 float4 ao = tex2D(ssaoTex, IN.texCoord.xy); 189 178 190 179 OUT.illum_col = col * ao.x; 180 OUT.illum_col.w = ao.w; 191 181 192 182 return OUT;
Note: See TracChangeset
for help on using the changeset viewer.