Ignore:
Timestamp:
10/01/08 17:39:41 (16 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r2986 r2987  
    5353 
    5454        return r; 
     55} 
     56 
     57float3 Interpol(float2 w, float3 bl, float3 br, float3 tl, float3 tr) 
     58{ 
     59        //float3 x1 = lerp(oldColor.w, logLumScaled, 0.1f); 
     60        float3 x1 = bl * (1.0f - w.x) + br * w.x; 
     61        float3 x2 = tl * (1.0f - w.x) + tr * w.x; 
     62 
     63        float3 v = x1 * (1.0f - w.y) + x2 * w.y; 
     64 
     65        return v; 
    5566} 
    5667 
     
    7081                   uniform float3 br, 
    7182                   uniform float3 tl, 
    72                    uniform float3 tr 
     83                   uniform float3 tr, 
     84                   uniform float maxDepth 
    7385                   ) 
    7486{ 
     
    105117                float eyeSpaceDepth = tex2Dlod(colors, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).w; 
    106118 
    107                 float rotx = offsetTransformed.x * -x_angle; 
    108                 float roty = offsetTransformed.y * -y_angle; 
    109  
    110                 float3 rotView_x = RotateY(viewDir, x_angle); 
    111                 float3 rotView = RotateX(rotView_x, y_angle); 
    112  
    113                 float3 sample_position = eyePos - rotView * eyeSpaceDepth; 
     119                float newOffs = 0.5f + offsetTransformed * 0.5f; 
     120 
     121                float3 rotView = normalize(Interpol(newOffs, bl, br, tl, tr)); 
     122                float3 sample_position = (eyePos - rotView * eyeSpaceDepth) / maxDepth; 
    114123                //float3 sample_position = tex2Dlod(positions, float4(texcoord, 0, SSAO_MIPMAP_LEVEL)).xyz; 
    115124 
     
    177186        float3 viewDir = normalize(IN.view); 
    178187 
    179         /*const float eyeSpaceDepth = tex2D(colors, IN.texCoord.xy).w; 
     188/*      const float eyeSpaceDepth = tex2D(colors, IN.texCoord.xy).w; 
    180189 
    181190        float3 sample_position = eyePos - viewDir * eyeSpaceDepth;  
    182191 
    183         OUT.illum_col.xyz = centerPosition.xyz - sample_position; 
     192        OUT.illum_col.xyz = centerPosition.xyz * maxDepth - sample_position; 
    184193        OUT.illum_col.w = currentDepth; 
    185         return OUT;*/ 
    186  
     194        return OUT; 
     195*/ 
    187196        //const float2 ao = ssao(IN, positions, noiseTexture, samples, normal, centerPosition, w, viewDir, eyePos); 
    188197        const float2 ao = ssao(IN, colors, noiseTexture, samples, normal, centerPosition, w, viewDir, eyePos, positions, 
    189                 uniform float3 bl, 
    190                 uniform float3 br, 
    191                 uniform float3 tl, 
    192                 uniform float3 tr); 
     198                bl, br, tl, tr, maxDepth); 
    193199                 
    194200 
Note: See TracChangeset for help on using the changeset viewer.