Changeset 3099 for GTP


Ignore:
Timestamp:
11/05/08 13:41:42 (16 years ago)
Author:
mattausch
Message:

comparing eye linear depth

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

Legend:

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

    r3095 r3099  
    4242#define MAX_LOD_LEVEL 10 
    4343 
    44 #define MIN_DEPTH_DIFF 5e-2f 
     44#define MIN_DEPTH_DIFF 1e-3f 
     45//#define MIN_DEPTH_DIFF 5e-1f 
    4546#define PRECISION_SCALE 1e-1f 
    4647 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg

    r3098 r3099  
    7171        float4 col = shade(IN, color, normal, lightDir); 
    7272         
    73         //OUT.color = col; 
    74         OUT.color.xyz = normal * 0.5f + 0.5f; 
    75  
     73        OUT.color = col; 
     74        //OUT.color.xyz = normal * 0.5f + 0.5f; 
    7675        // store scaled view vector so wie don't have to normalize for e.g., ssao 
    7776        OUT.color.w = color.w / length(IN.view); 
     
    197196        // compute shading 
    198197        OUT.color = useShading ? (ambient + diffuse) * color : color; 
    199  
    200198        // store scaled view vector from now on so wie don't have to normalize later (e.g., for ssao) 
    201199        OUT.color.w = color.w / lenView; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3098 r3099  
    147147        //else trafo = inverseModelTrafo * oldModelViewProj; 
    148148 
    149         float4 dummyPt = worldPos - float4(oldEyePos, 0); 
     149        float3 dummyPt = worldPos.xyz - oldEyePos; 
    150150 
    151151        // reproject into old frame and calculate texture position of sample in old frame 
    152         float4 backProjPos = mul(oldModelViewProj, dummyPt); 
     152        float4 backProjPos = mul(oldModelViewProj, float4(dummyPt, 1.0f)); 
    153153        backProjPos /= backProjPos.w; 
    154154        // fit from unit cube into 0 .. 1 
     
    164164        //const float3 viewVec = normalize(Interpol(oldTexCoords, oldbl, oldbr, oldtl, oldtr)); 
    165165        const float3 viewVec = Interpol(oldTexCoords, oldbl, oldbr, oldtl, oldtr); 
    166         const float3 oldWorldPos = oldEyePos - oldEyeSpaceDepth * viewVec; 
     166        //const float3 oldWorldPos = oldEyePos - oldEyeSpaceDepth * viewVec; 
    167167        //const float3 oldWorldPos = - viewVec * eyeSpaceDepth; 
    168168        //const float3 dummy14 = Interpol(texcoord0, bl, br, tl, tr); 
    169169 
    170170        // the euclidian world space distance 
    171         const float depthDif = length(oldWorldPos - worldPos.xyz); 
     171        //const float depthDif = length(oldWorldPos - worldPos.xyz); 
    172172        //const float depthDif = length(dummy14 - viewVec); 
    173         //const float depthDif = length(oldEyeSpaceDepth - eyeSpaceDepth); 
     173        //const float projectedEyeSpaceDepth = length(worldPos + oldEyePos); 
     174        const float invlen = 1.0f / length(viewVec); 
     175        const float projectedEyeSpaceDepth = length(dummyPt) * invlen; 
     176         
     177        const float depthDif = abs(oldEyeSpaceDepth - projectedEyeSpaceDepth); 
    174178        //const float depthDif = length(oldEyePos); 
    175179 
Note: See TracChangeset for help on using the changeset viewer.