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/globillum.cg

    r2892 r2897  
    121121                   const uniform float4x4 oldModelViewProj, 
    122122                   uniform float maxDepth, 
    123                    uniform float expFactor 
     123                   uniform float temporalCoherence 
    124124                   ) 
    125125{ 
     
    167167        const float depthDif = 1.0f - newDepth / oldDepth; 
    168168 
    169  
    170         if ((tex.x >= 0.0f) && (tex.x < 1.0f) &&  
     169        float oldWeight = clamp(oldSsao.z, 0, temporalCoherence); 
     170        float newWeight; 
     171 
     172        if ((temporalCoherence > 0.0f) && 
     173                (tex.x >= 0.0f) && (tex.x < 1.0f) &&  
    171174                (tex.y >= 0.0f) && (tex.y < 1.0f) &&  
    172175                (abs(depthDif)  < 1e-3f)) 
    173176        { 
    174                 OUT.ssao_col.x = new_color.w * expFactor + oldSsao.x * (1.0f - expFactor); 
    175                 OUT.illum_col = new_color * expFactor + oldIllum * (1.0f - expFactor); 
     177                newWeight = oldWeight + 1; 
     178 
     179                //OUT.illum_col = (float4)ao * expFactor + oldCol.x * (1.0f - expFactor); 
     180                OUT.ssao_col.x = (new_color.w + oldSsao.x * oldWeight) / newWeight; 
     181                OUT.illum_col  = (new_color + oldIllum * oldWeight) / newWeight; 
     182 
     183                //OUT.ssao_col.x = new_color.w * expFactor + oldSsao.x * (1.0f - expFactor); 
     184                //OUT.illum_col = new_color * expFactor + oldIllum * (1.0f - expFactor); 
    176185        } 
    177186        else 
    178187        { 
     188                newWeight = 0; 
     189 
    179190                OUT.ssao_col.x = new_color.w; 
    180191                OUT.illum_col = new_color; 
    181192        } 
    182193 
     194        OUT.ssao_col.z = newWeight; 
    183195        OUT.ssao_col.w = currentDepth; 
    184196 
Note: See TracChangeset for help on using the changeset viewer.