Changeset 3025 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders
- Timestamp:
- 10/12/08 11:46:50 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r3024 r3025 91 91 float CalcShadowTerm(fragment IN, 92 92 uniform sampler2D shadowMap, 93 uniform float w,93 uniform float scale, 94 94 uniform float2 lightSpacePos, 95 95 uniform float depth, 96 96 uniform float2 samples[NUM_PCF_TABS], 97 uniform float weights[NUM_PCF_TABS], 97 98 uniform sampler2D noiseTexture 98 99 ) … … 101 102 //return step(depth, shadowDepth); 102 103 103 float total_d = 0.0; 104 104 float total_d = .0f; 105 float total_w = .0f; 106 105 107 for (int i = 0; i < NUM_PCF_TABS; ++ i) 106 108 { 107 109 const float2 offset = samples[i]; 110 const float w = weights[i]; 108 111 109 112 #if 1 … … 117 120 #endif 118 121 // weight with projected coordinate to reach similar kernel size for near and far 119 float2 texcoord = lightSpacePos + offsetTransformed * w;122 float2 texcoord = lightSpacePos + offsetTransformed * scale; 120 123 121 124 float shadowDepth = tex2D(shadowMap, texcoord).x; 122 125 123 total_d += step(depth, shadowDepth); 126 total_d += w * step(depth, shadowDepth); 127 total_w += w; 124 128 } 125 129 126 total_d /= (float) NUM_PCF_TABS;130 total_d /= (float)total_w; 127 131 128 132 return total_d; 129 133 } 134 130 135 131 136 inline float3 Interpol(float2 w, float3 bl, float3 br, float3 tl, float3 tr) … … 195 200 196 201 float shadowTerm = CalcShadowTerm(IN, shadowMap, sampleWidth, lightSpacePos.xy, lightSpacePos.z, samples, weights, noiseTexture); 202 //float shadowTerm = CalcShadowTerm(IN, shadowMap, sampleWidth, lightSpacePos.xy, lightSpacePos.z, samples, noiseTexture); 197 203 198 204 diffuse *= shadowTerm;
Note: See TracChangeset
for help on using the changeset viewer.