Changeset 3129 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders
- Timestamp:
- 11/16/08 23:57:33 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg
r3128 r3129 167 167 168 168 //depthFactor = clamp(1.0f - abs(1.0f - eyeSpaceDepth / aoSample.w), 1e-3f, 1.0f); 169 depthFactor = max(step(5e- 2f, 1.0f - abs(1.0f - eyeSpaceDepth / aoSample.w)), 1e-3f);170 normalFactor = max(step(0. 5f, dot(sampleNorm, norm)), 1e-3f);171 172 w = filterWeights[i] * normalFactor * depthFactor;173 //w = filterWeights[i]* depthFactor;169 depthFactor = max(step(5e-1f, 1.0f - abs(1.0f - eyeSpaceDepth / aoSample.w)), 1e-3f); 170 normalFactor = max(step(0.3f, dot(sampleNorm, norm)), 1e-3f); 171 172 //w = filterWeights[i] * normalFactor * depthFactor; 173 w = normalFactor * depthFactor; 174 174 175 175 average += aoSample.y * w; … … 177 177 } 178 178 179 average *= 1.0f / max(total_w, 1e- 6f);179 average *= 1.0f / max(total_w, 1e-3f); 180 180 181 181 return average; … … 193 193 float4 ao = tex2Dlod(ssaoTex, float4(IN.texCoord, 0, 0)); 194 194 195 //const static float scaleFactor = 10.0f;195 //const static float scaleFactor = 20.0f; 196 196 const static float scaleFactor = 10.0f; 197 198 197 ao.y = DiscontinuityFilter2(IN.texCoord, ao, ssaoTex, normalsTex, filterOffs, filterWeights, scaleFactor * ao.z, 1); 199 198 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3128 r3129 209 209 #endif 210 210 211 const float oldWeight = clamp(oldPixel.y, .0f, temporalCoherence);212 //const float oldWeight = oldPixel.y;211 //const float oldWeight = clamp(oldPixel.y, .0f, temporalCoherence); 212 const float oldWeight = oldPixel.y; 213 213 214 214 float newWeight; … … 220 220 // if visibility changed in the surrounding area we have to recompute 221 221 //&& (oldNumSamples > 0.8f * newNumSamples) 222 && (notValid < 1.0f)222 //&& (notValid < 1.0f) 223 223 ) 224 224 { 225 225 // increase the weight for convergence 226 226 newWeight = oldWeight + 1.0f; 227 //if (notValid > 1.0f) newWeight = 10.0f;227 if (notValid > 1.0f) newWeight = 10.0f; 228 228 //if (notValid > 1.0f) newWeight = max(15.0f - notValid * 2.0f, 1.0f); 229 229 } … … 236 236 // newWeight = min(temporalCoherence + 1, max(oldPixel.y - 70, 50)); 237 237 //if (newWeight >= 2000) newWeight = 1000; 238 //newWeight -= step(2000.0f, newWeight) * 1000.0f;238 newWeight -= step(512.0f, newWeight) * 256.0f; 239 239 240 240 return float3(oldPixel.x, newWeight, eyeSpaceDepth); … … 257 257 float3 viewDir 258 258 , float2 noiseOffs 259 , sampler2D noiseTex1D 259 260 ) 260 261 { … … 266 267 float numSamples = .0f; 267 268 269 270 //float2 jitter = tex2Dlod(noiseTex1D, float4(IN.texCoord.x * 4.0f + noiseOffs.x, 0.5f, 0, 0)).xy; 271 //float2 jitter = tex2Dlod(noiseTex1D, float4(noiseOffs.x, 0.5f, 0, 0)).xy; 268 272 269 273 for (int i = 0; i < NUM_SAMPLES; ++ i) … … 282 286 #endif 283 287 // weight with projected coordinate to reach similar kernel size for near and far 288 //const float2 texcoord = IN.texCoord.xy + offsetTransformed * scaleFactor + jitter; 284 289 const float2 texcoord = IN.texCoord.xy + offsetTransformed * scaleFactor; 285 290 286 291 //if ((texcoord.x <= 1.0f) && (texcoord.x >= 0.0f) && (texcoord.y <= 1.0f) && (texcoord.y >= 0.0f)) ++ numSamples; 287 288 292 const float3 samplePos = ReconstructSamplePos(colors, texcoord, bl, br, tl, tr); 289 293 … … 340 344 uniform float3 oldtl, 341 345 uniform float3 oldtr, 342 uniform sampler2D attribsTex 346 uniform sampler2D attribsTex, 347 uniform sampler2D noiseTex1D 343 348 ) 344 349 { … … 378 383 scaleFactor, 379 384 oldbl, oldbr, oldtl, oldtr, 380 diffVec); 385 diffVec 386 ); 381 387 382 388 const float oldSsao = temporalVals.x; 383 const float newWeight = clamp(temporalVals.y, .0f, temporalCoherence); 384 385 //float2 noiseOffs = float2(temporalVals.y / 139.0f, temporalVals.y / 141.0f); 386 float2 noiseOffs = float2(.0f); 389 const float newWeight = clamp(temporalVals.y, 1.0f, temporalCoherence); 390 float2 noiseOffs = float2((temporalVals.y - 1)/ 139.0f, .0f); 391 //float2 noiseOffs = float2(.0f); 387 392 388 393 float2 ao; … … 392 397 { 393 398 ao = ssao(IN, colors, noiseTex, samples, normal, 394 eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), noiseOffs );399 eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), noiseOffs, noiseTex1D); 395 400 } 396 401 else
Note: See TracChangeset
for help on using the changeset viewer.