Changeset 3306 for GTP/trunk/App/Demos/Vis
- Timestamp:
- 02/12/09 18:28:32 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3305 r3306 81 81 // dof samples 82 82 static Sample2 dofSamples[NUM_DOF_TABS]; 83 84 85 static float ssaoFilterOffsets[NUM_SSAO_FILTER_SAMPLES * 2];86 static float ssaoFilterWeights[NUM_SSAO_FILTER_SAMPLES];87 83 88 84 static Texture *sHaloTex[5]; … … 350 346 mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGB_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 351 347 352 353 348 for (int i = 0; i < 2; ++ i) 354 349 { -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3305 r3306 625 625 if (0) LoadPompeiiFloor(); 626 626 627 #if 1627 #if 0 628 628 const Vector3 sceneCenter(470.398f, 240.364f, 181.7f); 629 629 //const Vector3 sceneCenter(470.398f, 240.364f, 180.3); … … 1573 1573 cout << "new ssao sample intensity: " << ssaoSampleIntensity << endl; 1574 1574 break; 1575 /*case 'o':1576 if (ssaoFilterRadius >= 0.0f) ssaoFilterRadius -= 1.0f;1577 if (deferredShader) deferredShader->SetSsaoFilterRadius(ssaoFilterRadius);1578 cout << "new ssao filter radius: " << ssaoFilterRadius << endl;1579 break;1580 case 'O':1581 ssaoFilterRadius += 1.0f;1582 if (deferredShader) deferredShader->SetSsaoFilterRadius(ssaoFilterRadius);1583 cout << "new ssao filter radius: " << ssaoFilterRadius << endl;1584 break;*/1585 1575 /* case 'o': 1586 1576 case 'O': -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3304 r3306 10 10 //#define NUM_SAMPLES 24 11 11 #define NUM_SAMPLES 48 12 //#define NUM_SAMPLES 16 12 13 14 //#define MIN_SAMPLES 48 13 15 #define MIN_SAMPLES 8 14 16 … … 19 21 /// scale factor that takes angle of sample normal into account 20 22 #define VIEW_CORRECTION_SCALE 1.0f 21 22 //#define NUM_SSAO_FILTER_SAMPLES 13 // 7x723 #define NUM_SSAO_FILTER_SAMPLES 924 //#define NUM_SSAO_FILTER_SAMPLES 525 23 26 24 #define SSAO_CONVERGENCE_THRESHOLD 700.0f -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg
r3305 r3306 166 166 167 167 OUT.illum_col = tex2Dlod(ssaoTex, float4(IN.texCoord, 0, 0)); 168 // just take unfiltered convergence in current pixel168 // compute minimal convergence for savetly reasons, write it out 169 169 const float convergence = ComputeConvergenceHalfRes(ssaoTex, IN.texCoord, res * 0.5f); 170 OUT.illum_col.y = convergence; 170 171 171 172 const float2 xyStep = float2(1.0f / res.x, 0); … … 221 222 if (depth < DEPTH_THRESHOLD) 222 223 { 223 OUT.illum_col.xyz = col.xyz * max(2e-2f, 1.0f - ao.x);224 //OUT.illum_col.xyz = col.xyz * ao.x;224 //OUT.illum_col.xyz = col.xyz * max(2e-2f, 1.0f - ao.x); 225 OUT.illum_col.xyz = max(2e-2f, 1.0f - ao.x); 225 226 } 226 227 else -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r3304 r3306 231 231 // compute position from old frame for dynamic objects + translational portion 232 232 //const float3 translatedPos = difVec - oldEyePos + worldPos.xyz; 233 // don't use difVec here: want to detect if the actual pixel has changed => ssao changed 233 234 const float3 translatedPos = -oldEyePos + worldPos.xyz; 234 235 … … 259 260 260 261 // test if this pixel was valid in the old frame 261 float pixelValid; 262 262 float IsPixelValid; 263 264 // check if the pixel belonged to a dyanmic object in the last frame 263 265 const bool oldDynamic = (squaredLen > DYNAMIC_OBJECTS_THRESHOLD); 264 266 const bool newDynamic = (oldPixel.z > DYNAMIC_OBJECTS_THRESHOLD); … … 270 272 const float pixelCouldBeValid = 2.0f; 271 273 // this pixel information has to be discarded in order to not create artifacts 272 const float pixelNotValid = 10.0f; 273 274 if ((oldTexCoords.x < .0f) || (oldTexCoords.x >= 1.0f) || 275 (oldTexCoords.y < .0f) || (oldTexCoords.y >= 1.0f)) 274 const float pixelIsNotValid = 100.0f; 275 276 const float xOffs = 0;// 0.5f / 1024.0f; 277 const float yOffs = 0;// 0.5f / 768.0f; 278 279 if ((oldTexCoords.x < xOffs) || (oldTexCoords.x > (1.0f - xOffs)) || 280 (oldTexCoords.y < yOffs) || (oldTexCoords.y > (1.0f - yOffs)) 281 ) 276 282 { 277 pixelValid = pixelNotValid; 278 } 279 else if (//!((oldEyeSpaceDepth > DEPTH_THRESHOLD) || (projectedEyeSpaceDepth > DEPTH_THRESHOLD)) && 280 // check if changed from dynamic to not dynamic object 283 IsPixelValid = pixelIsNotValid; 284 } 285 else if (// check if changed from dynamic to not dynamic object 281 286 ((oldDynamic && !newDynamic) || (!oldDynamic && newDynamic) || 282 // check if we have a dynamic object and is a depth discontinuity283 287 ( 288 (oldEyeSpaceDepth < DEPTH_THRESHOLD) && (projectedEyeSpaceDepth < DEPTH_THRESHOLD) && 289 // check if we have a dynamic object 284 290 (oldDynamic || newDynamic) && 285 // (depthDif > 1e-5f))))291 // and is a depth discontinuity 286 292 (depthDif > MIN_DEPTH_DIFF)))) 287 293 { 288 pixelValid = pixelCouldBeValid;294 IsPixelValid = pixelCouldBeValid; 289 295 } 290 296 else 291 297 { 292 pixelValid = pixelIsValid;293 } 294 295 return float2( pixelValid, abs(oldEyeSpaceDepth - projectedEyeSpaceDepth));298 IsPixelValid = pixelIsValid; 299 } 300 301 return float2(IsPixelValid, abs(oldEyeSpaceDepth - projectedEyeSpaceDepth)); 296 302 } 297 303 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3304 r3306 295 295 // to have any influence in the current or last frame 296 296 const float tooFarAway = step(0.5f, lengthToSample - changeFactor); 297 validSamples = max(validSamples, (1.0f - tooFarAway) * pixelValid * step(-0.1f, cosAngle)); 297 //validSamples = max(validSamples, (1.0f - tooFarAway) * pixelValid * step(-0.1f, cosAngle)); 298 validSamples = max(validSamples, pixelValid); 298 299 299 300 #ifdef USE_GTX … … 415 416 416 417 // completely reset the ao in this pixel 417 const float completelyResetThres = 4.0f;418 const float completelyResetThres = 20.0f; 418 419 // don't fully reset the ao in this pixel, but give low weight to old solution 419 420 const float partlyResetThres = 1.0f; 420 421 421 if ( !isMovingObject)422 if (1)//!isMovingObject) 422 423 { 423 424 if (ao.y > completelyResetThres) -
GTP/trunk/App/Demos/Vis/FriendlyCulling/vienna.env
r3299 r3306 115 115 tempCohFactor=2000.0f 116 116 # ssao filter radius 117 ssaoFilterRadius= 12.0f117 ssaoFilterRadius=3.0f
Note: See TracChangeset
for help on using the changeset viewer.