Changeset 3097


Ignore:
Timestamp:
11/05/08 01:09:27 (16 years ago)
Author:
mattausch
Message:

still problems with ssao on edges

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

Legend:

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

    r3095 r3097  
    7474 
    7575        // store scaled view vector so wie don't have to normalize for e.g., ssao 
    76         OUT.color.w = color.w;// / length(IN.view); 
     76        OUT.color.w = color.w / length(IN.view); 
     77        //OUT.color.w = color.w; 
    7778 
    7879        return OUT; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3095 r3097  
    5555{ 
    5656        const float eyeSpaceDepth = tex2Dlod(tex, float4(texcoord, 0, 0)).w; 
    57         float3 viewVec = normalize(Interpol(texcoord, bl, br, tl, tr)); 
     57        //float3 viewVec = normalize(Interpol(texcoord, bl, br, tl, tr)); 
     58        float3 viewVec = Interpol(texcoord, bl, br, tl, tr); 
    5859        float3 samplePos = -viewVec * eyeSpaceDepth; 
    5960 
     
    146147        //else trafo = inverseModelTrafo * oldModelViewProj; 
    147148 
    148         float4 dummyPt = worldPos - float4(oldEyePos,0); 
     149        float4 dummyPt = worldPos - float4(oldEyePos, 0); 
    149150 
    150151        // reproject into old frame and calculate texture position of sample in old frame 
     
    161162 
    162163        // vector from eye pos to old sample  
    163         const float3 viewVec = normalize(Interpol(oldTexCoords, oldbl, oldbr, oldtl, oldtr)); 
    164         const float3 oldWorldPos = oldEyeSpaceDepth * (-viewVec) + oldEyePos; 
     164        //const float3 viewVec = normalize(Interpol(oldTexCoords, oldbl, oldbr, oldtl, oldtr)); 
     165        const float3 viewVec = Interpol(oldTexCoords, oldbl, oldbr, oldtl, oldtr); 
     166        const float3 oldWorldPos = oldEyePos - oldEyeSpaceDepth * viewVec; 
    165167        //const float3 oldWorldPos = - viewVec * eyeSpaceDepth; 
    166168        //const float3 dummy14 = Interpol(texcoord0, bl, br, tl, tr); 
     
    232234                        uniform sampler2D noiseTex, 
    233235                        uniform float2 samples[NUM_SAMPLES], 
    234                         uniform float3 currentNormal, 
     236                        uniform float3 normal, 
    235237                        uniform float3 centerPosition, 
    236238                        uniform float scaleFactor, 
     
    279281 
    280282                // angle between current normal and direction to sample controls AO intensity. 
    281                 const float cosAngle = max(dot(dirSample, currentNormal), 0.0f); 
     283                const float cosAngle = max(dot(dirSample, normal), .0f); 
    282284 
    283285                // the distance_scale offset is used to avoid singularity that occurs at global illumination when  
     
    290292                // => compensate for this (on the other hand, projected sampling area could be larger!) 
    291293 
    292                 const float viewCorrection = 1.0f + VIEW_CORRECTION_SCALE * dot(viewDir, currentNormal); 
     294                const float viewCorrection = 1.0f + VIEW_CORRECTION_SCALE * dot(viewDir, normal); 
    293295                total_ao += cosAngle * aoContrib * viewCorrection; 
    294296#else 
     
    327329 
    328330        // reconstruct position from the eye space depth 
    329         const float3 viewDir = normalize(IN.view); 
     331        //const float3 viewDir = normalize(IN.view); 
     332        const float3 viewDir = IN.view; 
    330333        const float eyeSpaceDepth = tex2Dlod(colors, float4(IN.texCoord, 0, 0)).w; 
    331         const float4 eyeSpacePos = float4(eyeSpaceDepth * (-viewDir), 1.0f); 
     334        const float4 eyeSpacePos = float4(-viewDir * eyeSpaceDepth, 1.0f); 
    332335 
    333336 
Note: See TracChangeset for help on using the changeset viewer.