Changeset 3349 for GTP


Ignore:
Timestamp:
04/13/09 22:01:56 (15 years ago)
Author:
mattausch
Message:

changed back to old version

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

Legend:

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

    r3347 r3349  
    432432        mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGB_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 
    433433 
    434  
    435434        for (int i = 0; i < 2; ++ i) 
    436435        { 
     
    822821        // read the second buffer, write to the first buffer 
    823822        mIllumFbo->Bind(); 
    824         glDrawBuffers(1, mrt + mIllumFboIndex); 
     823        glDrawBuffers(2, mrt + mIllumFboIndex); 
    825824 
    826825        int i = 0; 
     
    929928 
    930929        // the neighbouring texels 
    931         const float xOffs = 1.0f / fbo->GetWidth(); 
    932         const float yOffs = 1.0f / fbo->GetHeight(); 
     930        float xOffs = 1.0f / fbo->GetWidth(); 
     931        float yOffs = 1.0f / fbo->GetHeight(); 
    933932 
    934933        sCgAntiAliasingProgram->SetTexture(0, colorsTex); 
     
    13831382        gluOrtho2D(0, 1, 0, 1); 
    13841383 
     1384 
    13851385        glMatrixMode(GL_MODELVIEW); 
    13861386        glPushMatrix(); 
    13871387        glLoadIdentity(); 
     1388 
    13881389         
    13891390        glPushAttrib(GL_VIEWPORT_BIT); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg

    r3347 r3349  
    250250 
    251251        //OUT.illum_col.xyz = float3(ao.w * 5e-1f, 0, 0); 
    252         //OUT.illum_col.xyz = float3(ao.y * 1e-2f); 
     252        //OUT.illum_col.xyz = float3(ao.z * 1e-1f); 
    253253        //OUT.illum_col.xyz = float3(ao.y * 1e-1f);//, 0, 0); 
    254254        //OUT.illum_col.xyz = ao.xyz; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg

    r3347 r3349  
    254254        // retrieve the sample from the last frame 
    255255        const float4 oldPixel = tex2Dlod(oldTex, float4(oldTexCoords, .0f, .0f)); 
    256         //const float oldDiff = tex2Dlod(myTex, float4(oldTexCoords, .0f, .0f)).x; 
    257         const float oldDiff = oldPixel.z;//tex2Dlod(myTex, float4(oldTexCoords, .0f, .0f)).z; 
     256        const float oldDiff = tex2Dlod(myTex, float4(oldTexCoords, .0f, .0f)).x; 
    258257 
    259258        // calculate eye space position of sample in old frame 
     
    306305                isPixelValid = pixelIsValid; 
    307306        } 
    308         //isPixelValid = pixelIsValid; 
    309307         
    310308        return float2(isPixelValid, abs(oldEyeSpaceDepth - projectedEyeSpaceDepth)); 
     
    340338        const float3 normal = normalize(tex2Dlod(normalsTex, float4(IN.texCoord, 0, 0)).xyz); 
    341339 
    342 #ifdef PERFORMANCE_TEST 
     340//#ifdef PERFORMANCE_TEST 
     341#if 1 
    343342        // do reprojection and filter out the pixels that are not save 
    344343        const float2 pValid = PixelValid(oldTex, 
     
    354353                                                                         ); 
    355354#else 
    356         const float2 pValid = float2(0, 0); 
     355        const float2 pValid = float2(0,0); 
    357356#endif 
    358357 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3348 r3349  
    2020{ 
    2121        float4 illum_col: COLOR0; 
    22         //float4 col: COLOR1; 
     22        float4 col: COLOR1; 
    2323}; 
    2424 
     
    117117        const float oldEyeSpaceDepth = oldPixel.w; 
    118118 
    119         // vector from eye pos to old sample 
     119        // vector from eye pos to old sample  
    120120        const float3 viewVec = Interpol(oldTexCoords, oldbl, oldbr, oldtl, oldtr); 
    121121        const float invLen = 1.0f / length(viewVec); 
     
    148148                 
    149149                //w = ComputeConvergence(oldTex, oldTexCoords, float2(1024.0f, 768.0f)); 
    150                 //w = floor(oldPixel.y); 
    151                 //w = oldPixel.y; 
    152                 idx = floor(oldPixel.y); 
     150                w = oldPixel.y; 
     151                idx = floor(oldPixel.z); 
     152 
    153153        } 
    154154        else 
    155155        {        
    156                 w   = .0f; 
     156                w = 0.0f; 
    157157                idx = .0f; 
    158158        } 
    159159 
    160         return float3(ssao, idx, w); 
     160        return float3(ssao, w, idx); 
    161161} 
    162162 
     
    201201                        tex2Dlod(samples, float4((0.5f + i + idx) / NUM_PRECOMPUTED_SAMPLES, 0.5f, .0f, .0f)).xy; 
    202202 
    203  
    204203                //////////////////// 
    205204                //-- add random noise: reflect around random normal vector  
     
    208207                if (convergence < SSAO_CONVERGENCE_THRESHOLD) 
    209208                { 
    210                         float2 mynoise = tex2Dlod(noiseTex, float4(IN.texCoord * 4.0f, .0f, .0f)).xy; 
     209                        float2 mynoise = tex2Dlod(noiseTex, float4(IN.texCoord * 4.0f, 0, 0)).xy; 
    211210                        //offset = myreflect(samples[i], mynoise); 
    212211                        //offset = myrotate(samples[i], mynoise.x); 
     
    502501#ifdef PERFORMANCE_TEST  
    503502 
    504         float3 diffVec = tex2Dlod(attribsTex, float4(IN.texCoord, .0f, .0f)).xyz; 
     503        float3 diffVec = tex2Dlod(attribsTex, float4(IN.texCoord, 0, 0)).xyz; 
    505504 
    506505        const float sqrMoveSpeed = SqrLen(diffVec); 
     
    522521        const float oldSsao = temporalVals.x; 
    523522         
    524         //float oldIdx = temporalCoherence > 1 ? temporalVals.y : .0f; 
    525         float oldIdx = temporalVals.y; 
    526         //float oldWeight = temporalVals.y; 
    527         float oldWeight = clamp(oldIdx, 0, temporalCoherence); 
    528  
     523        float oldWeight = temporalVals.y; 
     524        float oldIdx = temporalCoherence > 1 ? temporalVals.z : 0; 
     525         
    529526#else 
    530527 
    531528        const bool isMovingObject = false; 
    532         const float oldSsao = .0f; 
    533          
    534         float oldWeight = .0f; 
    535         float oldIdx = .0f; 
     529        const float oldSsao = 0; 
     530         
     531        float oldWeight = 0; 
     532        float oldIdx = 0; 
    536533         
    537534#endif 
     
    585582                else if (ao.y > partlyResetThres) 
    586583                { 
    587                         //if (oldIdx > 4.0f * NUM_SAMPLES) oldIdx = 0; 
    588                         oldWeight = min(oldWeight, 4.0f * NUM_SAMPLES); oldIdx = oldWeight; 
    589                         //oldWeight = oldIdx;//.0f; oldIdx = .0f; 
     584                        oldWeight = min(oldWeight, 4.0f * newWeight); 
     585                        //oldWeight = .0f;  
     586                        //oldIdx = .0f; 
    590587                } 
    591588        } 
     
    599596 
    600597        // the new weight for the next frame 
    601         const float newIdx = newWeight + oldIdx; 
    602         //const float combinedWeight = clamp(newIdx, .0f, temporalCoherence); 
    603         const float combinedWeight = clamp(newIdx, .0f, min(newWeight + oldWeight, temporalCoherence)); 
    604  
    605         //OUT.illum_col.y = combinedWeight; 
    606         OUT.illum_col.y = newIdx; // the new index 
     598        const float combinedWeight = clamp(newWeight + oldWeight, .0f, temporalCoherence); 
     599 
     600        OUT.illum_col.y = combinedWeight; 
     601        OUT.illum_col.z = oldIdx + newWeight; // the new index 
    607602        OUT.illum_col.w = eyeSpaceDepth; 
    608603 
     
    610605 
    611606        // this value can be used to check if this pixel belongs to a moving object 
    612         //OUT.col.x = SqrLen(diffVec); 
    613         OUT.illum_col.z = SqrLen(diffVec); 
     607        OUT.col.x = SqrLen(diffVec); 
     608        //OUT.illum_col.z = SqrLen(diffVec); 
    614609 
    615610#else 
Note: See TracChangeset for help on using the changeset viewer.