Changeset 3307 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Timestamp:
- 02/12/09 18:45:14 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3306 r3307 250 250 float2 mynoise = tex2Dlod(noiseTex, float4(IN.texCoord * 4.0f, 0, 0)).xy; 251 251 //offset = myreflect(samples[i], mynoise); 252 offset = myrotate(samples[i ], mynoise.x);252 offset = myrotate(samples[i + (int)convergence], mynoise.x); 253 253 } 254 254 else … … 294 294 // we check if the sample could have been near enough to the current pixel 295 295 // to have any influence in the current or last frame 296 const float tooFarAway = step(0.5f, lengthToSample - changeFactor);296 //const float tooFarAway = step(0.5f, lengthToSample - changeFactor); 297 297 //validSamples = max(validSamples, (1.0f - tooFarAway) * pixelValid * step(-0.1f, cosAngle)); 298 298 validSamples = max(validSamples, pixelValid); … … 303 303 if (numSamples >= MIN_SAMPLES) 304 304 { 305 //break;306 305 // if the pixel belongs to a static object and all the samples stay valid in the current frame 307 306 if (!isMovingObject && (validSamples < 1.0f)) break; … … 393 392 const float oldSsao = temporalVals.x; 394 393 float oldWeight = temporalVals.y; 395 394 395 float usedWeight = min(temporalCoherence, abs(oldWeight)); 396 396 397 float3 ao; 397 398 … … 399 400 if (eyeSpaceDepth < DEPTH_THRESHOLD) 400 401 { 401 ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight, sampleIntensity, isMovingObject);402 ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), usedWeight, sampleIntensity, isMovingObject); 402 403 //ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), normals, sampleIntensity); 403 404 } … … 420 421 const float partlyResetThres = 1.0f; 421 422 422 if (1)//!isMovingObject) 423 // hack: just update static geometry 424 if (!isMovingObject) 423 425 { 424 426 if (ao.y > completelyResetThres) … … 436 438 //-- blend ao between old and new samples (and avoid division by zero) 437 439 438 OUT.illum_col.x = (ao.x * newWeight + oldSsao * oldWeight);// / (newWeight + oldWeight);//max(1e-6f, newWeight + oldWeight); 439 440 OUT.illum_col.x /= (newWeight + oldWeight); 440 OUT.illum_col.x = ao.x * newWeight + oldSsao * usedWeight; 441 OUT.illum_col.x /= (newWeight + usedWeight); 441 442 442 443 // the new weight for the next frame 443 const float combinedWeight = clamp(newWeight + oldWeight, .0f, temporalCoherence); 444 //const float combinedWeight = clamp(newWeight + oldWeight, .0f, temporalCoherence); 445 const float combinedWeight = newWeight + oldWeight; 444 446 445 447 OUT.illum_col.y = combinedWeight;
Note: See TracChangeset
for help on using the changeset viewer.