- Timestamp:
- 04/24/09 18:00:06 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3361 r3362 205 205 //-- (affects performance for some reason!) 206 206 207 if (convergence < SSAO_CONVERGENCE_THRESHOLD) 207 if (!USE_OPTIMIZATION || 208 (convergence < SSAO_CONVERGENCE_THRESHOLD)) 208 209 { 209 210 float2 mynoise = tex2Dlod(noiseTex, float4(IN.texCoord * 4.0f, 0, 0)).xy; … … 355 356 //-- (affects performance for some reason!) 356 357 357 if (convergence < SSAO_CONVERGENCE_THRESHOLD) 358 if (!USE_OPTIMIZATION || 359 (convergence < SSAO_CONVERGENCE_THRESHOLD)) 358 360 { 359 361 float2 mynoise = tex2Dlod(noiseTex, float4(IN.texCoord * 4.0f, 0, 0)).xy; … … 493 495 //-- (affects performance for some reason!) 494 496 495 if (convergence < SSAO_CONVERGENCE_THRESHOLD) 497 if (!USE_OPTIMIZATION || 498 (convergence < SSAO_CONVERGENCE_THRESHOLD)) 496 499 { 497 500 float2 mynoise = tex2Dlod(noiseTex, float4(IN.texCoord * 4.0f, 0, 0)).xy; … … 539 542 540 543 541 #ifdef PERFORMANCE_TEST 544 //#ifdef PERFORMANCE_TEST 545 #if 1 542 546 // check if the samples have been valid in the last frame 543 547 // only mark sample as invalid if in the last / current frame 544 548 // they possibly have any influence on the ao 545 549 546 //const float pixelValid = sampleColor.x; 547 //const float pixelValid = length(sampleDiffVec - diffVec) < 1e-3f ? .0f : 10.0f; 548 //float pixelValid = max(sampleColor.x, length(sampleDiffVec - diffVec) < 1e-3f ? .0f : 10.0f); 549 float pixelValid = sampleColor.x; 550 551 if (pixelValid < 1) 552 { 553 const float3 sampleDiffVec = tex2Dlod(attribsTex, float4(texcoord, .0f, .0f)).xyz; 554 pixelValid = length(sampleDiffVec - diffVec) < 1e-3f ? .0f : 10.0f; 555 } 556 557 // hack: 558 // we check if the sample could have been near enough to the current pixel 559 // or if the angle is small enough 560 // to have any influence in the current or last frame 561 562 #if 1 563 const float changeFactor = sampleColor.y; 564 const float partlyResetThres = 1.0f; 565 566 if (0)//pixelValid <= partlyResetThres) 567 { 568 const float tooFarAway = step(0.5f, lengthToSample - changeFactor); 569 validSamples = max(validSamples, pixelValid * (1.0f - tooFarAway) * step(-0.1f, cosAngle)); 570 } 571 else 572 { 573 validSamples = max(validSamples, pixelValid); 574 } 575 #endif 576 550 if (cosAngle > 0) 551 { 552 float pixelValid = sampleColor.x; 553 554 if (1)//pixelValid < 0.5f) 555 { 556 const float3 sampleDiffVec = tex2Dlod(attribsTex, float4(texcoord, .0f, .0f)).xyz; 557 pixelValid = max(pixelValid, length(sampleDiffVec - diffVec) < 5e-3f ? .0f : 10.0f); 558 //pixelValid = length(sampleDiffVec - diffVec) < 1e-3f ? .0f : 10.0f; 559 } 560 561 // hack: 562 // we check if the sample could have been near enough to the current pixel 563 // or if the angle is small enough 564 // to have any influence in the current or last frame 565 566 const float changeFactor = sampleColor.y; 567 const float partlyResetThres = 1.0f; 568 569 if (0)//pixelValid <= partlyResetThres) 570 { 571 const float tooFarAway = step(0.5f, lengthToSample - changeFactor); 572 validSamples = max(validSamples, pixelValid * (1.0f - tooFarAway) * step(-0.1f, cosAngle)); 573 } 574 else 575 { 576 validSamples = max(validSamples, pixelValid); 577 } 578 } 577 579 #ifdef USE_GTX 578 580 // we can bail out early and use a minimal #samples) … … 657 659 658 660 #ifdef PERFORMANCE_TEST 661 659 662 float3 diffVec = tex2Dlod(attribsTex, float4(IN.texCoord, 0, 0)).xyz; 660 663 … … 750 753 { 751 754 const float factor = 4.0f; 755 //if (oldIdx >= factor * newWeight) oldIdx = 0; 752 756 oldWeight = min(oldWeight, factor * newWeight); 753 //oldWeight = .0f; 754 //oldIdx = .0f; 757 oldWeight = oldIdx = .0f; 755 758 } 756 759 }
Note: See TracChangeset
for help on using the changeset viewer.