Changeset 3231


Ignore:
Timestamp:
12/22/08 18:42:52 (15 years ago)
Author:
mattausch
Message:

worked on sampling pattern

Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp

    r3227 r3231  
    7171 
    7272// ssao random spherical samples 
    73 static Sample2 samples2[NUM_SAMPLES]; 
     73//static Sample2 samples2[NUM_SAMPLES]; 
     74#define NUM_PRECOMPUTED_SAMPLES 240 
     75static Sample2 samples2[NUM_PRECOMPUTED_SAMPLES]; 
    7476// number of pcf tabs 
    7577static Sample2 pcfSamples[NUM_PCF_TABS]; 
     
    204206        case DeferredRenderer::SAMPLING_QUADRATIC: 
    205207                { 
    206                         static QuadraticDiscSampleGenerator2D g(NUM_SAMPLES, 1.0f); 
     208                        static QuadraticDiscSampleGenerator2D g(NUM_PRECOMPUTED_SAMPLES, 1.0f); 
    207209                        g.Generate((float *)samples2); 
    208210                } 
     
    704706        sCgSsaoProgram->SetValue1f(i ++, (mUseTemporalCoherence && !mRegenerateSamples) ? tempCohFactor : 0); 
    705707         
     708        static int currentPos = 0; 
     709 
    706710        if (mUseTemporalCoherence || mRegenerateSamples) 
    707711        { 
     
    711715                // in the first case, the sample patterns look nicer, but the kernel 
    712716                // needs longer to converge 
    713                 GenerateSamples(mSamplingMethod); 
     717                if (currentPos + NUM_SAMPLES >= NUM_PRECOMPUTED_SAMPLES) 
     718                { 
     719                        currentPos = 0; 
     720                        GenerateSamples(mSamplingMethod); 
     721                } 
    714722 
    715723                //if (mSortSamples) { SortSamples(); } 
    716                 sCgSsaoProgram->SetArray2f(i, (float *)samples2, NUM_SAMPLES); 
     724                sCgSsaoProgram->SetArray2f(i, (float *)samples2 + currentPos, NUM_SAMPLES); 
     725 
     726                currentPos += NUM_SAMPLES; 
    717727        } 
    718728         
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3230 r3231  
    245245                //-- (affects performance for some reason!) 
    246246 
    247                 if (convergence < 700) 
     247                if (1)//convergence < 700) 
    248248                { 
    249249                        float2 mynoise = tex2Dlod(noiseTex, float4(IN.texCoord * 4.0f, 0, 0)).xy; 
Note: See TracChangeset for help on using the changeset viewer.