Changeset 3159 for GTP


Ignore:
Timestamp:
11/24/08 18:45:45 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h

    r3155 r3159  
    6464 
    6565 
     66#define DYNAMIC_OBJECTS_THRESHOLD 1e-7f 
     67 
    6668 
    6769#endif // __SHADERENV_H 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg

    r3156 r3159  
    106106                const float scale =     adaptFactor * scaleFactor * ao.z  / (adaptFactor + ao.y); 
    107107 
    108                 ao.x = DiscontinuityFilter(IN.texCoord, ao, col, ssaoTex, normalsTex, colorsTex, filterOffs, filterWeights, scale); 
     108                //ao.x = DiscontinuityFilter(IN.texCoord, ao, col, ssaoTex, normalsTex, colorsTex, filterOffs, filterWeights, scale); 
    109109        } 
    110110 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg

    r3156 r3159  
    218218 
    219219 
     220 
     221inline float SqrLen(float3 v) 
     222{ 
     223        return v.x * v.x + v.y * v.y + v.z * v.z; 
     224} 
     225 
     226 
     227 
    220228/** This shader computes the reprojection and checks 
    221229        if the reprojected pixel from last frame is still 
     
    277285        const float depthDif = abs(1.0f - oldEyeSpaceDepth / projectedEyeSpaceDepth); 
    278286 
    279         const float squaredLen = diffVec.x * diffVec.x + diffVec.y * diffVec.y + diffVec.z * diffVec.z; 
    280         //if (squaredLen < 1e-8f) // object not dynamic 
    281         //{} 
    282  
     287        const float squaredLen = SqrLen(diffVec); 
     288         
     289        // test if this pixel was not valid in the old frame 
    283290        float validPixel; 
    284291 
    285         if (1 
     292        if (((squaredLen <= DYNAMIC_OBJECTS_THRESHOLD) && (oldPixel.z <= DYNAMIC_OBJECTS_THRESHOLD)) || 
     293                (1  
    286294                && (oldTexCoords.x >= 0.0f) && (oldTexCoords.x < 1.0f) 
    287295                && (oldTexCoords.y >= 0.0f) && (oldTexCoords.y < 1.0f) 
    288                 && (depthDif <= MIN_DEPTH_DIFF)  
     296                && (depthDif <= MIN_DEPTH_DIFF) 
     297                ) 
    289298                //&& (depthDif <= 9e-1f)  
    290299                ) 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3158 r3159  
    2626{ 
    2727        return 6.283185307179586476925286766559f * (1.0f - cos(asin(radius / dist))); 
     28} 
     29 
     30 
     31inline float SqrLen(float3 v) 
     32{ 
     33        return v.x * v.x + v.y * v.y + v.z * v.z; 
    2834} 
    2935 
     
    7581                                                                float temporalCoherence, 
    7682                                                                sampler2D colors, 
    77                                                                 float3 bl, 
    78                                                                 float3 br, 
    79                                                                 float3 tl, 
    80                                                                 float3 tr,  
    8183                                                                float3 projPos, 
    8284                                                                float invW, 
    83                                                                 sampler2D noiseTex, 
    84                                                                 float2 samples[NUM_SAMPLES], 
    85                                                                 float scaleFactor, 
    8685                                                                float3 oldbl, 
    8786                                                                float3 oldbr, 
     
    132131#endif 
    133132 
    134         const float squaredLen = diffVec.x * diffVec.x + diffVec.y * diffVec.y + diffVec.z * diffVec.z; 
     133        const float squaredLen = SqrLen(diffVec); 
     134 
    135135        const float oldWeight = clamp(oldPixel.y, .0f, temporalCoherence); 
    136136        //const float oldWeight = oldPixel.y; 
     
    149149                // increase the weight for convergence 
    150150                newWeight = oldWeight + 1.0f; 
    151                 if ((pixelValid > 1.0f) && (squaredLen < 1e-8f)) newWeight = 4.0f; 
     151                 
     152                if ((pixelValid > 1.0f) && (squaredLen < DYNAMIC_OBJECTS_THRESHOLD)) 
     153                {                
     154                        newWeight = 4.0f; 
     155                } 
    152156                //if (pixelValid > 1.0f) newWeight = max(15.0f - notValid * 2.0f, 1.0f); 
    153157        } 
     
    208212 
    209213                const float3 samplePos = ReconstructSamplePos(sampleColor.w, texcoord, bl, br, tl, tr); 
     214                // the normal of the current sample 
    210215                const float3 sampleNormal = normalize(tex2Dlod(normalTex, float4(texcoord, 0, 0)).xyz); 
    211216 
     
    391396                                                oldTex, oldModelViewProj, temporalCoherence, 
    392397                                                                                        colors,  
    393                                                                                         bl, br, tl, tr,  
    394398                                                                                        projPos.xyz,  
    395399                                                                                        invw,  
    396                                                                                         noiseTex,  
    397                                                                                         samples,  
    398                                                                                         scaleFactor,  
    399400                                                                                        oldbl, oldbr, oldtl, oldtr, 
    400401                                                                                        diffVec, 
     
    408409        OUT.illum_col.x = (ao.x + oldSsao * (newWeight - 1.0f)) / newWeight; 
    409410        OUT.illum_col.y = newWeight; 
    410         OUT.illum_col.z = invw; 
     411        OUT.illum_col.z = SqrLen(diffVec);//invw; 
    411412        OUT.illum_col.w = eyeSpaceDepth; 
    412413 
Note: See TracChangeset for help on using the changeset viewer.