Changeset 3349 for GTP/trunk/App
- Timestamp:
- 04/13/09 22:01:56 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3347 r3349 432 432 mDownSampleFbo->AddColorBuffer(ColorBufferObject::RGB_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR); 433 433 434 435 434 for (int i = 0; i < 2; ++ i) 436 435 { … … 822 821 // read the second buffer, write to the first buffer 823 822 mIllumFbo->Bind(); 824 glDrawBuffers( 1, mrt + mIllumFboIndex);823 glDrawBuffers(2, mrt + mIllumFboIndex); 825 824 826 825 int i = 0; … … 929 928 930 929 // the neighbouring texels 931 constfloat xOffs = 1.0f / fbo->GetWidth();932 constfloat yOffs = 1.0f / fbo->GetHeight();930 float xOffs = 1.0f / fbo->GetWidth(); 931 float yOffs = 1.0f / fbo->GetHeight(); 933 932 934 933 sCgAntiAliasingProgram->SetTexture(0, colorsTex); … … 1383 1382 gluOrtho2D(0, 1, 0, 1); 1384 1383 1384 1385 1385 glMatrixMode(GL_MODELVIEW); 1386 1386 glPushMatrix(); 1387 1387 glLoadIdentity(); 1388 1388 1389 1389 1390 glPushAttrib(GL_VIEWPORT_BIT); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg
r3347 r3349 250 250 251 251 //OUT.illum_col.xyz = float3(ao.w * 5e-1f, 0, 0); 252 //OUT.illum_col.xyz = float3(ao. y * 1e-2f);252 //OUT.illum_col.xyz = float3(ao.z * 1e-1f); 253 253 //OUT.illum_col.xyz = float3(ao.y * 1e-1f);//, 0, 0); 254 254 //OUT.illum_col.xyz = ao.xyz; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r3347 r3349 254 254 // retrieve the sample from the last frame 255 255 const float4 oldPixel = tex2Dlod(oldTex, float4(oldTexCoords, .0f, .0f)); 256 //const float oldDiff = tex2Dlod(myTex, float4(oldTexCoords, .0f, .0f)).x; 257 const float oldDiff = oldPixel.z;//tex2Dlod(myTex, float4(oldTexCoords, .0f, .0f)).z; 256 const float oldDiff = tex2Dlod(myTex, float4(oldTexCoords, .0f, .0f)).x; 258 257 259 258 // calculate eye space position of sample in old frame … … 306 305 isPixelValid = pixelIsValid; 307 306 } 308 //isPixelValid = pixelIsValid;309 307 310 308 return float2(isPixelValid, abs(oldEyeSpaceDepth - projectedEyeSpaceDepth)); … … 340 338 const float3 normal = normalize(tex2Dlod(normalsTex, float4(IN.texCoord, 0, 0)).xyz); 341 339 342 #ifdef PERFORMANCE_TEST 340 //#ifdef PERFORMANCE_TEST 341 #if 1 343 342 // do reprojection and filter out the pixels that are not save 344 343 const float2 pValid = PixelValid(oldTex, … … 354 353 ); 355 354 #else 356 const float2 pValid = float2(0, 355 const float2 pValid = float2(0,0); 357 356 #endif 358 357 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3348 r3349 20 20 { 21 21 float4 illum_col: COLOR0; 22 //float4 col: COLOR1;22 float4 col: COLOR1; 23 23 }; 24 24 … … 117 117 const float oldEyeSpaceDepth = oldPixel.w; 118 118 119 // vector from eye pos to old sample 119 // vector from eye pos to old sample 120 120 const float3 viewVec = Interpol(oldTexCoords, oldbl, oldbr, oldtl, oldtr); 121 121 const float invLen = 1.0f / length(viewVec); … … 148 148 149 149 //w = ComputeConvergence(oldTex, oldTexCoords, float2(1024.0f, 768.0f)); 150 //w = floor(oldPixel.y);151 //w = oldPixel.y;152 idx = floor(oldPixel.y); 150 w = oldPixel.y; 151 idx = floor(oldPixel.z); 152 153 153 } 154 154 else 155 155 { 156 w =.0f;156 w = 0.0f; 157 157 idx = .0f; 158 158 } 159 159 160 return float3(ssao, idx, w);160 return float3(ssao, w, idx); 161 161 } 162 162 … … 201 201 tex2Dlod(samples, float4((0.5f + i + idx) / NUM_PRECOMPUTED_SAMPLES, 0.5f, .0f, .0f)).xy; 202 202 203 204 203 //////////////////// 205 204 //-- add random noise: reflect around random normal vector … … 208 207 if (convergence < SSAO_CONVERGENCE_THRESHOLD) 209 208 { 210 float2 mynoise = tex2Dlod(noiseTex, float4(IN.texCoord * 4.0f, .0f, .0f)).xy;209 float2 mynoise = tex2Dlod(noiseTex, float4(IN.texCoord * 4.0f, 0, 0)).xy; 211 210 //offset = myreflect(samples[i], mynoise); 212 211 //offset = myrotate(samples[i], mynoise.x); … … 502 501 #ifdef PERFORMANCE_TEST 503 502 504 float3 diffVec = tex2Dlod(attribsTex, float4(IN.texCoord, .0f, .0f)).xyz;503 float3 diffVec = tex2Dlod(attribsTex, float4(IN.texCoord, 0, 0)).xyz; 505 504 506 505 const float sqrMoveSpeed = SqrLen(diffVec); … … 522 521 const float oldSsao = temporalVals.x; 523 522 524 //float oldIdx = temporalCoherence > 1 ? temporalVals.y : .0f; 525 float oldIdx = temporalVals.y; 526 //float oldWeight = temporalVals.y; 527 float oldWeight = clamp(oldIdx, 0, temporalCoherence); 528 523 float oldWeight = temporalVals.y; 524 float oldIdx = temporalCoherence > 1 ? temporalVals.z : 0; 525 529 526 #else 530 527 531 528 const bool isMovingObject = false; 532 const float oldSsao = .0f;533 534 float oldWeight = .0f;535 float oldIdx = .0f;529 const float oldSsao = 0; 530 531 float oldWeight = 0; 532 float oldIdx = 0; 536 533 537 534 #endif … … 585 582 else if (ao.y > partlyResetThres) 586 583 { 587 //if (oldIdx > 4.0f * NUM_SAMPLES) oldIdx = 0;588 oldWeight = min(oldWeight, 4.0f * NUM_SAMPLES); oldIdx = oldWeight;589 //old Weight = oldIdx;//.0f; oldIdx = .0f;584 oldWeight = min(oldWeight, 4.0f * newWeight); 585 //oldWeight = .0f; 586 //oldIdx = .0f; 590 587 } 591 588 } … … 599 596 600 597 // the new weight for the next frame 601 const float newIdx = newWeight + oldIdx; 602 //const float combinedWeight = clamp(newIdx, .0f, temporalCoherence); 603 const float combinedWeight = clamp(newIdx, .0f, min(newWeight + oldWeight, temporalCoherence)); 604 605 //OUT.illum_col.y = combinedWeight; 606 OUT.illum_col.y = newIdx; // the new index 598 const float combinedWeight = clamp(newWeight + oldWeight, .0f, temporalCoherence); 599 600 OUT.illum_col.y = combinedWeight; 601 OUT.illum_col.z = oldIdx + newWeight; // the new index 607 602 OUT.illum_col.w = eyeSpaceDepth; 608 603 … … 610 605 611 606 // this value can be used to check if this pixel belongs to a moving object 612 //OUT.col.x = SqrLen(diffVec);613 OUT.illum_col.z = SqrLen(diffVec);607 OUT.col.x = SqrLen(diffVec); 608 //OUT.illum_col.z = SqrLen(diffVec); 614 609 615 610 #else
Note: See TracChangeset
for help on using the changeset viewer.