Ignore:
Timestamp:
09/03/08 01:57:45 (16 years ago)
Author:
mattausch
Message:

improved shadow mapping

File:
1 edited

Legend:

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

    r2893 r2897  
    114114                   const uniform float4x4 oldModelViewProj, 
    115115                   uniform float maxDepth, 
    116                    uniform float expFactor 
     116                   uniform float temporalCoherence 
    117117                   ) 
    118118{ 
     
    157157        const float depthDif = 1.0f - newDepth / oldDepth; 
    158158 
    159  
    160         if ((tex.x >= 0.0f) && (tex.x < 1.0f) &&  
     159        float oldWeight = clamp(oldCol.z, 0, temporalCoherence); 
     160        float newWeight; 
     161 
     162        if ((temporalCoherence > 0) && 
     163                (tex.x >= 0.0f) && (tex.x < 1.0f) &&  
    161164                (tex.y >= 0.0f) && (tex.y < 1.0f) &&  
    162                 (abs(depthDif) < 1e-3f)) 
     165                (abs(depthDif) < 1e-4f)) 
    163166        { 
    164                 OUT.illum_col = (float4)ao * expFactor + oldCol.x * (1.0f - expFactor); 
     167                newWeight = oldWeight + 1; 
     168 
     169                //OUT.illum_col = (float4)ao * expFactor + oldCol.x * (1.0f - expFactor); 
     170                OUT.illum_col = (float4)(ao + oldCol.x * oldWeight) / newWeight; 
    165171        } 
    166172        else 
    167173        { 
    168174                OUT.illum_col = (float4)ao; 
     175                newWeight = 0; 
    169176        } 
    170177 
    171         //OUT.illum_col.xyz = viewDir; 
     178 
     179        OUT.illum_col.z = newWeight; 
    172180        OUT.illum_col.w = currentDepth; 
    173181 
     
    188196        //OUT.illum_col = ao; 
    189197 
     198        //OUT.illum_col.z = ao.z; 
    190199        OUT.illum_col.w = ao.w; 
    191200 
Note: See TracChangeset for help on using the changeset viewer.