Changeset 3159
- Timestamp:
- 11/24/08 18:45:45 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3155 r3159 64 64 65 65 66 #define DYNAMIC_OBJECTS_THRESHOLD 1e-7f 67 66 68 67 69 #endif // __SHADERENV_H -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg
r3156 r3159 106 106 const float scale = adaptFactor * scaleFactor * ao.z / (adaptFactor + ao.y); 107 107 108 ao.x = DiscontinuityFilter(IN.texCoord, ao, col, ssaoTex, normalsTex, colorsTex, filterOffs, filterWeights, scale);108 //ao.x = DiscontinuityFilter(IN.texCoord, ao, col, ssaoTex, normalsTex, colorsTex, filterOffs, filterWeights, scale); 109 109 } 110 110 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r3156 r3159 218 218 219 219 220 221 inline float SqrLen(float3 v) 222 { 223 return v.x * v.x + v.y * v.y + v.z * v.z; 224 } 225 226 227 220 228 /** This shader computes the reprojection and checks 221 229 if the reprojected pixel from last frame is still … … 277 285 const float depthDif = abs(1.0f - oldEyeSpaceDepth / projectedEyeSpaceDepth); 278 286 279 const float squaredLen = diffVec.x * diffVec.x + diffVec.y * diffVec.y + diffVec.z * diffVec.z; 280 //if (squaredLen < 1e-8f) // object not dynamic 281 //{} 282 287 const float squaredLen = SqrLen(diffVec); 288 289 // test if this pixel was not valid in the old frame 283 290 float validPixel; 284 291 285 if (1 292 if (((squaredLen <= DYNAMIC_OBJECTS_THRESHOLD) && (oldPixel.z <= DYNAMIC_OBJECTS_THRESHOLD)) || 293 (1 286 294 && (oldTexCoords.x >= 0.0f) && (oldTexCoords.x < 1.0f) 287 295 && (oldTexCoords.y >= 0.0f) && (oldTexCoords.y < 1.0f) 288 && (depthDif <= MIN_DEPTH_DIFF) 296 && (depthDif <= MIN_DEPTH_DIFF) 297 ) 289 298 //&& (depthDif <= 9e-1f) 290 299 ) -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3158 r3159 26 26 { 27 27 return 6.283185307179586476925286766559f * (1.0f - cos(asin(radius / dist))); 28 } 29 30 31 inline float SqrLen(float3 v) 32 { 33 return v.x * v.x + v.y * v.y + v.z * v.z; 28 34 } 29 35 … … 75 81 float temporalCoherence, 76 82 sampler2D colors, 77 float3 bl,78 float3 br,79 float3 tl,80 float3 tr,81 83 float3 projPos, 82 84 float invW, 83 sampler2D noiseTex,84 float2 samples[NUM_SAMPLES],85 float scaleFactor,86 85 float3 oldbl, 87 86 float3 oldbr, … … 132 131 #endif 133 132 134 const float squaredLen = diffVec.x * diffVec.x + diffVec.y * diffVec.y + diffVec.z * diffVec.z; 133 const float squaredLen = SqrLen(diffVec); 134 135 135 const float oldWeight = clamp(oldPixel.y, .0f, temporalCoherence); 136 136 //const float oldWeight = oldPixel.y; … … 149 149 // increase the weight for convergence 150 150 newWeight = oldWeight + 1.0f; 151 if ((pixelValid > 1.0f) && (squaredLen < 1e-8f)) newWeight = 4.0f; 151 152 if ((pixelValid > 1.0f) && (squaredLen < DYNAMIC_OBJECTS_THRESHOLD)) 153 { 154 newWeight = 4.0f; 155 } 152 156 //if (pixelValid > 1.0f) newWeight = max(15.0f - notValid * 2.0f, 1.0f); 153 157 } … … 208 212 209 213 const float3 samplePos = ReconstructSamplePos(sampleColor.w, texcoord, bl, br, tl, tr); 214 // the normal of the current sample 210 215 const float3 sampleNormal = normalize(tex2Dlod(normalTex, float4(texcoord, 0, 0)).xyz); 211 216 … … 391 396 oldTex, oldModelViewProj, temporalCoherence, 392 397 colors, 393 bl, br, tl, tr,394 398 projPos.xyz, 395 399 invw, 396 noiseTex,397 samples,398 scaleFactor,399 400 oldbl, oldbr, oldtl, oldtr, 400 401 diffVec, … … 408 409 OUT.illum_col.x = (ao.x + oldSsao * (newWeight - 1.0f)) / newWeight; 409 410 OUT.illum_col.y = newWeight; 410 OUT.illum_col.z = invw;411 OUT.illum_col.z = SqrLen(diffVec);//invw; 411 412 OUT.illum_col.w = eyeSpaceDepth; 412 413
Note: See TracChangeset
for help on using the changeset viewer.