Changeset 3088 for GTP


Ignore:
Timestamp:
11/02/08 18:47:23 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp

    r3087 r3088  
    261261        for (int i = 0; i < 4; ++ i) 
    262262        { 
    263                 mIllumFbo->AddColorBuffer(ColorBufferObject::RGB_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 
     263                mIllumFbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 
    264264                InitBuffer(mIllumFbo, i); 
    265265        } 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h

    r3087 r3088  
    4242#define MAX_LOD_LEVEL 10 
    4343 
    44 #define MIN_DEPTH_DIFF 1e-1f 
     44#define MIN_DEPTH_DIFF 1e-2f 
    4545#define PRECISION_SCALE 1e-1f 
    4646 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3087 r3088  
    5454                                                                   float3 bl, float3 br, float3 tl, float3 tr) 
    5555{ 
    56         const float eyeSpaceDepth = tex2Dlod(tex, float4(texcoord, 0, 0)).w; 
     56        const float eyeSpaceDepth = tex2D(tex, texcoord).w; 
    5757        float3 viewVec = Interpol(texcoord, bl, br, tl, tr); 
    5858        float3 samplePos = -viewVec * eyeSpaceDepth; 
     
    8080                                                           uniform float3 oldbr, 
    8181                                                           uniform float3 oldtl, 
    82                                                            uniform float3 oldtr, 
    83                                                           float dummy3 
     82                                                           uniform float3 oldtr 
     83                                                          // float dummy3 
    8484                                                           ) 
    8585{ 
     
    9898 
    9999        // retrieve the sample from the last frame 
    100         float4 oldCol = tex2Dlod(oldTex, float4(oldTexCoords, 0, 0)); 
    101  
    102         float oldEyeSpaceDepth = oldCol.z / dummy3; 
     100        float4 oldCol = tex2D(oldTex, oldTexCoords); 
     101 
     102        float oldEyeSpaceDepth = oldCol.w;// dummy3; 
    103103        float3 viewVec = Interpol(oldTexCoords, oldbl, oldbr, oldtl, oldtr); 
    104104        float3 oldSamplePos = oldEyePos - viewVec * oldEyeSpaceDepth; 
     
    115115float4 temporalSmoothing(float4 currentProjPos, 
    116116                                                 float4 worldPos, 
    117                                                  float currentDepth, 
    118117                                                 uniform sampler2D oldTex, 
    119118                                                 const uniform float4x4 oldModelViewProj, 
     
    151150 
    152151        // retrieve the sample from the last frame 
    153         float4 oldCol = tex2Dlod(oldTex, float4(oldTexCoords, 0, 0)); 
     152        //float4 oldCol = tex2Dlod(oldTex, float4(oldTexCoords, 0, 0)); 
     153        float4 oldCol = tex2D(oldTex, oldTexCoords); 
    154154 
    155155        //eyeSpaceDepth = 1e6f; 
    156156         
    157         const float dummy3 = 1e-4f; 
     157        //const float dummy3 = 1e-4f; 
    158158        //const float oldEyeSpaceDepth = 1e5f * dummy3; 
    159         const float oldEyeSpaceDepth = oldCol.z / dummy3; 
     159        //const float oldEyeSpaceDepth = oldCol.z / dummy3; 
     160        const float oldEyeSpaceDepth = oldCol.w; 
    160161 
    161162        //oldTexCoords.x += 0.5f / 1024.0f; oldTexCoords.y += 0.5f / 768.0f; 
     
    167168        //const float oldDepth = oldCol.z; 
    168169        const float depthDif = length(oldSamplePos - worldPos.xyz); 
    169         eyeSpaceDepth *= dummy3; 
     170        //eyeSpaceDepth *= dummy3; 
    170171         
    171172        //const float depthDif = abs(oldEyeSpaceDepth - eyeSpaceDepth);// * 1e4f; 
     
    190191                                                          eyePos, 
    191192                                                          oldEyePos, 
    192                                                           oldbl, oldbr, oldtl, oldtr, 
    193                                                           dummy3); 
    194  
    195                 if (sampleDif > MIN_DEPTH_DIFF) isValid = false; 
     193                                                          oldbl, oldbr, oldtl, oldtr 
     194                                                          //,dummy3 
     195                                                          ); 
     196 
     197                //if (sampleDif > 1e-1f) isValid = false; 
    196198        } 
    197199 
     
    224226        //illum_col.y = isValid / 16.0f; 
    225227        illum_col.y = newWeight; 
    226         illum_col.z = eyeSpaceDepth; 
     228        illum_col.w = eyeSpaceDepth; 
    227229        //illum_col.z = dummy2; 
    228230 
     
    336338        // reconstruct position from the eye space depth 
    337339        const float3 viewDir = IN.view; 
    338         const float eyeDepth = tex2Dlod(colors, float4(IN.texCoord, 0, 0)).w; 
    339         const float3 eyeSpacePos = -viewDir * eyeDepth; 
     340        const float eyeSpaceDepth = tex2D(colors, IN.texCoord).w; 
     341        const float3 eyeSpacePos = -viewDir * eyeSpaceDepth; 
    340342        const float4 worldPos = float4(eyePos + eyeSpacePos, 1.0f); 
    341343 
     
    350352        w *= SAMPLE_RADIUS; 
    351353         
    352         const float currentDepth = projPos.z * PRECISION_SCALE; 
    353  
    354354        const float2 ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos, w, bl, br, tl, tr, normalize(viewDir)); 
    355355 
     
    358358        //-- compute temporally smoothing 
    359359         
    360         OUT.illum_col = temporalSmoothing(projPos, worldPos, currentDepth, oldTex, oldModelViewProj, temporalCoherence, ao, 
    361                                               samples, colors, noiseTex, w, bl, br, tl, tr, IN.texCoord, eyePos, eyeDepth, 
     360        OUT.illum_col = temporalSmoothing(projPos, worldPos, oldTex, oldModelViewProj, temporalCoherence, ao, 
     361                                              samples, colors, noiseTex, w, bl, br, tl, tr, IN.texCoord, eyePos, eyeSpaceDepth, 
    362362                                                                          oldEyePos, oldbl, oldbr, oldtl, oldtr); 
    363363 
     
    402402        //      ao.x = Filter(IN.texCoord, ssaoTex, filterOffs, filterWeights); 
    403403 
    404         OUT.illum_col = col * ao.x; 
    405         //OUT.illum_col = float4(ao.x, ao.x, ao.x, col.w); 
     404        //OUT.illum_col = col * ao.x; 
     405        OUT.illum_col = float4(ao.x, ao.x, ao.x, col.w); 
    406406        //OUT.illum_col.xyz = float3(1.0f - ao.x, 1.0f - ao.y * 1e-2f, 1); 
    407407        //OUT.illum_col.xyz = float3(1.0f - ao.x, ao.y, 0); 
Note: See TracChangeset for help on using the changeset viewer.