Changeset 3304
- Timestamp:
- 02/12/09 10:39:53 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3299 r3304 68 68 #define SSAO_FILTER_RADIUS 3 69 69 70 #define DEPTH_THRESHOLD 1e10f 71 72 70 73 #endif // __SHADERENV_H -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg
r3301 r3304 145 145 // filter up to a certain convergance value and leave out background (sky) by checking depth 146 146 if (//(convergence < SSAO_CONVERGENCE_THRESHOLD) && 147 (col.w < 1e10f))147 (col.w < DEPTH_THRESHOLD)) 148 148 { 149 149 const float distanceScale = 1.0f; … … 159 159 160 160 // just apply ssao if we are not in the sky 161 if (col.w < 1e10f) 161 if (col.w < DEPTH_THRESHOLD) 162 { 162 163 OUT.illum_col.xyz = col.xyz * max(2e-2f, 1.0f - ao.x); 163 164 //OUT.illum_col.xyz = col.xyz * ao.x; 165 } 164 166 else 167 { 165 168 OUT.illum_col.xyz = col.xyz; 166 169 } 167 170 168 171 //OUT.illum_col.xyz = float3(abs(ao.y * 1e2f), abs(ao.z * 1e2f), abs(ao.w * 1e2f)); … … 214 217 // filter up to a certain convergance value and leave out background (sky) by checking depth 215 218 if ((convergence < SSAO_CONVERGENCE_THRESHOLD) && 216 (col.w < 1e10f))219 (col.w < DEPTH_THRESHOLD)) 217 220 { 218 221 const float distanceScale = 1.0f; … … 229 232 230 233 // just apply ssao if we are not in the sky 231 if (col.w < 1e10f)234 if (col.w < DEPTH_THRESHOLD) 232 235 { 233 236 OUT.illum_col.xyz = col.xyz * max(2e-2f, 1.0f - ao.x); -
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); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r3284 r3304 277 277 pixelValid = pixelNotValid; 278 278 } 279 else if (//!((oldEyeSpaceDepth > 1e10f) || (projectedEyeSpaceDepth > 1e10f)) &&279 else if (//!((oldEyeSpaceDepth > DEPTH_THRESHOLD) || (projectedEyeSpaceDepth > DEPTH_THRESHOLD)) && 280 280 // check if changed from dynamic to not dynamic object 281 281 ((oldDynamic && !newDynamic) || (!oldDynamic && newDynamic) || -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3303 r3304 396 396 397 397 // cull background note: this should be done with the stencil buffer 398 if (eyeSpaceDepth < 1e10f)398 if (eyeSpaceDepth < DEPTH_THRESHOLD) 399 399 { 400 400 ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight, sampleIntensity, isMovingObject);
Note: See TracChangeset
for help on using the changeset viewer.