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

tried out scaling vs reduction of samples

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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); 
Note: See TracChangeset for help on using the changeset viewer.