Changeset 3370 for GTP


Ignore:
Timestamp:
05/18/09 18:53:06 (15 years ago)
Author:
mattausch
Message:

debug version

Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/MainApp.vcproj

    r3364 r3370  
    156156                                IgnoreAllDefaultLibraries="false" 
    157157                                IgnoreDefaultLibraryNames="LIBCMT" 
    158                                 GenerateDebugInformation="false" 
     158                                GenerateDebugInformation="true" 
    159159                                SubSystem="1" 
    160160                                LargeAddressAware="2" 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp

    r3367 r3370  
    516516        string ssaoParams[] =  
    517517                {"colors", "normals", "oldTex", "noiseTex", "temporalCoherence",  
    518                  "samples", "bl", "br", "tl", "tr",  
     518                 "dummySamples", "samples", "bl", "br", "tl", "tr",  
    519519                 "modelViewProj", "oldModelViewProj", "oldEyePos", "oldbl", "oldbr",  
    520520                 "oldtl", "oldtr", "attribsTex", "kernelRadius", "sampleIntensity", 
    521521             "dummyIdx"}; 
    522522         
    523         sCgSsaoProgram->AddParameters(ssaoParams, 0, 21); 
     523        //sCgSsaoProgram->AddParameters(ssaoParams, 0, 21); 
     524        sCgSsaoProgram->AddParameters(ssaoParams, 0, 22); 
    524525         
    525526        string giParams[] =  
     
    843844         
    844845 
    845         if (/*mUseTemporalCoherence || */mRegenerateSamples) 
     846        //if (mRegenerateSamples) 
     847        if (1)//mUseTemporalCoherence || mRegenerateSamples) 
    846848        { 
    847849                mRegenerateSamples = false; 
     
    858860                else 
    859861                { 
    860                         UpdateSampleTex(samples2, NUM_PRECOMPUTED_SAMPLES); 
     862                        //UpdateSampleTex(samples2, NUM_PRECOMPUTED_SAMPLES); 
    861863                } 
    862864 
     865                static int dummy = 0; 
     866 
    863867                //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; 
    865873                //sCgSsaoProgram->SetArray2f(i, (float *)samples2, NUM_PRECOMPUTED_SAMPLES); 
    866874        } 
     875 
     876        ++ i; 
    867877 
    868878        sCgSsaoProgram->SetTexture(i, sampleTex2D); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.cpp

    r3355 r3370  
    181181        for (int i = 0; i < mNumSamples; ++ i) 
    182182        { 
    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); 
    185185                 
    186186                const float a = 2.0f * M_PI * x[0]; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h

    r3369 r3370  
    88//#define NUM_PRECOMPUTED_SAMPLES 8124 
    99#define NUM_PRECOMPUTED_SAMPLES 4096 
    10 //#define NUM_PRECOMPUTED_SAMPLES 2048 
     10#define NUM_PRECOMPUTED_SAMPLES 64 
    1111 
    1212//#define NUM_SAMPLES 16 
    1313//#define NUM_SAMPLES 24 
    1414//#define NUM_SAMPLES 32 
    15 #define NUM_SAMPLES 48 
     15#define NUM_SAMPLES 64 
    1616 
    17 #define MIN_SAMPLES 8 
     17#define MIN_SAMPLES 64 
    1818//#define MIN_SAMPLES 48 
    1919 
     
    7474#define PERFORMANCE_TEST 1 
    7575 
    76 #define USE_OPTIMIZATION 1 
     76#define USE_OPTIMIZATION 0 
    7777 
    7878 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3369 r3370  
    459459                        sampler2D colors, 
    460460                        sampler2D noiseTex, 
     461                        float2 dummySamples[NUM_SAMPLES], 
    461462                        sampler2D samples, 
    462463                        float3 normal, 
     
    486487                float2 offset; 
    487488 
    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]; 
    491491 
    492492                //////////////////// 
     
    494494                //-- (affects performance for some reason!) 
    495495 
    496                 if (!USE_OPTIMIZATION || 
    497                         (convergence < SSAO_CONVERGENCE_THRESHOLD)) 
     496                if (0)//!USE_OPTIMIZATION || 
     497                        //(convergence < SSAO_CONVERGENCE_THRESHOLD)) 
    498498                { 
    499499                        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); 
    502501                        offset = myrotate(ssaoOffset, mynoise.x); 
    503502                } 
     
    557556                if ((cosAngle >= 0) && (pixelValid < 90.0f))// || (cosAngle2 >= 0)) 
    558557                { 
    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; 
    561560                } 
    562561 
     
    604603                        uniform sampler2D noiseTex, 
    605604                        uniform sampler2D samples, 
     605                        uniform float2 dummySamples[NUM_SAMPLES], 
    606606                        uniform sampler2D oldTex, 
    607607                        uniform float4x4 modelViewProj, 
     
    685685        float3 ao; 
    686686        //$$temp matt 
    687         //oldIdx = dummyIdx; 
     687        oldIdx = dummyIdx; 
    688688 
    689689        // cull background note: this should be done with the stencil buffer 
    690690        if (eyeSpaceDepth < DEPTH_THRESHOLD) 
    691691        { 
    692                 if (1) 
    693                 { 
    694692#ifdef TRYOUT 
    695                         ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz,  
    696                                       radiusMult, bl, br, tl, tr, normalize(viewDir), 
    697                                           oldWeight, sampleIntensity, isMovingObject, oldIdx); 
     693                ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz,  
     694                              radiusMult, bl, br, tl, tr, normalize(viewDir), 
     695                              oldWeight, sampleIntensity, isMovingObject, oldIdx); 
    698696#else 
    699697 
    700                           ao = ssao(IN, colors, noiseTex, samples, 
    701                                       normal, eyeSpacePos.xyz, radiusMult, bl,  
    702                                           br, tl, tr, normalize(viewDir),  
    703                                           oldWeight, sampleIntensity, isMovingObject, oldIdx, 
    704                                           attribsTex, mycolor.xyz); 
     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); 
    705703#endif                             
    706                 } 
    707                 else 
    708                 { 
    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                 } 
    714704        } 
    715705        else 
     
    752742 
    753743                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                } 
    755749 
    756750                //combinedWeight = oldWeight; 
     
    764758        //-- blend ao between old and new samples (and avoid division by zero) 
    765759 
    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); 
    770762 
    771763        OUT.illum_col.y = combinedWeight; 
Note: See TracChangeset for help on using the changeset viewer.