- Timestamp:
- 04/24/09 18:00:06 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg
r3361 r3362 105 105 ) 106 106 { 107 float2 result = float2(0.0f, 0.0f); 107 //return tex2Dlod(ssaoTex, float4(texCoord, .0f, .0f)).x; 108 float2 result = float2(.0f); 108 109 109 110 const float3 centerPos = ReconstructSamplePos(colorsTex, texCoord, bl, br, tl, tr); 110 111 112 #if 0 113 //const float scale = saturate((SSAO_CONVERGENCE_THRESHOLD - convergence + 100) / SSAO_CONVERGENCE_THRESHOLD); 111 114 const float scale = saturate((SSAO_CONVERGENCE_THRESHOLD - convergence) / SSAO_CONVERGENCE_THRESHOLD); 112 //const int radius = SSAO_FILTER_RADIUS * saturate((SSAO_CONVERGENCE_THRESHOLD - convergence) / SSAO_CONVERGENCE_THRESHOLD);113 115 114 //for (int i = -radius; i <= radius; ++ i) 115 for (int i = -SSAO_FILTER_RADIUS; i <= SSAO_FILTER_RADIUS; ++ i) 116 //for (int i = -SSAO_FILTER_RADIUS; i <= SSAO_FILTER_RADIUS; ++ i) 116 117 { 117 118 const float4 sampleTexCoord = float4(texCoord + i * xyStep * scale, .0f, .0f); 118 119 result += FilterSample(sampleTexCoord, ssaoTex, colorsTex, centerPos, bl, br, tl, tr, maxConvergence, spatialWeight); 119 120 } 120 121 #else 122 123 const int radius = SSAO_FILTER_RADIUS * saturate((SSAO_CONVERGENCE_THRESHOLD - convergence + 100) / SSAO_CONVERGENCE_THRESHOLD); 124 125 for (int i = -radius; i <= radius; ++ i) 126 { 127 const float4 sampleTexCoord = float4(texCoord + i * xyStep, .0f, .0f); 128 result += FilterSample(sampleTexCoord, ssaoTex, colorsTex, centerPos, bl, br, tl, tr, maxConvergence, spatialWeight); 129 } 130 131 #endif 121 132 result.x /= max(result.y, 1e-6f); 122 133 return saturate(result.x); … … 133 144 uniform float3 tl, 134 145 uniform float3 tr, 135 uniform float2 res 146 uniform float2 res, 147 uniform float maxConvergence, 148 uniform float spatialWeight 149 136 150 ) 137 151 { … … 151 165 152 166 // filter up to a certain convergance value and leave out background (sky) by checking depth 153 if ((convergence < SSAO_CONVERGENCE_THRESHOLD) && (depth < DEPTH_THRESHOLD)) 167 if ((!USE_OPTIMIZATION || (convergence < SSAO_CONVERGENCE_THRESHOLD)) && 168 (depth < DEPTH_THRESHOLD)) 154 169 { 155 170 // the filtered ssao value 156 OUT.illum_col.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep, convergence, maxConvergence, spatialWeight); 171 OUT.illum_col.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, 172 bl, br, tl, tr, xyStep, 173 convergence, maxConvergence, spatialWeight); 157 174 } 158 175 … … 185 202 // afterwards we do not use the filter anymore 186 203 187 float2 xyStep = float2(1.0f / res.x, 0);204 float2 xyStep = float2(1.0f / res.x, .0f); 188 205 189 206 // filter up to a certain convergance value and leave out background (sky) by checking depth 190 if (( convergence < SSAO_CONVERGENCE_THRESHOLD) && (depth < DEPTH_THRESHOLD))207 if ((!USE_OPTIMIZATION || convergence < SSAO_CONVERGENCE_THRESHOLD) && (depth < DEPTH_THRESHOLD)) 191 208 { 192 209 // the filtered ssao value 193 OUT.illum_col.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep, convergence, maxConvergence, spatialWeight); 210 OUT.illum_col.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, 211 bl, br, tl, tr, xyStep, 212 convergence, maxConvergence, spatialWeight); 194 213 } 195 214 … … 228 247 229 248 // filter up to a certain convergance value and leave out background (sky) by checking depth 230 if ((convergence < SSAO_CONVERGENCE_THRESHOLD) && (depth < DEPTH_THRESHOLD)) 249 if ((!USE_OPTIMIZATION || (convergence < SSAO_CONVERGENCE_THRESHOLD)) 250 && (depth < DEPTH_THRESHOLD)) 231 251 { 232 252 // the filtered ssao value
Note: See TracChangeset
for help on using the changeset viewer.