- Timestamp:
- 02/12/09 10:39:53 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg
r3303 r3304 63 63 float3 tl, 64 64 float3 tr, 65 float2 xyStep) 65 float2 xyStep, 66 float convergence) 66 67 { 67 68 float2 result = float2(0.0f, 0.0f); … … 69 70 const float3 centerPos = ReconstructSamplePos(colorsTex, texCoord, bl, br, tl, tr); 70 71 71 for (int i = -SSAO_FILTER_RADIUS; i < SSAO_FILTER_RADIUS; ++ i) 72 const float scale = saturate((SSAO_CONVERGENCE_THRESHOLD - convergence) / SSAO_CONVERGENCE_THRESHOLD); 73 //const int radius = SSAO_FILTER_RADIUS * saturate((SSAO_CONVERGENCE_THRESHOLD - convergence) / SSAO_CONVERGENCE_THRESHOLD); 74 75 //for (int i = -radius; i <= radius; ++ i) 76 for (int i = -SSAO_FILTER_RADIUS; i <= SSAO_FILTER_RADIUS; ++ i) 72 77 { 73 float4 sampleTexCoord = float4(texCoord + i * xyStep , .0f, .0f);78 float4 sampleTexCoord = float4(texCoord + i * xyStep * scale, .0f, .0f); 74 79 result += FilterSample(sampleTexCoord, ssaoTex, colorsTex, centerPos, bl, br, tl, tr); 75 80 } … … 104 109 105 110 // filter up to a certain convergance value and leave out background (sky) by checking depth 106 if ((convergence < SSAO_CONVERGENCE_THRESHOLD) && (depth < 1e10f))111 if ((convergence < SSAO_CONVERGENCE_THRESHOLD) && (depth < DEPTH_THRESHOLD)) 107 112 { 108 113 // the filtered ssao value 109 OUT.illum_col.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep );114 OUT.illum_col.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep, convergence); 110 115 } 111 116 … … 140 145 141 146 // filter up to a certain convergance value and leave out background (sky) by checking depth 142 if ((convergence < SSAO_CONVERGENCE_THRESHOLD) && (depth < 1e10f))147 if ((convergence < SSAO_CONVERGENCE_THRESHOLD) && (depth < DEPTH_THRESHOLD)) 143 148 { 144 149 // the filtered ssao value 145 ao.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep );150 ao.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep, convergence); 146 151 } 147 152 148 153 // just apply ssao if we are not in the sky 149 if (depth < 1e10f)154 if (depth < DEPTH_THRESHOLD) 150 155 { 151 156 OUT.illum_col.xyz = col.xyz * max(2e-2f, 1.0f - ao.x);
Note: See TracChangeset
for help on using the changeset viewer.