Changeset 3306 for GTP


Ignore:
Timestamp:
02/12/09 18:28:32 (15 years ago)
Author:
mattausch
Message:

found error with border

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

Legend:

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

    r3305 r3306  
    8181// dof samples 
    8282static Sample2 dofSamples[NUM_DOF_TABS]; 
    83  
    84  
    85 static float ssaoFilterOffsets[NUM_SSAO_FILTER_SAMPLES * 2]; 
    86 static float ssaoFilterWeights[NUM_SSAO_FILTER_SAMPLES]; 
    8783 
    8884static Texture *sHaloTex[5]; 
     
    350346        mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGB_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 
    351347 
    352  
    353348        for (int i = 0; i < 2; ++ i) 
    354349        { 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3305 r3306  
    625625        if (0) LoadPompeiiFloor(); 
    626626 
    627 #if 1 
     627#if 0 
    628628        const Vector3 sceneCenter(470.398f, 240.364f, 181.7f); 
    629629        //const Vector3 sceneCenter(470.398f, 240.364f, 180.3); 
     
    15731573                cout << "new ssao sample intensity: " << ssaoSampleIntensity << endl; 
    15741574                break; 
    1575         /*case 'o': 
    1576                 if (ssaoFilterRadius >= 0.0f) ssaoFilterRadius -= 1.0f; 
    1577                 if (deferredShader) deferredShader->SetSsaoFilterRadius(ssaoFilterRadius); 
    1578                 cout << "new ssao filter radius: " << ssaoFilterRadius << endl; 
    1579                 break; 
    1580         case 'O': 
    1581                 ssaoFilterRadius += 1.0f; 
    1582                 if (deferredShader) deferredShader->SetSsaoFilterRadius(ssaoFilterRadius); 
    1583                 cout << "new ssao filter radius: " << ssaoFilterRadius << endl; 
    1584                 break;*/ 
    15851575        /*      case 'o': 
    15861576        case 'O': 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h

    r3304 r3306  
    1010//#define NUM_SAMPLES 24 
    1111#define NUM_SAMPLES 48 
     12//#define NUM_SAMPLES 16 
    1213 
     14//#define MIN_SAMPLES 48 
    1315#define MIN_SAMPLES 8 
    1416 
     
    1921/// scale factor that takes angle of sample normal into account  
    2022#define VIEW_CORRECTION_SCALE 1.0f 
    21  
    22 //#define NUM_SSAO_FILTER_SAMPLES 13 // 7x7 
    23 #define NUM_SSAO_FILTER_SAMPLES 9 
    24 //#define NUM_SSAO_FILTER_SAMPLES 5 
    2523 
    2624#define SSAO_CONVERGENCE_THRESHOLD 700.0f 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg

    r3305 r3306  
    166166 
    167167        OUT.illum_col = tex2Dlod(ssaoTex, float4(IN.texCoord, 0, 0)); 
    168         // just take unfiltered convergence in current pixel 
     168        // compute minimal convergence for savetly reasons, write it out 
    169169        const float convergence = ComputeConvergenceHalfRes(ssaoTex, IN.texCoord, res * 0.5f); 
     170        OUT.illum_col.y = convergence; 
    170171 
    171172        const float2 xyStep = float2(1.0f / res.x, 0); 
     
    221222        if (depth < DEPTH_THRESHOLD) 
    222223        { 
    223                 OUT.illum_col.xyz = col.xyz * max(2e-2f, 1.0f - ao.x); 
    224                 //OUT.illum_col.xyz = col.xyz * ao.x; 
     224                //OUT.illum_col.xyz = col.xyz * max(2e-2f, 1.0f - ao.x); 
     225                OUT.illum_col.xyz = max(2e-2f, 1.0f - ao.x); 
    225226        } 
    226227        else 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg

    r3304 r3306  
    231231        // compute position from old frame for dynamic objects + translational portion 
    232232        //const float3 translatedPos = difVec - oldEyePos + worldPos.xyz; 
     233        // don't use difVec here: want to detect if the actual pixel has changed => ssao changed 
    233234        const float3 translatedPos = -oldEyePos + worldPos.xyz; 
    234235 
     
    259260         
    260261        // test if this pixel was valid in the old frame 
    261         float pixelValid; 
    262  
     262        float IsPixelValid; 
     263 
     264        // check if the pixel belonged to a dyanmic object in the last frame 
    263265        const bool oldDynamic = (squaredLen > DYNAMIC_OBJECTS_THRESHOLD); 
    264266        const bool newDynamic = (oldPixel.z > DYNAMIC_OBJECTS_THRESHOLD); 
     
    270272        const float pixelCouldBeValid = 2.0f; 
    271273        // this pixel information has to be discarded in order to not create artifacts 
    272         const float pixelNotValid = 10.0f; 
    273  
    274         if ((oldTexCoords.x < .0f) || (oldTexCoords.x >= 1.0f) ||  
    275                 (oldTexCoords.y < .0f) || (oldTexCoords.y >= 1.0f)) 
     274        const float pixelIsNotValid = 100.0f; 
     275 
     276        const float xOffs = 0;// 0.5f / 1024.0f; 
     277        const float yOffs = 0;// 0.5f / 768.0f; 
     278 
     279        if ((oldTexCoords.x < xOffs) || (oldTexCoords.x > (1.0f - xOffs)) ||  
     280                (oldTexCoords.y < yOffs) || (oldTexCoords.y > (1.0f - yOffs)) 
     281                ) 
    276282        { 
    277                 pixelValid = pixelNotValid; 
    278         } 
    279         else if (//!((oldEyeSpaceDepth > DEPTH_THRESHOLD) || (projectedEyeSpaceDepth > DEPTH_THRESHOLD)) && 
    280                 // check if changed from dynamic to not dynamic object 
     283                IsPixelValid = pixelIsNotValid; 
     284        } 
     285        else if (// check if changed from dynamic to not dynamic object 
    281286                ((oldDynamic && !newDynamic) || (!oldDynamic && newDynamic) || 
    282                 // check if we have a dynamic object and is a depth discontinuity 
    283287                ( 
     288                (oldEyeSpaceDepth < DEPTH_THRESHOLD) && (projectedEyeSpaceDepth < DEPTH_THRESHOLD) && 
     289                // check if we have a dynamic object  
    284290                (oldDynamic || newDynamic) &&  
    285                 //(depthDif > 1e-5f)))) 
     291                // and is a depth discontinuity 
    286292                (depthDif > MIN_DEPTH_DIFF)))) 
    287293        {        
    288                 pixelValid = pixelCouldBeValid;  
     294                IsPixelValid = pixelCouldBeValid;  
    289295        } 
    290296        else  
    291297        { 
    292                 pixelValid = pixelIsValid; 
    293         } 
    294  
    295         return float2(pixelValid, abs(oldEyeSpaceDepth - projectedEyeSpaceDepth)); 
     298                IsPixelValid = pixelIsValid; 
     299        } 
     300 
     301        return float2(IsPixelValid, abs(oldEyeSpaceDepth - projectedEyeSpaceDepth)); 
    296302} 
    297303 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3304 r3306  
    295295                // to have any influence in the current or last frame 
    296296                const float tooFarAway = step(0.5f, lengthToSample - changeFactor); 
    297                 validSamples = max(validSamples, (1.0f - tooFarAway) * pixelValid * step(-0.1f, cosAngle)); 
     297                //validSamples = max(validSamples, (1.0f - tooFarAway) * pixelValid * step(-0.1f, cosAngle)); 
     298                validSamples = max(validSamples, pixelValid); 
    298299 
    299300#ifdef USE_GTX 
     
    415416 
    416417        // completely reset the ao in this pixel 
    417         const float completelyResetThres = 4.0f; 
     418        const float completelyResetThres = 20.0f; 
    418419        // don't fully reset the ao in this pixel, but give low weight to old solution 
    419420        const float partlyResetThres = 1.0f; 
    420421         
    421         if (!isMovingObject) 
     422        if (1)//!isMovingObject) 
    422423        { 
    423424                if (ao.y > completelyResetThres)  
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/vienna.env

    r3299 r3306  
    115115tempCohFactor=2000.0f 
    116116# ssao filter radius 
    117 ssaoFilterRadius=12.0f 
     117ssaoFilterRadius=3.0f 
Note: See TracChangeset for help on using the changeset viewer.