Changeset 2874 for GTP/trunk/App


Ignore:
Timestamp:
08/27/08 16:14:10 (16 years ago)
Author:
mattausch
Message:

implemented glob-illum solution

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

Legend:

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

    r2873 r2874  
    106106mScaleFactor(scaleFactor) 
    107107{ 
    108          
    109108        /////////// 
    110109        //-- the flip-flop fbos 
     
    222221                sNoiseMultiplierGiParam = cgGetNamedParameter(sCgGiProgram, "noiseMultiplier"); 
    223222                 
    224                 sOldModelViewProjMatrixParam = cgGetNamedParameter(sCgGiProgram, "oldModelViewProj"); 
     223                sOldModelViewProjMatrixGiParam = cgGetNamedParameter(sCgGiProgram, "oldModelViewProj"); 
    225224                sMaxDepthGiParam = cgGetNamedParameter(sCgGiProgram, "maxDepth"); 
    226225                sExpFactorGiParam = cgGetNamedParameter(sCgGiProgram, "expFactor"); 
     
    272271        swap(mNewFbo, mOldFbo);  
    273272 
    274         cgGLSetMatrixParameterfc(sOldModelViewProjMatrixParam, (const float *)oldProjViewMatrix.x); 
    275273 
    276274        glPushAttrib(GL_VIEWPORT_BIT); 
     
    300298        FirstPass(fbo); 
    301299         
    302         ComputeSsao(fbo, expFactor); 
    303         //ComputeGlobIllum(fbo, expFactor); 
     300        //ComputeSsao(fbo, expFactor, oldProjViewMatrix); 
     301        ComputeGlobIllum(fbo, expFactor, oldProjViewMatrix); 
    304302 
    305303        //Combine(fbo); 
     
    321319 
    322320 
    323 void SsaoShader::ComputeSsao(FrameBufferObject *fbo, float expFactor) 
    324 { 
     321void SsaoShader::ComputeSsao(FrameBufferObject *fbo,  
     322                                                         float expFactor, 
     323                                                         const Matrix4x4 &oldProjViewMatrix 
     324                                                         ) 
     325{ 
     326        cgGLSetMatrixParameterfc(sOldModelViewProjMatrixParam, (const float *)oldProjViewMatrix.x); 
     327 
    325328        GLuint colorsTex = mFbo3->GetColorBuffer(0)->GetTexture(); 
    326329        GLuint positionsTex = fbo->GetColorBuffer(1)->GetTexture(); 
     
    582585 
    583586 
    584 void SsaoShader::ComputeGlobIllum(FrameBufferObject *fbo, float expFactor) 
    585 { 
     587void SsaoShader::ComputeGlobIllum(FrameBufferObject *fbo,  
     588                                                                  float expFactor, 
     589                                                                  const Matrix4x4 &oldProjViewMatrix 
     590                                                                  ) 
     591{ 
     592        cgGLSetMatrixParameterfc(sOldModelViewProjMatrixGiParam, (const float *)oldProjViewMatrix.x); 
     593 
    586594        GLuint colorsTex = mFbo3->GetColorBuffer(0)->GetTexture(); 
    587595        GLuint positionsTex = fbo->GetColorBuffer(1)->GetTexture(); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.h

    r2873 r2874  
    2222{ 
    2323public: 
    24         /** constructor for a deferred shader taking the requested output image size, 
     24        /** Constructor for a deferred shader taking the requested output image size, 
    2525                the current camera,     and a scaling factor. 
    2626                         
     
    3030        */ 
    3131        SsaoShader(int w, int h, Camera *cam, float scaleFactor); 
    32         /**  
    33          
    34                 The algorithm renders the scene given an fbo consists of 1 color buffer,  
     32        /** The algorithm renders the scene given an fbo consists of 1 color buffer,  
    3533                1 position buffer, and 1 normal buffer. 
    3634                We also need the  projection view matrix of the last frame for reprojection, and 
     
    4644        ~SsaoShader(); 
    4745 
     46        void SetType(bool useGlobIllum, bool useTemporalCoherence); 
     47 
    4848protected: 
    4949 
    50         void ComputeSsao(FrameBufferObject *fbo, float expFactor); 
     50        void ComputeSsao(FrameBufferObject *fbo, float expFactor, const Matrix4x4 &oldProjViewMatrix); 
    5151 
    52         void ComputeGlobIllum(FrameBufferObject *fbo, float expFactor); 
     52        void ComputeGlobIllum(FrameBufferObject *fbo, float expFactor, const Matrix4x4 &oldProjViewMatrix); 
    5353 
    5454        void FirstPass(FrameBufferObject *fbo); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r2873 r2874  
    539539 
    540540        // the diffuse color buffer 
    541         //fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_MIPMAP_LINEAR, true); 
    542         fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, false); 
     541        fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_MIPMAP_LINEAR, true); 
     542        //fbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, false); 
    543543 
    544544        // the positions buffer 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg

    r2873 r2874  
    6363        float3 normal = normalize(norm.xyz);// * 2.0f - float4(1.0f)); 
    6464 
    65         float4 col = shade(IN, color, position, normal.xyz, amb); 
     65        float4 col = shade(IN, color, position, normal, amb); 
    6666         
    6767        //OUT.color = float4(1.0f); 
    6868        OUT.color = col; 
     69        OUT.color.w = color.w; 
    6970 
    7071        return OUT; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r2873 r2874  
    151151        realPos.w = 1.0f; 
    152152 
     153        // reproject 
    153154        float4 oldPos = mul(oldModelViewProj, realPos); 
    154155 
     
    176177        OUT.illum_col.w = currentDepth; 
    177178 
    178          
     179        //OUT.combined_col = float4(newDepth / oldDepth * 100, 0, 0, 1) ; 
     180        //OUT.combined_col = float4(newDepth, 0, 0, 1) ; 
    179181 
    180182        return OUT; 
Note: See TracChangeset for help on using the changeset viewer.