Ignore:
Timestamp:
12/02/08 17:06:08 (16 years ago)
Author:
mattausch
Message:

debug version showing a visualization of the confidence

File:
1 edited

Legend:

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

    r3203 r3204  
    125125 
    126126                aoSample = tex2Dlod(ssaoTex, sampleTexCoord); 
    127                 sampleNorm = tex2Dlod(normalsTex, sampleTexCoord).xyz; 
     127                //sampleNorm = tex2Dlod(normalsTex, sampleTexCoord).xyz; 
    128128 
    129129                // check spatial discontinuity 
    130  
    131130                // note: using the depth from the color texture is not 100% correct as depth was 
    132131                // not scaled with the interpolated view vector depth yet ... 
     
    137136                spatialFactor = 1.0f / max(len, 1e-3f); 
    138137 
    139                 //normalFactor = max(step(.0f, dot(sampleNorm, centerNormal)), 1e-2f); 
     138                //normalFactor = max(step(.2f, dot(sampleNorm, centerNormal)), 1e-2f); 
    140139                convergenceFactor = aoSample.y + 1.0f; 
    141140                 
     
    172171 
    173172        float4 col = tex2Dlod(colorsTex, float4(IN.texCoord, 0, 0)); 
    174         float4 ao = tex2Dlod(ssaoTex, float4(IN.texCoord, 0, 0)); 
     173        float4 ao =  tex2Dlod(ssaoTex, float4(IN.texCoord, 0, 0)); 
    175174 
    176175        // get the minimum convergence by exactly sampling the 4 surrounding 
     
    178177        // will be interpolated when upsampling and filter size does not match! 
    179178        float4 texelCenterConv; 
    180         const float w = 512.0f; const float h = 384.0f; 
     179        //const float w = 512.0f; const float h = 384.0f; 
     180        //const float w = 128.0f; const float h = 96.0f; 
     181        const float w = 16.0f; const float h = 12.0f; 
    181182        const float xoffs = .5f / w; const float yoffs = .5f / h; 
    182183 
    183184        // get position exactly between old texel centers 
    184185        float2 center; 
    185         center.x = float(floor(IN.texCoord.x * w - .5f) + 1.0f) / w; 
    186         center.y = float(floor(IN.texCoord.y * h - .5f) + 1.0f) / h; 
    187  
    188         texelCenterConv.x = tex2Dlod(ssaoTex, float4(center + float2(xoffs, yoffs), 0, 0)).y; 
    189         texelCenterConv.y = tex2Dlod(ssaoTex, float4(center + float2(xoffs, -yoffs), 0, 0)).y; 
    190         texelCenterConv.z = tex2Dlod(ssaoTex, float4(center + float2(-xoffs, yoffs), 0, 0)).y; 
    191         texelCenterConv.w = tex2Dlod(ssaoTex, float4(center + float2(-xoffs, -yoffs), 0, 0)).y; 
     186        center.x = (floor(IN.texCoord.x * w - .5f) + 1.0f) / w; 
     187        center.y = (floor(IN.texCoord.y * h - .5f) + 1.0f) / h; 
     188//center=IN.texCoord; 
     189        texelCenterConv.x = tex2Dlod(ssaoTex, float4(center + float2( xoffs, yoffs), 0, 0)).y; 
     190        texelCenterConv.y = tex2Dlod(ssaoTex, float4(center + float2( xoffs, -yoffs), 0, 0)).y; 
     191        texelCenterConv.z = tex2Dlod(ssaoTex, float4(center + float2(-xoffs, -yoffs), 0, 0)).y; 
     192        texelCenterConv.w = tex2Dlod(ssaoTex, float4(center + float2(-xoffs,  yoffs), 0, 0)).y; 
    192193 
    193194        const float m1 = min(texelCenterConv.x, texelCenterConv.y); 
     
    196197        const float minConvergence = min(m1, m2); 
    197198 
    198         const float convergence = step(200.0f, minConvergence) * minConvergence; 
     199        const float convergence = minConvergence; 
     200        //const float convergence = 0; 
    199201        //const float convergence = ao.y; 
    200202 
    201         // filter reaches size 1 after thres samples 
     203        // filter reaches size 1 pixel after thres samples:  
     204        // afterwards we do not use the filter anymore 
    202205        const float thres = 500.0f;  
    203206 
     
    222225 
    223226        //OUT.illum_col.xyz = float3(ao.x, ao.x, step(thres, convergence)); 
    224         //OUT.illum_col.xyz = float3(ao.x, ao.x, ao.x); 
     227        OUT.illum_col.xyz = float3(0, convergence, 0); 
     228        //OUT.illum_col.xyz = float3(abs(center.x - IN.texCoord.x) * 16.0f, abs(center.y - IN.texCoord.y) * 12.0f, 0); 
     229         
    225230        //OUT.illum_col.xyz = float3(0, clamp(1.0f - ao.y * 1e-3f, 0, 1), 1); 
    226231        //OUT.illum_col.xyz = float3(0, 1.0f - step(0.5f + NUM_SAMPLES, convergence), 1); 
Note: See TracChangeset for help on using the changeset viewer.