Changeset 3208
- Timestamp:
- 12/03/08 12:25:46 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3206 r3208 8 8 //#define NUM_SAMPLES 8 9 9 //#define NUM_SAMPLES 16 10 #define NUM_SAMPLES 2411 //#define NUM_SAMPLES 9610 //#define NUM_SAMPLES 24 11 #define NUM_SAMPLES 96 12 12 13 13 #define SAMPLE_INTENSITY 0.2f -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3206 r3208 269 269 float3 tr, 270 270 float3 viewDir, 271 float newWeight 271 float newWeight, 272 bool isMovingObject 272 273 ) 273 274 { … … 337 338 338 339 //if ((validSamples < 1.0f) && (newWeight > 200) && (numSamples >= 8)) break; 339 //if ((validSamples < 1.0f) && (numSamples >= 8)) break; 340 if ((validSamples < 1.0f) && (numSamples >= 8) && !isMovingObject 341 || (newWeight > NUM_SAMPLES * 5) && (numSamples >= 8) && isMovingObject 342 ) 343 { 344 break; 345 } 340 346 } 341 347 … … 391 397 float scaleFactor = SAMPLE_RADIUS * invw; 392 398 399 const float sqrMoveSpeed = SqrLen(diffVec); 400 const bool isMovingObject = (sqrMoveSpeed > DYNAMIC_OBJECTS_THRESHOLD); 401 393 402 394 403 ///////////////// … … 412 421 if (eyeSpaceDepth < 1e10f) 413 422 { 414 ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight );423 ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight, isMovingObject); 415 424 //ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), normals); 416 425 } … … 420 429 } 421 430 422 const float squaredLen = SqrLen(diffVec); 431 // equals the number of sampled shot in this pass 432 const float newWeight = ao.z; 423 433 424 434 // check if we have to reset pixel because one of the sample points was invalid 425 if (squaredLen < DYNAMIC_OBJECTS_THRESHOLD) 435 if (!isMovingObject) 436 //if (sqrMoveSpeed <= DYNAMIC_OBJECTS_THRESHOLD) 426 437 { 427 438 if (ao.y > 4.0f) 428 439 oldWeight = 0; 429 440 else if (ao.y > 1.0f) 430 oldWeight = min(oldWeight, 4.0f * NUM_SAMPLES); 431 } 432 433 const float newWeight = ao.z; 441 oldWeight = min(oldWeight, 4.0f * newWeight); 442 } 443 434 444 const float combinedWeight = clamp(newWeight + oldWeight, .0f, temporalCoherence); 435 445
Note: See TracChangeset
for help on using the changeset viewer.