Ignore:
Timestamp:
12/02/08 17:06:08 (16 years ago)
Author:
mattausch
Message:

debug version showing a visualization of the confidence

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg

    r3199 r3204  
    256256        const float squaredLen = SqrLen(difVec); 
    257257         
    258         // test if this pixel was not valid in the old frame 
    259         float validPixel; 
     258        // test if this pixel was valid in the old frame 
     259        float pixelValid; 
    260260 
    261261        const bool oldDynamic = (squaredLen > DYNAMIC_OBJECTS_THRESHOLD); 
    262262        const bool newDynamic = (oldPixel.z > DYNAMIC_OBJECTS_THRESHOLD); 
    263263 
    264         if (!(oldDynamic && !newDynamic) && !(!oldDynamic && newDynamic)  
    265                 && !(oldDynamic && newDynamic && (depthDif <= MIN_DEPTH_DIFF)) 
    266                 && (oldTexCoords.x >= 0.0f) && (oldTexCoords.x < 1.0f) 
    267                 && (oldTexCoords.y >= 0.0f) && (oldTexCoords.y < 1.0f) 
     264        const float xOffs = 1.0f / 1024.0f; 
     265        const float yOffs = 1.0f / 768.0f; 
     266 
     267        // actually 0 means pixel is valid 
     268        const float pixelIsValid = 0.0f; 
     269        const float pixelCouldBeValid = 2.0f; 
     270        const float pixelNotValid = 10.0f; 
     271 
     272        const float eps = 1e-6f; 
     273 
     274        if (0 
     275                //&& !(oldDynamic && newDynamic && (depthDif <= MIN_DEPTH_DIFF)) 
     276                //&& (oldTexCoords.x + eps >= xOffs) && (oldTexCoords.x <= (1.0f - xOffs) + eps ) 
     277                //&& (oldTexCoords.y + eps >= yOffs) && (oldTexCoords.y <= (1.0f - yOffs) + eps ) 
     278                || (oldTexCoords.x < .0f) || (oldTexCoords.x >= 1.0f) 
     279                || (oldTexCoords.y < .0f) || (oldTexCoords.y >= 1.0f) 
    268280                ) 
    269281        { 
    270                 validPixel = 0.0f; 
    271         } 
    272         else 
     282                pixelValid = pixelNotValid; 
     283        } 
     284        // check if changed from dynamic to not dynamic object 
     285        // or there is a depth discontinuity 
     286        else  
     287        if ((oldDynamic && !newDynamic) || (!oldDynamic && newDynamic) || 
     288                (oldDynamic && newDynamic && (depthDif <= MIN_DEPTH_DIFF))) 
    273289        {        
    274                 validPixel = 10.5f; 
    275         } 
    276  
    277         //return depthDif; 
    278         return validPixel; 
    279 } 
    280  
    281  
     290                pixelValid = pixelCouldBeValid;  
     291        } 
     292        else  
     293        { 
     294                pixelValid = pixelIsValid; 
     295        } 
     296 
     297        return pixelValid; 
     298} 
     299 
     300 
     301/** This function is called during downsampling of the buffers 
     302        for ssao. 
     303*/ 
    282304pixel PrepareSsao(fragment IN, 
    283305                                   uniform sampler2D colorsTex, 
Note: See TracChangeset for help on using the changeset viewer.