Ignore:
Timestamp:
02/19/09 17:41:20 (15 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r3320 r3321  
    4949        // will be interpolated when upsampling and filter size does not match! 
    5050 
    51         float4 texelCenterConv; 
    5251        const float2 invRes = float2(1.0f / res.x, 1.0f / res.y); 
    5352 
    5453        // get position exactly between texel centers 
    55         float2 center = (floor(texCoord * res) + float2(.5f)) * texelCenterConv; 
     54        float2 center = (floor(texCoord * res) + float2(.5f)) * texCoord; 
    5655        //center.x = (floor(texCoord.x * res.x - .5f) + 1.0f) / res.x; 
    5756        //center.y = (floor(texCoord.y * res.y - .5f) + 1.0f) / res.y; 
     
    231230 
    232231                // the normal of the current sample 
     232                //const float3 sampleNormal = normalize(tex2Dlod(normalTex, float4(texcoord, 0, 0)).xyz); 
    233233                const float3 sampleNormal = tex2Dlod(normalTex, float4(texcoord, 0, 0)).xyz; 
    234234 
    235235                // angle between current normal and direction to sample controls AO intensity. 
    236236                float cosAngle2 = .5f + dot(sampleNormal, -normal) * 0.5f; 
     237                //float cosAngle2 = dot(-dirSample, sampleNormal); 
    237238                 
    238239                //const float aoContrib = sampleIntensity / sqrLen; 
     
    240241 
    241242                //const float aoContrib = (1.0f > lengthToSample) ? occlusionPower(9e-2f, DISTANCE_SCALE + lengthToSample): .0f; 
    242                 total_ao += max(cosAngle, .0f) * aoContrib * cosAngle2; 
     243                total_ao += max(cosAngle, .0f) * max(cosAngle2, .0f) * aoContrib; 
    243244 
    244245                ++ numSamples; 
     
    257258#if 1 
    258259                const float tooFarAway = step(0.5f, lengthToSample - changeFactor); 
    259                 if (pixelValid < 2.0f) 
     260 
     261                const float partlyResetThres = 1.0f; 
     262                if (0)//pixelValid <= partlyResetThres) 
    260263                        validSamples = max(validSamples, pixelValid * (1.0f - tooFarAway) * step(-0.1f, cosAngle)); 
    261264                else 
     
    389392                // to have any influence in the current or last frame 
    390393#if 1 
     394                const float partlyResetThres = 1.0f; 
     395 
    391396                const float tooFarAway = step(0.5f, lengthToSample - changeFactor); 
    392                 if (pixelValid < 2.0f) 
     397                if (0)//pixelValid <= partlyResetThres) 
    393398                        validSamples = max(validSamples, pixelValid * (1.0f - tooFarAway) * step(-0.1f, cosAngle)); 
    394399                else 
Note: See TracChangeset for help on using the changeset viewer.