Ignore:
Timestamp:
09/01/08 18:33:14 (16 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r2887 r2892  
    4949                   uniform sampler2D colors, 
    5050                   uniform sampler2D positions, 
    51                    uniform sampler2D normals 
     51                   uniform sampler2D normals     
    5252                   ) 
    5353{ 
     
    7272        return OUT; 
    7373} 
     74 
     75/** The mrt shader for standard rendering 
     76*/ 
     77pixel main_shadow(fragment IN,  
     78                                  uniform sampler2D colors, 
     79                                  uniform sampler2D positions, 
     80                                  uniform sampler2D normals,                
     81                                  uniform sampler2D shadowMap, 
     82                                  uniform float4x4 shadowMatrix 
     83                                  ) 
     84{ 
     85        pixel OUT; 
     86 
     87        float4 norm = tex2D(normals, IN.texCoord.xy); 
     88        float4 color = tex2Dlod(colors, float4(IN.texCoord.xy, 0, 0)); 
     89        float4 position = tex2D(positions, IN.texCoord.xy); 
     90 
     91        float4 lightSpacePos = mul(shadowMatrix, position); 
     92 
     93        float shadowDepth = tex2D(shadowMap, IN.texCoord.xy); 
     94 
     95        // an ambient color term 
     96        float amb = norm.w; 
     97 
     98        float3 normal = normalize(norm.xyz); 
     99        float4 col = shade(IN, color, position, normal, amb); 
     100         
     101        OUT.color = col; 
     102         
     103        if (lightSpacePos.z / lightSpacePos.w < shadowDepth) 
     104        { 
     105                OUT.color *= 0.1f; 
     106        } 
     107         
     108        //OUT.color = float4(lightSpacePos.z / lightSpacePos.w); 
     109        //OUT.color = float4(shadowDepth); 
     110        OUT.color.w = color.w; 
     111 
     112        return OUT; 
     113} 
Note: See TracChangeset for help on using the changeset viewer.