- Timestamp:
- 05/18/09 18:53:06 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3369 r3370 459 459 sampler2D colors, 460 460 sampler2D noiseTex, 461 float2 dummySamples[NUM_SAMPLES], 461 462 sampler2D samples, 462 463 float3 normal, … … 486 487 float2 offset; 487 488 488 const float2 ssaoOffset = 489 tex2Dlod(samples, float4((0.5f + i + oldIdx) / NUM_PRECOMPUTED_SAMPLES, .5f, .0f, .0f)).xy; 490 489 //const float2 ssaoOffset = tex2Dlod(samples, float4((0.5f + i + oldIdx) / NUM_PRECOMPUTED_SAMPLES, .5f, .0f, .0f)).xy; 490 const float2 ssaoOffset = dummySamples[i]; 491 491 492 492 //////////////////// … … 494 494 //-- (affects performance for some reason!) 495 495 496 if ( !USE_OPTIMIZATION ||497 (convergence < SSAO_CONVERGENCE_THRESHOLD))496 if (0)//!USE_OPTIMIZATION || 497 //(convergence < SSAO_CONVERGENCE_THRESHOLD)) 498 498 { 499 499 float2 mynoise = tex2Dlod(noiseTex, float4(IN.texCoord * 4.0f, 0, 0)).xy; 500 //offset = myreflect(samples[i], mynoise); 501 //offset = myrotate(samples[i], mynoise.x); 500 //offset = myreflect(samples[i], mynoise); offset = myrotate(samples[i], mynoise.x); 502 501 offset = myrotate(ssaoOffset, mynoise.x); 503 502 } … … 557 556 if ((cosAngle >= 0) && (pixelValid < 90.0f))// || (cosAngle2 >= 0)) 558 557 { 559 //pixelValid = (distanceDiff > 1e-3f) ? 100.0f : .0f;560 pixelValid = (distanceDiff > 1e-3f) ? 5.0f : .0f;558 pixelValid = (distanceDiff > 1e-3f) ? 100.0f : .0f; 559 //pixelValid = (distanceDiff > 1e-3f) ? 5.0f : .0f; 561 560 } 562 561 … … 604 603 uniform sampler2D noiseTex, 605 604 uniform sampler2D samples, 605 uniform float2 dummySamples[NUM_SAMPLES], 606 606 uniform sampler2D oldTex, 607 607 uniform float4x4 modelViewProj, … … 685 685 float3 ao; 686 686 //$$temp matt 687 //oldIdx = dummyIdx;687 oldIdx = dummyIdx; 688 688 689 689 // cull background note: this should be done with the stencil buffer 690 690 if (eyeSpaceDepth < DEPTH_THRESHOLD) 691 691 { 692 if (1)693 {694 692 #ifdef TRYOUT 695 696 697 693 ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, 694 radiusMult, bl, br, tl, tr, normalize(viewDir), 695 oldWeight, sampleIntensity, isMovingObject, oldIdx); 698 696 #else 699 697 700 ao = ssao(IN, colors, noiseTex, samples,701 702 703 704 698 ao = ssao(IN, colors, noiseTex, dummySamples, samples, 699 normal, eyeSpacePos.xyz, radiusMult, bl, 700 br, tl, tr, normalize(viewDir), 701 oldWeight, sampleIntensity, isMovingObject, oldIdx, 702 attribsTex, mycolor.xyz); 705 703 #endif 706 }707 else708 {709 /*ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, radiusMult,710 bl, br, tl, tr, normalize(viewDir), oldWeight, sampleIntensity,711 isMovingObject, normals, oldIdx);712 */713 }714 704 } 715 705 else … … 752 742 753 743 oldWeight = min(oldWeight, factor * NUM_SAMPLES); 754 if (newIdx >= factor * NUM_SAMPLES) {newIdx = 0; /*oldWeight = .0f;*/ } 744 if (newIdx >= factor * NUM_SAMPLES) 745 { 746 newIdx = .0f; 747 //oldWeight = .0f; 748 } 755 749 756 750 //combinedWeight = oldWeight; … … 764 758 //-- blend ao between old and new samples (and avoid division by zero) 765 759 766 OUT.illum_col.x = ao.x * newWeight + oldSsao * oldWeight; 767 OUT.illum_col.x /= (newWeight + oldWeight); 768 //OUT.illum_col.x = clamp(OUT.illum_col.x, 0, 1); 769 //OUT.illum_col.x = ao.y; 760 OUT.illum_col.x = ao.x;// * newWeight + oldSsao * oldWeight; 761 //OUT.illum_col.x /= (newWeight + oldWeight); 770 762 771 763 OUT.illum_col.y = combinedWeight;
Note: See TracChangeset
for help on using the changeset viewer.