Changeset 3370
- Timestamp:
- 05/18/09 18:53:06 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/MainApp.vcproj
r3364 r3370 156 156 IgnoreAllDefaultLibraries="false" 157 157 IgnoreDefaultLibraryNames="LIBCMT" 158 GenerateDebugInformation=" false"158 GenerateDebugInformation="true" 159 159 SubSystem="1" 160 160 LargeAddressAware="2" -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3367 r3370 516 516 string ssaoParams[] = 517 517 {"colors", "normals", "oldTex", "noiseTex", "temporalCoherence", 518 " samples", "bl", "br", "tl", "tr",518 "dummySamples", "samples", "bl", "br", "tl", "tr", 519 519 "modelViewProj", "oldModelViewProj", "oldEyePos", "oldbl", "oldbr", 520 520 "oldtl", "oldtr", "attribsTex", "kernelRadius", "sampleIntensity", 521 521 "dummyIdx"}; 522 522 523 sCgSsaoProgram->AddParameters(ssaoParams, 0, 21); 523 //sCgSsaoProgram->AddParameters(ssaoParams, 0, 21); 524 sCgSsaoProgram->AddParameters(ssaoParams, 0, 22); 524 525 525 526 string giParams[] = … … 843 844 844 845 845 if (/*mUseTemporalCoherence || */mRegenerateSamples) 846 //if (mRegenerateSamples) 847 if (1)//mUseTemporalCoherence || mRegenerateSamples) 846 848 { 847 849 mRegenerateSamples = false; … … 858 860 else 859 861 { 860 UpdateSampleTex(samples2, NUM_PRECOMPUTED_SAMPLES);862 //UpdateSampleTex(samples2, NUM_PRECOMPUTED_SAMPLES); 861 863 } 862 864 865 static int dummy = 0; 866 863 867 //if (mSortSamples) { SortSamples(); } 864 //sCgSsaoProgram->SetArray2f(i, (float *)samples2, NUM_SAMPLES); 868 sCgSsaoProgram->SetArray2f(i, (float *)samples2 + dummy, NUM_SAMPLES); 869 870 cout << "d " << dummy << " "; 871 872 dummy = (dummy + NUM_SAMPLES) % NUM_PRECOMPUTED_SAMPLES; 865 873 //sCgSsaoProgram->SetArray2f(i, (float *)samples2, NUM_PRECOMPUTED_SAMPLES); 866 874 } 875 876 ++ i; 867 877 868 878 sCgSsaoProgram->SetTexture(i, sampleTex2D); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.cpp
r3355 r3370 181 181 for (int i = 0; i < mNumSamples; ++ i) 182 182 { 183 //x[0] = RandomValue(0, 1); x[1] = RandomValue(0, 1);184 mHalton->GetNext(x);183 x[0] = RandomValue(0, 1); x[1] = RandomValue(0, 1); 184 //mHalton->GetNext(x); 185 185 186 186 const float a = 2.0f * M_PI * x[0]; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3369 r3370 8 8 //#define NUM_PRECOMPUTED_SAMPLES 8124 9 9 #define NUM_PRECOMPUTED_SAMPLES 4096 10 //#define NUM_PRECOMPUTED_SAMPLES 2048 10 #define NUM_PRECOMPUTED_SAMPLES 64 11 11 12 12 //#define NUM_SAMPLES 16 13 13 //#define NUM_SAMPLES 24 14 14 //#define NUM_SAMPLES 32 15 #define NUM_SAMPLES 4815 #define NUM_SAMPLES 64 16 16 17 #define MIN_SAMPLES 817 #define MIN_SAMPLES 64 18 18 //#define MIN_SAMPLES 48 19 19 … … 74 74 #define PERFORMANCE_TEST 1 75 75 76 #define USE_OPTIMIZATION 176 #define USE_OPTIMIZATION 0 77 77 78 78 -
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.