Changeset 3304 for GTP


Ignore:
Timestamp:
02/12/09 10:39:53 (15 years ago)
Author:
mattausch
Message:

tried out scaling vs reduction of samples

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

Legend:

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

    r3299 r3304  
    6868#define SSAO_FILTER_RADIUS 3 
    6969 
     70#define DEPTH_THRESHOLD 1e10f 
     71 
     72 
    7073#endif // __SHADERENV_H 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg

    r3301 r3304  
    145145        // filter up to a certain convergance value and leave out background (sky) by checking depth 
    146146        if (//(convergence < SSAO_CONVERGENCE_THRESHOLD) && 
    147                 (col.w < 1e10f)) 
     147                (col.w < DEPTH_THRESHOLD)) 
    148148        { 
    149149                const float distanceScale = 1.0f; 
     
    159159 
    160160        // just apply ssao if we are not in the sky 
    161         if (col.w < 1e10f) 
     161        if (col.w < DEPTH_THRESHOLD) 
     162        { 
    162163                OUT.illum_col.xyz = col.xyz * max(2e-2f, 1.0f - ao.x); 
    163164                //OUT.illum_col.xyz = col.xyz * ao.x; 
     165        } 
    164166        else 
     167        { 
    165168                OUT.illum_col.xyz = col.xyz; 
    166  
     169        } 
    167170 
    168171        //OUT.illum_col.xyz = float3(abs(ao.y * 1e2f), abs(ao.z * 1e2f), abs(ao.w * 1e2f)); 
     
    214217        // filter up to a certain convergance value and leave out background (sky) by checking depth 
    215218        if ((convergence < SSAO_CONVERGENCE_THRESHOLD) &&  
    216                 (col.w < 1e10f)) 
     219                (col.w < DEPTH_THRESHOLD)) 
    217220        { 
    218221                const float distanceScale = 1.0f; 
     
    229232 
    230233        // just apply ssao if we are not in the sky 
    231         if (col.w < 1e10f) 
     234        if (col.w < DEPTH_THRESHOLD) 
    232235        { 
    233236                OUT.illum_col.xyz = col.xyz * max(2e-2f, 1.0f - ao.x); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg

    r3303 r3304  
    6363                           float3 tl, 
    6464                           float3 tr, 
    65                            float2 xyStep) 
     65                           float2 xyStep, 
     66                           float convergence) 
    6667{ 
    6768        float2 result = float2(0.0f, 0.0f); 
     
    6970        const float3 centerPos = ReconstructSamplePos(colorsTex, texCoord, bl, br, tl, tr); 
    7071 
    71         for (int i = -SSAO_FILTER_RADIUS; i < SSAO_FILTER_RADIUS; ++ i) 
     72        const float scale = saturate((SSAO_CONVERGENCE_THRESHOLD - convergence) / SSAO_CONVERGENCE_THRESHOLD); 
     73        //const int radius = SSAO_FILTER_RADIUS * saturate((SSAO_CONVERGENCE_THRESHOLD - convergence) / SSAO_CONVERGENCE_THRESHOLD); 
     74         
     75        //for (int i = -radius; i <= radius; ++ i) 
     76        for (int i = -SSAO_FILTER_RADIUS; i <= SSAO_FILTER_RADIUS; ++ i) 
    7277        { 
    73                 float4 sampleTexCoord = float4(texCoord + i * xyStep, .0f, .0f); 
     78                float4 sampleTexCoord = float4(texCoord + i * xyStep * scale, .0f, .0f); 
    7479                result += FilterSample(sampleTexCoord, ssaoTex, colorsTex, centerPos, bl, br, tl, tr); 
    7580        } 
     
    104109 
    105110        // filter up to a certain convergance value and leave out background (sky) by checking depth 
    106         if ((convergence < SSAO_CONVERGENCE_THRESHOLD) && (depth < 1e10f)) 
     111        if ((convergence < SSAO_CONVERGENCE_THRESHOLD) && (depth < DEPTH_THRESHOLD)) 
    107112        { 
    108113                // the filtered ssao value 
    109                 OUT.illum_col.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep); 
     114                OUT.illum_col.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep, convergence); 
    110115        } 
    111116 
     
    140145 
    141146        // filter up to a certain convergance value and leave out background (sky) by checking depth 
    142         if ((convergence < SSAO_CONVERGENCE_THRESHOLD) && (depth < 1e10f)) 
     147        if ((convergence < SSAO_CONVERGENCE_THRESHOLD) && (depth < DEPTH_THRESHOLD)) 
    143148        { 
    144149                // the filtered ssao value 
    145                 ao.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep); 
     150                ao.x = FilterXY(IN.texCoord, ssaoTex, colorsTex, bl, br, tl, tr, xyStep, convergence); 
    146151        } 
    147152 
    148153        // just apply ssao if we are not in the sky 
    149         if (depth < 1e10f) 
     154        if (depth < DEPTH_THRESHOLD) 
    150155        { 
    151156                OUT.illum_col.xyz = col.xyz * max(2e-2f, 1.0f - ao.x); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg

    r3284 r3304  
    277277                pixelValid = pixelNotValid; 
    278278        } 
    279         else if (//!((oldEyeSpaceDepth > 1e10f) || (projectedEyeSpaceDepth > 1e10f)) && 
     279        else if (//!((oldEyeSpaceDepth > DEPTH_THRESHOLD) || (projectedEyeSpaceDepth > DEPTH_THRESHOLD)) && 
    280280                // check if changed from dynamic to not dynamic object 
    281281                ((oldDynamic && !newDynamic) || (!oldDynamic && newDynamic) || 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3303 r3304  
    396396 
    397397        // cull background note: this should be done with the stencil buffer 
    398         if (eyeSpaceDepth < 1e10f) 
     398        if (eyeSpaceDepth < DEPTH_THRESHOLD) 
    399399        { 
    400400                ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight, sampleIntensity, isMovingObject); 
Note: See TracChangeset for help on using the changeset viewer.