Ignore:
Timestamp:
09/04/08 10:14:18 (16 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r2900 r2901  
    119119static void GenerateSamples(int sampling) 
    120120{ 
    121         static SphericalSampleGenerator gauss(NUM_SAMPLES, 0.5f); 
     121        SphericalSampleGenerator gauss(NUM_SAMPLES, 1.0f); 
    122122        gauss.Generate((float *)samples3); 
    123 /* 
     123         
     124        /* 
    124125        switch (sampling) 
    125126        { 
     
    150151        float *randomNormals = new float[w * h * 3]; 
    151152 
     153        //SphericalSampleGenerator gauss(w * h, 1.0f); 
     154        //gauss.Generate(randomNormals); 
     155 
    152156        static HaltonSequence halton; 
    153157        float r[2]; 
     
    158162                halton.GetNext(2, r); 
    159163 
    160                 /* 
    161                 const float theta = 2.0f * acos(sqrt(1.0f - rx)); 
    162  
    163                 randomNormals[i + 0] = cos(theta); 
    164                 randomNormals[i + 1] = sin(theta); 
    165                 randomNormals[i + 2] = 0;*/ 
     164                 
     165                //const float theta = 2.0f * acos(sqrt(1.0f - rx)); 
     166                //randomNormals[i + 0] = cos(theta); 
     167                //randomNormals[i + 1] = sin(theta); 
     168                //randomNormals[i + 2] = 0; 
    166169 
    167170                const float theta = 2.0f * acos(sqrt(1.0f - r[0])); 
     
    272275                                                                CG_SOURCE, 
    273276                                                                //"src/shaders/ssao.cg",  
    274                                                                 "src/shaders/ssao2.cg",  
     277                                                                "src/shaders/ssao3d.cg",  
    275278                                                                RenderState::sCgFragmentProfile, 
    276279                                                                "main", 
     
    294297                sOldTexParam = cgGetNamedParameter(sCgSsaoProgram, "oldTex");   
    295298                 
    296                 cgGLSetParameter1f(sNoiseMultiplierParam, RandomValue(3.0f, 17.0f)); 
     299                cgGLSetParameter1f(sNoiseMultiplierParam, RandomValue(1.0f, 3.0f)); 
    297300                sSamplesParam = cgGetNamedParameter(sCgSsaoProgram, "samples"); 
    298301        } 
     
    328331                sOldIllumTexGiParam = cgGetNamedParameter(sCgGiProgram, "oldIllumTex");   
    329332 
    330                 cgGLSetParameter1f(sNoiseMultiplierGiParam, RandomValue(3.0f, 17.0f)); 
     333                cgGLSetParameter1f(sNoiseMultiplierGiParam, RandomValue(1.0f, 3.0f)); 
    331334        } 
    332335        else 
     
    421424                                                          const Matrix4x4 &oldProjViewMatrix, 
    422425                                                          const Matrix4x4 &projViewMatrix, 
    423                                                           float expFactor, 
     426                                                          float tempCohFactor, 
    424427                                                          ShadowMap *shadowMap) 
    425428{ 
     
    462465        { 
    463466        case SSAO: 
    464                 ComputeSsao(fbo, expFactor, oldProjViewMatrix, projViewMatrix); 
     467                ComputeSsao(fbo, tempCohFactor, oldProjViewMatrix, projViewMatrix); 
    465468                CombineSsao(fbo); 
    466469                break; 
    467470        case GI: 
    468                 ComputeGlobIllum(fbo, expFactor, oldProjViewMatrix); 
     471                ComputeGlobIllum(fbo, tempCohFactor, oldProjViewMatrix); 
    469472                CombineIllum(fbo); 
    470473                break; 
     
    492495 
    493496void DeferredRenderer::ComputeSsao(FrameBufferObject *fbo,  
    494                                                                    float expFactor, 
     497                                                                   float tempCohFactor, 
    495498                                                                   const Matrix4x4 &oldProjViewMatrix, 
    496499                                                                   const Matrix4x4 &projViewMatrix 
     
    550553        cgGLSetParameter1f(sMaxDepthParam, mScaleFactor); 
    551554         
    552         cgGLSetParameter1f(sTemporalCoherenceParam, (mUseTemporalCoherence && !mRegenerateSamples) ? 255 : 0); 
     555        cgGLSetParameter1f(sTemporalCoherenceParam, (mUseTemporalCoherence && !mRegenerateSamples) ? tempCohFactor : 0); 
    553556 
    554557        if (mUseTemporalCoherence || mRegenerateSamples) 
     
    716719 
    717720void DeferredRenderer::ComputeGlobIllum(FrameBufferObject *fbo,  
    718                                                                   float expFactor, 
    719                                                                   const Matrix4x4 &oldProjViewMatrix 
    720                                                                   ) 
     721                                                                                float tempCohFactor, 
     722                                                                                const Matrix4x4 &oldProjViewMatrix) 
    721723{ 
    722724        cgGLSetMatrixParameterfc(sOldModelViewProjMatrixGiParam, (const float *)oldProjViewMatrix.x); 
    723725 
    724         //GLuint colorsTex = mFbo->GetColorBuffer(0)->GetTexture(); 
    725726        GLuint colorsTex = fbo->GetColorBuffer(3)->GetTexture(); 
    726727        GLuint positionsTex = fbo->GetColorBuffer(1)->GetTexture(); 
     
    740741 
    741742        // read the second buffer, write to the first buffer 
    742         //mNewFbo->Bind(); 
    743743        mFbo->Bind(); 
    744744 
    745745        glDrawBuffers(2, mrt + mFboIndex); 
    746746 
    747         //GLuint oldSsaoTex = mOldFbo->GetColorBuffer(0)->GetTexture(); 
    748         //GLuint oldIllumTex = mOldFbo->GetColorBuffer(1)->GetTexture(); 
    749          
    750747        GLuint oldSsaoTex = mFbo->GetColorBuffer(2 - mFboIndex)->GetTexture(); 
    751748        GLuint oldIllumTex = mFbo->GetColorBuffer(2 - mFboIndex + 1)->GetTexture(); 
     
    776773        cgGLSetParameter1f(sMaxDepthGiParam, mScaleFactor); 
    777774 
    778         cgGLSetParameter1f(sTemporalCoherenceGiParam, (mUseTemporalCoherence && !mRegenerateSamples) ? 255 : 0); 
     775        cgGLSetParameter1f(sTemporalCoherenceGiParam, (mUseTemporalCoherence && !mRegenerateSamples) ? tempCohFactor : 0); 
    779776 
    780777 
Note: See TracChangeset for help on using the changeset viewer.