- Timestamp:
- 02/18/09 18:34:49 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg
r3318 r3319 59 59 float3 tl, 60 60 float3 tr, 61 float maxConvergence) 61 float maxConvergence, 62 float spatialWeight) 62 63 { 63 64 float2 aoSample = tex2Dlod(ssaoTex, sampleTexCoord); … … 71 72 //float len = min(SqrLen(centerPos - samplePos), 1e2f); 72 73 float len = distance(centerPos, samplePos); 73 float spatialFactor = 1.0f / max(len, 1e-3f); 74 //float spatialFactor = 1.0f / max(len, 1e-3f); 75 float spatialFactor = 1.0f / max(spatialWeight + len, 1e-3f); 74 76 75 77 float convergenceFactor = min(aoSample.y + 1.0f, maxConvergence); 76 convergenceFactor *= convergenceFactor;78 //convergenceFactor *= convergenceFactor; 77 79 78 80 // combine the weights 81 //float w = convergenceFactor * exp(1.0f + spatialFactor); 79 82 float w = convergenceFactor * spatialFactor; 80 83 //float w = spatialFactor; … … 98 101 float2 xyStep, 99 102 float convergence, 100 float maxConvergence 103 float maxConvergence, 104 float spatialWeight 101 105 ) 102 106 { … … 105 109 const float3 centerPos = ReconstructSamplePos(colorsTex, texCoord, bl, br, tl, tr); 106 110 107 const float scale = saturate((SSAO_CONVERGENCE_THRESHOLD - convergence) / SSAO_CONVERGENCE_THRESHOLD);111 const float scale = 1.0f;//saturate((SSAO_CONVERGENCE_THRESHOLD - convergence) / SSAO_CONVERGENCE_THRESHOLD); 108 112 //const int radius = SSAO_FILTER_RADIUS * saturate((SSAO_CONVERGENCE_THRESHOLD - convergence) / SSAO_CONVERGENCE_THRESHOLD); 109 113 … … 112 116 { 113 117 float4 sampleTexCoord = float4(texCoord + i * xyStep * scale, .0f, .0f); 114 result += FilterSample(sampleTexCoord, ssaoTex, colorsTex, centerPos, bl, br, tl, tr, maxConvergence );118 result += FilterSample(sampleTexCoord, ssaoTex, colorsTex, centerPos, bl, br, tl, tr, maxConvergence, spatialWeight); 115 119 } 116 120 … … 151 155 { 152 156 // the filtered ssao value 153 OUT.illum_col.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep, convergence, maxConvergence );157 OUT.illum_col.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep, convergence, maxConvergence, spatialWeight); 154 158 } 155 159 … … 167 171 uniform float3 tr, 168 172 uniform float2 res, 169 uniform float maxConvergence 173 uniform float maxConvergence, 174 uniform float spatialWeight 170 175 ) 171 176 { … … 187 192 { 188 193 // the filtered ssao value 189 OUT.illum_col.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep, convergence, maxConvergence );194 OUT.illum_col.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep, convergence, maxConvergence, spatialWeight); 190 195 } 191 196 … … 205 210 uniform float3 tr, 206 211 uniform float2 res, 207 uniform float maxConvergence 212 uniform float maxConvergence, 213 uniform float spatialWeight 208 214 ) 209 215 { … … 226 232 { 227 233 // the filtered ssao value 228 ao.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep, convergence, maxConvergence); 229 } 234 ao.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep, convergence, maxConvergence, spatialWeight); 235 } 236 237 //const float minAO = 2e-2f; 238 const float minAO = 1e-3f; 230 239 231 240 // just apply ssao if we are not in the sky 232 241 if (depth < DEPTH_THRESHOLD) 233 242 { 234 //OUT.illum_col.xyz = col.xyz * max(1e-3f, 1.0f - ao.x);235 OUT.illum_col.xyz = max(1e-3f, 1.0f - ao.x);243 OUT.illum_col.xyz = col.xyz * max(minAO, 1.0f - ao.x); 244 //OUT.illum_col.xyz = max(minAO, 1.0f - ao.x); 236 245 } 237 246 else
Note: See TracChangeset
for help on using the changeset viewer.