Changeset 3142


Ignore:
Timestamp:
11/18/08 23:35:16 (16 years ago)
Author:
mattausch
Message:

changed filter, halo region very small

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

Legend:

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

    r3140 r3142  
    292292        //-- the flip-flop fbos 
    293293 
    294         //const int dsw = w / 2; const int dsh = h / 2; 
    295         const int dsw = w; const int dsh = h; 
     294        const int dsw = w / 2; const int dsh = h / 2; 
     295        //const int dsw = w; const int dsh = h; 
    296296 
    297297        mIllumFbo = new FrameBufferObject(dsw, dsh, FrameBufferObject::DEPTH_NONE); 
     
    545545        } 
    546546 
     547        // as multisampling is difficult / costly with deferred shading,  
     548        // at least do some antialiasing 
    547549        AntiAliasing(fbo, light); 
    548550 
    549         Output(fbo); 
     551        // just output the latest buffer 
     552        //Output(fbo); 
    550553 
    551554        glEnable(GL_LIGHTING); 
     
    668671        GLuint normalsTex = fbo->GetColorBuffer(1)->GetTexture(); 
    669672 
    670         //FrameBufferObject::Release(); 
    671  
     673        FrameBufferObject::Release(); 
    672674        // read the second buffer, write to the first buffer 
    673         FlipFbos(fbo); 
     675        //FlipFbos(fbo); 
    674676 
    675677        // the neighbouring texels 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h

    r3139 r3142  
    77 
    88#define NUM_SAMPLES 8 
    9 //#define NUM_SAMPLES 16 
     9//#define NUM_SAMPLES 8 
    1010 
    1111// for quadratic falloff 
     
    2929//-- reprojection 
    3030 
    31 //#define MIN_DEPTH_DIFF 2e-2f 
    3231#define MIN_DEPTH_DIFF 5e-3f 
    3332#define PRECISION_SCALE 1e-1f 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg

    r3141 r3142  
    8484        const float3 centerPos = ReconstructSamplePos(ssaoTex, texCoord, bl, br, tl, tr); 
    8585#else 
    86         //const float eyeSpaceDepth = color.w; 
    87         const float eyeSpaceDepth = ao.w; 
     86        const float eyeSpaceDepth = color.w; 
     87        //const float eyeSpaceDepth = ao.w; 
    8888#endif 
    8989 
     
    114114                depthFactor = max(step(1.0f - 5e-1f, 1.0f - length(samplePos - centerPos)), 1e-3f); 
    115115#else // use depth 
    116                 //sampleDepth = tex2Dlod(colorsTex, sampleTexCoord).w; 
    117                 sampleDepth = aoSample.w; 
    118                 depthFactor = max(step(5e-1f, 1.0f - abs(1.0f - eyeSpaceDepth / sampleDepth)), 1e-3f); 
     116                sampleDepth = tex2Dlod(colorsTex, sampleTexCoord).w; 
     117                //sampleDepth = aoSample.w; 
     118                //depthFactor = max(step(1e-1f, 1.0f - abs(1.0f - eyeSpaceDepth / sampleDepth)), 1e-3f); 
     119                depthFactor = max(1.0f - abs(1.0f - eyeSpaceDepth / sampleDepth), 1e-3f); 
    119120#endif 
    120                 normalFactor = max(step(0.6f, dot(sampleNorm, centerNormal)), 1e-3f); 
    121                 convergenceFactor = min(100.0f, aoSample.y) * 0.01f;//max(step(18.5f, aoSample.y), 1e-3f); 
    122  
    123                 w = filterWeights[i] * normalFactor * depthFactor * convergenceFactor; 
     121                //normalFactor = max(step(0.9f, dot(sampleNorm, centerNormal)), 1e-3f); 
     122                normalFactor = max(dot(sampleNorm, centerNormal), 1e-3f); 
     123                convergenceFactor = min(1000.0f, aoSample.y) * 0.01f;//max(step(18.5f, aoSample.y), 1e-3f); 
     124 
     125                //w = filterWeights[i] * normalFactor * depthFactor * convergenceFactor; 
     126                w = normalFactor * depthFactor * convergenceFactor; 
    124127                //w = filterWeights[i] * normalFactor * converganceFactor; 
    125128                //w = filterWeights[i] * normalFactor * depthFactor; 
     129                //w = convergenceFactor; 
    126130 
    127131                average += aoSample.x * w; 
     
    129133        } 
    130134 
    131         average *= 1.0f / max(total_w, 1e-6f); 
    132  
    133         return average; 
     135        average *= 1.0f / max(total_w, 1e-1f); 
     136 
     137        return saturate(average); 
    134138} 
    135139 
     
    195199                                                  uniform float2 filterOffs[NUM_SSAO_FILTERSAMPLES], 
    196200                                                  uniform float filterWeights[NUM_SSAO_FILTERSAMPLES], 
    197                                                   float scale, 
    198                                                   int index) 
     201                                                  float scale 
     202                                                  ) 
    199203{ 
    200204        float average = .0f; 
     
    219223 
    220224                //depthFactor = clamp(1.0f - abs(1.0f - eyeSpaceDepth / aoSample.w), 1e-3f, 1.0f); 
    221                 depthFactor = max(step(5e-1f, 1.0f - abs(1.0f - eyeSpaceDepth / aoSample.w)), 1e-3f); 
     225                //depthFactor = max(step(5e-1f, 1.0f - abs(1.0f - eyeSpaceDepth / aoSample.w)), 1e-3f); 
    222226                //normalFactor = max(step(0.6f, dot(sampleNorm, norm)), 1e-3f); 
    223  
     227                w = filterWeights[i]; 
    224228                //w = filterWeights[i] * normalFactor * depthFactor; 
    225229                //w = normalFactor * depthFactor; 
    226                 w = depthFactor; 
     230                //w = depthFactor; 
    227231 
    228232                average += aoSample.y * w; 
     
    245249 
    246250        float4 ao = tex2Dlod(ssaoTex, float4(IN.texCoord, 0, 0)); 
    247  
    248         //const static float scaleFactor = 20.0f; 
    249         const static float scaleFactor = 10.0f; 
    250         //ao.y = DiscontinuityFilter2(IN.texCoord, ao, ssaoTex, normalsTex, filterOffs, filterWeights, 0.5f, 1); 
    251         //ao.y = DiscontinuityFilter2(IN.texCoord, ao, ssaoTex, normalsTex, filterOffs, filterWeights, scaleFactor, 1); 
     251        //ao.y = DiscontinuityFilter2(IN.texCoord, ao, ssaoTex, normalsTex, filterOffs, filterWeights, 0.1f); 
    252252         
    253253        OUT.illum_col = ao; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3138 r3142  
    185185        float overallDepth = 0; 
    186186 
     187#if 1 
    187188        const float squaredLen = diffVec.x * diffVec.x + diffVec.y * diffVec.y + diffVec.z * diffVec.z; 
    188189 
    189 #if 1 
    190190        if (squaredLen < 1e-8f) // object not dynamic 
    191191        { 
     
    226226                // increase the weight for convergence 
    227227                newWeight = oldWeight + 1.0f; 
    228                 if (notValid > 1.0f) newWeight = 10.0f; 
     228                if (notValid > 1.0f) newWeight = 4.0f; 
    229229                //if (notValid > 1.0f) newWeight = max(15.0f - notValid * 2.0f, 1.0f); 
    230230        } 
Note: See TracChangeset for help on using the changeset viewer.