- Timestamp:
- 03/05/09 16:06:46 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env
r3305 r3331 13 13 #filename=mypompeii 14 14 #bvhname=mypompeii 15 #filename=pompeii/pompeii_full15 filename=pompeii/pompeii_full 16 16 #filename=pompeii/pompeii_part 17 filename=city18 bvhname=city17 #filename=city 18 #bvhname=city 19 19 useLODs=1 20 20 # shadow map size … … 77 77 camPosition=483.398f 242.364f 186.078f 78 78 # pompeii view point 79 #camPosition=1300.0f -2500.0f 10.0f79 camPosition=1300.0f -2500.0f 10.0f 80 80 # pompeii problematic 81 81 #camPosition=627.003 -1725.33 25.2 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3327 r3331 662 662 if (mShadingMethod != 0) 663 663 { 664 PrepareSsao(fbo); // downsample fbo buffers664 //PrepareSsao(fbo); // downsample fbo buffers 665 665 } 666 666 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneEntity.cpp
r3268 r3331 95 95 96 96 if (!mLODLevels.empty()) 97 { 97 98 GetCurrentLODLevel(sit, sit_end); 99 } 98 100 else 99 101 { … … 104 106 105 107 for (; sit != sit_end; ++ sit) 108 { 106 109 (*sit)->Render(state, this); 110 } 107 111 108 112 mTransform->Unload(state); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3329 r3331 6 6 //-- ssao + gi parameters 7 7 #define NUM_PRECOMPUTED_SAMPLES 4096 8 //#define NUM_SAMPLES 8 8 9 #define NUM_SAMPLES 8 9 10 //#define NUM_SAMPLES 16 10 11 //#define NUM_SAMPLES 24 11 #define NUM_SAMPLES 2412 //#define NUM_SAMPLES 24 12 13 13 14 //#define MIN_SAMPLES 48 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3330 r3331 182 182 float3 normal, 183 183 float3 centerPosition, 184 float scaleFactor,184 float radius, 185 185 float3 bl, 186 186 float3 br, … … 223 223 224 224 // weight with projected coordinate to reach similar kernel size for near and far 225 const float2 texcoord = IN.texCoord.xy + offset * scaleFactor;225 const float2 texcoord = IN.texCoord.xy + offset * radius; 226 226 227 227 const float4 sampleColor = tex2Dlod(colors, float4(texcoord, .0f, .0f)); … … 235 235 236 236 const float minDist = 1e-6f; 237 const float scaleFactor= 1e-3f;237 const float delta = 1e-3f; 238 238 239 239 const float lengthToSample = length(dirSample); 240 const float sampleWeight = 1.0f / (lengthToSample + scaleFactor);240 const float sampleWeight = 1.0f / (lengthToSample + delta); 241 241 242 242 dirSample /= max(lengthToSample, minDist); // normalize … … 329 329 float3 normal, 330 330 float3 centerPosition, 331 float scaleFactor,331 float radius, 332 332 float3 bl, 333 333 float3 br, … … 370 370 371 371 // weight with projected coordinate to reach similar kernel size for near and far 372 const float2 texcoord = IN.texCoord.xy + offset * scaleFactor;372 const float2 texcoord = IN.texCoord.xy + offset * radius; 373 373 374 374 const float4 sampleColor = tex2Dlod(colors, float4(texcoord, .0f, .0f)); … … 382 382 383 383 const float minDist = 1e-6f; 384 const float scaleFactor= 1e-3f;384 const float delta = 1e-3f; 385 385 386 386 const float lengthToSample = length(dirSample); 387 const float sampleWeight = 1.0f / (lengthToSample + scaleFactor);387 const float sampleWeight = 1.0f / (lengthToSample + delta); 388 388 389 389 dirSample /= max(length(dirSample), minDist); // normalize … … 399 399 400 400 ++ numSamples; 401 401 #ifdef PERFORMANCE_TEST 402 402 // check if the samples have been valid in the last frame 403 403 // only mark sample as invalid if in the last / current frame … … 411 411 // or if the angle is small enough 412 412 // to have any influence in the current or last frame 413 413 414 #if 1 414 415 const float partlyResetThres = 1.0f; … … 435 436 } 436 437 #endif 438 439 #endif // PERFORMANCE_TEST 440 437 441 } 438 442 … … 488 492 const float4 eyeSpacePos = float4(-viewDir * eyeSpaceDepth, 1.0f); 489 493 490 float3 diffVec = tex2Dlod(attribsTex, float4(IN.texCoord, 0, 0)).xyz;491 492 493 494 //////////////// 494 495 //-- calculcate the current projected posiion (also used for next frame) … … 497 498 const float invw = 1.0f / projPos.w; 498 499 projPos *= invw; 499 float scaleFactor = kernelRadius * invw; 500 501 //const float radiusMult = kernelRadius; 502 const float radiusMult = 3e-2; 503 //const float radiusMult = kernelRadius * invw; 504 505 #ifdef PERFORMANCE_TEST 506 507 float3 diffVec = tex2Dlod(attribsTex, float4(IN.texCoord, 0, 0)).xyz; 500 508 501 509 const float sqrMoveSpeed = SqrLen(diffVec); … … 514 522 diffVec 515 523 ); 516 524 517 525 const float oldSsao = temporalVals.x; 518 526 … … 520 528 float oldIdx = temporalCoherence > 1 ? temporalVals.z : 0; 521 529 530 #else 531 532 const bool isMovingObject = false; 533 const float oldSsao = 0; 534 535 float oldWeight = 0; 536 float oldIdx = 0; 537 538 #endif 539 522 540 float3 ao; 523 541 … … 528 546 { 529 547 ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, 530 scaleFactor, bl, br, tl, tr, normalize(viewDir),548 radiusMult, bl, br, tl, tr, normalize(viewDir), 531 549 oldWeight, sampleIntensity, isMovingObject, oldIdx); 532 550 } 533 551 else 534 552 { 535 ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor,553 ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, radiusMult, 536 554 bl, br, tl, tr, normalize(viewDir), oldWeight, sampleIntensity, 537 555 isMovingObject, normals, oldIdx); … … 543 561 } 544 562 545 563 #ifdef PERFORMANCE_TEST 564 546 565 /////////// 547 566 //-- check if we have to reset pixel because one of the sample points was invalid … … 592 611 //OUT.illum_col.z = SqrLen(diffVec); 593 612 613 #else 614 615 OUT.illum_col.x = ao.x; 616 OUT.illum_col.w = eyeSpaceDepth; 617 618 #endif 619 594 620 return OUT; 595 621 }
Note: See TracChangeset
for help on using the changeset viewer.