Ignore:
Timestamp:
05/18/09 18:53:06 (15 years ago)
Author:
mattausch
Message:

debug version

File:
1 edited

Legend:

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

    r3369 r3370  
    459459                        sampler2D colors, 
    460460                        sampler2D noiseTex, 
     461                        float2 dummySamples[NUM_SAMPLES], 
    461462                        sampler2D samples, 
    462463                        float3 normal, 
     
    486487                float2 offset; 
    487488 
    488                 const float2 ssaoOffset =  
    489                         tex2Dlod(samples, float4((0.5f + i + oldIdx) / NUM_PRECOMPUTED_SAMPLES, .5f, .0f, .0f)).xy; 
    490  
     489                //const float2 ssaoOffset = tex2Dlod(samples, float4((0.5f + i + oldIdx) / NUM_PRECOMPUTED_SAMPLES, .5f, .0f, .0f)).xy; 
     490                const float2 ssaoOffset = dummySamples[i]; 
    491491 
    492492                //////////////////// 
     
    494494                //-- (affects performance for some reason!) 
    495495 
    496                 if (!USE_OPTIMIZATION || 
    497                         (convergence < SSAO_CONVERGENCE_THRESHOLD)) 
     496                if (0)//!USE_OPTIMIZATION || 
     497                        //(convergence < SSAO_CONVERGENCE_THRESHOLD)) 
    498498                { 
    499499                        float2 mynoise = tex2Dlod(noiseTex, float4(IN.texCoord * 4.0f, 0, 0)).xy; 
    500                         //offset = myreflect(samples[i], mynoise); 
    501                         //offset = myrotate(samples[i], mynoise.x); 
     500                        //offset = myreflect(samples[i], mynoise); offset = myrotate(samples[i], mynoise.x); 
    502501                        offset = myrotate(ssaoOffset, mynoise.x); 
    503502                } 
     
    557556                if ((cosAngle >= 0) && (pixelValid < 90.0f))// || (cosAngle2 >= 0)) 
    558557                { 
    559                         //pixelValid = (distanceDiff > 1e-3f) ? 100.0f : .0f; 
    560                         pixelValid = (distanceDiff > 1e-3f) ? 5.0f : .0f; 
     558                        pixelValid = (distanceDiff > 1e-3f) ? 100.0f : .0f; 
     559                        //pixelValid = (distanceDiff > 1e-3f) ? 5.0f : .0f; 
    561560                } 
    562561 
     
    604603                        uniform sampler2D noiseTex, 
    605604                        uniform sampler2D samples, 
     605                        uniform float2 dummySamples[NUM_SAMPLES], 
    606606                        uniform sampler2D oldTex, 
    607607                        uniform float4x4 modelViewProj, 
     
    685685        float3 ao; 
    686686        //$$temp matt 
    687         //oldIdx = dummyIdx; 
     687        oldIdx = dummyIdx; 
    688688 
    689689        // cull background note: this should be done with the stencil buffer 
    690690        if (eyeSpaceDepth < DEPTH_THRESHOLD) 
    691691        { 
    692                 if (1) 
    693                 { 
    694692#ifdef TRYOUT 
    695                         ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz,  
    696                                       radiusMult, bl, br, tl, tr, normalize(viewDir), 
    697                                           oldWeight, sampleIntensity, isMovingObject, oldIdx); 
     693                ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz,  
     694                              radiusMult, bl, br, tl, tr, normalize(viewDir), 
     695                              oldWeight, sampleIntensity, isMovingObject, oldIdx); 
    698696#else 
    699697 
    700                           ao = ssao(IN, colors, noiseTex, samples, 
    701                                       normal, eyeSpacePos.xyz, radiusMult, bl,  
    702                                           br, tl, tr, normalize(viewDir),  
    703                                           oldWeight, sampleIntensity, isMovingObject, oldIdx, 
    704                                           attribsTex, mycolor.xyz); 
     698                ao = ssao(IN, colors, noiseTex, dummySamples, samples, 
     699                              normal, eyeSpacePos.xyz, radiusMult, bl,  
     700                              br, tl, tr, normalize(viewDir),  
     701                              oldWeight, sampleIntensity, isMovingObject, oldIdx, 
     702                              attribsTex, mycolor.xyz); 
    705703#endif                             
    706                 } 
    707                 else 
    708                 { 
    709                         /*ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, radiusMult,  
    710                                    bl, br, tl, tr, normalize(viewDir), oldWeight, sampleIntensity,  
    711                                            isMovingObject, normals, oldIdx); 
    712                         */ 
    713                 } 
    714704        } 
    715705        else 
     
    752742 
    753743                oldWeight = min(oldWeight, factor * NUM_SAMPLES); 
    754                 if (newIdx >= factor * NUM_SAMPLES) {newIdx = 0; /*oldWeight = .0f;*/ } 
     744                if (newIdx >= factor * NUM_SAMPLES)  
     745                { 
     746                        newIdx = .0f;  
     747                        //oldWeight = .0f; 
     748                } 
    755749 
    756750                //combinedWeight = oldWeight; 
     
    764758        //-- blend ao between old and new samples (and avoid division by zero) 
    765759 
    766         OUT.illum_col.x = ao.x * newWeight + oldSsao * oldWeight; 
    767         OUT.illum_col.x /= (newWeight + oldWeight); 
    768         //OUT.illum_col.x = clamp(OUT.illum_col.x, 0, 1); 
    769         //OUT.illum_col.x = ao.y; 
     760        OUT.illum_col.x = ao.x;// * newWeight + oldSsao * oldWeight; 
     761        //OUT.illum_col.x /= (newWeight + oldWeight); 
    770762 
    771763        OUT.illum_col.y = combinedWeight; 
Note: See TracChangeset for help on using the changeset viewer.