- Timestamp:
- 11/27/08 02:14:31 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3175 r3189 287 287 mSamplingMethod(SAMPLING_POISSON), 288 288 mShadingMethod(DEFAULT), 289 mIllumFboIndex(0) 289 mIllumFboIndex(0), 290 mSortSamples(true) 290 291 { 291 292 /////////// 292 293 //-- the flip-flop fbos 293 294 294 const int dsw = w / 2; const int dsh = h / 2;295 //const int dsw = w; const int dsh = h;295 //const int dsw = w / 2; const int dsh = h / 2; 296 const int dsw = w; const int dsh = h; 296 297 297 298 mIllumFbo = new FrameBufferObject(dsw, dsh, FrameBufferObject::DEPTH_NONE); … … 515 516 } 516 517 517 // antialiasing of the color buffer 518 //AntiAliasing(fbo, light); 518 // multisampling is difficult / costly with deferred shading 519 // at least do some edge blurring 520 if (useAntiAliasing) AntiAliasing(fbo, light); 519 521 520 522 switch (mShadingMethod) … … 543 545 // multisampling is difficult / costly with deferred shading 544 546 // at least do some edge blurring 545 546 if (useAntiAliasing) 547 AntiAliasing(fbo, light); 548 else 549 Output(fbo); // just output the latest buffer 547 //if (useAntiAliasing) AntiAliasing(fbo, light); else 548 Output(fbo); // just output the latest buffer 550 549 551 550 glEnable(GL_LIGHTING); … … 590 589 void DeferredRenderer::SortSamples() 591 590 { 592 //for (int i = 0; i < NUM_SAMPLES; ++ i)cout << SqrDist(samples2[i-1], samples2[i]) << "|";593 float dist = 0;594 for (int i = 1; i < NUM_SAMPLES; ++ i)595 dist += SqrDist(samples2[i-1], samples2[i]);596 //cout << samples2[i].x << " " << samples2[i].y597 598 //cout << "\nbefore: " << dist << endl;599 600 //sort(samples2, samples2 + sizeof(samples2) / sizeof(Sample2), lt2);601 602 603 591 static Sample2 tempSamples[NUM_SAMPLES]; 604 592 static bool checked[NUM_SAMPLES]; … … 636 624 for (int i = 0; i < NUM_SAMPLES; ++ i) 637 625 samples2[i] = tempSamples[i]; 638 639 dist = 0;640 for (int i = 1; i < NUM_SAMPLES; ++ i)641 dist += SqrDist(samples2[i-1], samples2[i]);642 //cout << samples2[i].x << " " << samples2[i].y << " " << SqrDist(samples2[i-1], samples2[i]) << "|";643 644 //cout << "after: " << dist << endl;645 626 } 646 627 … … 693 674 GenerateSamples(mSamplingMethod); 694 675 695 SortSamples();676 if (mSortSamples) { SortSamples(); } 696 677 sCgSsaoProgram->SetArray2f(i, (float *)samples2, NUM_SAMPLES); 697 678 } … … 749 730 750 731 // read the second buffer, write to the first buffer 751 //FlipFbos(fbo);732 FlipFbos(fbo); 752 733 // end of the pipeline => just draw image to screen 753 FrameBufferObject::Release();734 //FrameBufferObject::Release(); 754 735 755 736 // the neighbouring texels -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.h
r3175 r3189 56 56 */ 57 57 void SetShadingMethod(SHADING_METHOD s); 58 59 void SetSortSamples(bool sortSamples) { mSortSamples = sortSamples; } 58 60 59 61 // hack: store the color buffer idx for the currently used flip flop-MRT here … … 146 148 Vector3 mEyePos; 147 149 Vector3 mOldEyePos; 150 151 bool mSortSamples; 148 152 }; 149 153 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SkyPreetham.cpp
r3123 r3189 293 293 // downscale ambient color 294 294 if (scaleToRange) 295 ambient *= 5e-6f;295 ambient *= 8e-6f; 296 296 else 297 297 ambient *= 1e-1f; … … 333 333 // calculate final sun diffuse color. 334 334 if (scaleToRange) 335 diffuse = color * 1e-5f;335 diffuse = color * 3e-5f; 336 336 else 337 337 diffuse = color * 3e-1f; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3175 r3189 106 106 107 107 MotionPath *motionPath = NULL; 108 108 /// max depth where candidates for tighter bounds are searched 109 109 int maxDepthForTestingChildren = 3; 110 110 … … 213 213 PerformanceGraph *perfGraph = NULL; 214 214 215 static float ssaoTempCohFactor = 255.0; 216 static int sCurrentMrtSet = 0; 215 float ssaoTempCohFactor = 255.0; 216 bool sortSamples = true; 217 int sCurrentMrtSet = 0; 217 218 218 219 static Matrix4x4 invTrafo = IdentityMatrix(); … … 1138 1139 deferredShader->SetSamplingMethod(samplingMethod); 1139 1140 deferredShader->SetUseTemporalCoherence(useTemporalCoherence); 1141 deferredShader->SetSortSamples(sortSamples); 1140 1142 1141 1143 ShadowMap *sm = showShadowMap ? shadowMap : NULL; … … 1311 1313 useRenderQueue = !useRenderQueue; 1312 1314 traverser->SetUseRenderQueue(useRenderQueue); 1313 1314 1315 break; 1315 1316 case 'b': … … 1329 1330 case 'I': 1330 1331 useAntiAliasing = !useAntiAliasing; 1332 break; 1333 case '9': 1334 sortSamples = !sortSamples; 1331 1335 break; 1332 1336 default: -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3167 r3189 6 6 //-- ssao + gi parameters 7 7 8 #define NUM_SAMPLES 8 8 //#define NUM_SAMPLES 8 9 #define NUM_SAMPLES 16 9 10 //#define NUM_SAMPLES 24 10 11 11 12 // for quadratic falloff 12 13 //#define SAMPLE_INTENSITY 0.2f 13 #define SAMPLE_INTENSITY 0.07f14 //#define SAMPLE_INTENSITY 0.01f14 //#define SAMPLE_INTENSITY 0.07f 15 #define SAMPLE_INTENSITY 0.008f 15 16 16 17 //#define SAMPLE_INTENSITY 0.075f 17 18 //#define SAMPLE_INTENSITY 0.2f 18 19 19 #define SAMPLE_RADIUS 8e-1f 20 //#define SAMPLE_RADIUS 8e-1f 21 #define SAMPLE_RADIUS 4e-1f 20 22 21 23 //#define DISTANCE_SCALE 1e-1f -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/antialiasing.cg
r3175 r3189 76 76 77 77 //const float de = saturate(dot(dd, weights.y)); 78 const float de = weights.y * dd.x + dd.y + dd.z +dd.w;78 const float de = weights.y * dd.x * dd.y * dd.z * dd.w; 79 79 80 80 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg
r3168 r3189 130 130 spatialFactor = 1.0f / max(len, 1e-3f); 131 131 132 //normalFactor = max(step(0.6f, dot(sampleNorm, centerNormal)), 1e-3f);133 normalFactor = max(dot(sampleNorm, samplePos), 1e-3f);132 normalFactor = max(step(.0f, dot(sampleNorm, centerNormal)), 1e-3f); 133 //normalFactor = max(dot(sampleNorm, samplePos), 1e-3f); 134 134 //convergenceFactor = min(100.0f, aoSample.y); 135 135 convergenceFactor = aoSample.y; … … 137 137 // combine the weights 138 138 w = convergenceFactor * spatialFactor * normalFactor; 139 //w = convergenceFactor * spatialFactor; 139 140 140 141 average += aoSample.x * w; … … 169 170 float4 ao = tex2Dlod(ssaoTex, float4(IN.texCoord, 0, 0)); 170 171 171 // reconstruct position from the eye space depth172 /*const float4 worldPos = float4(-IN.view * eyeSpaceDepth, 1.0f);173 // compute w factor from projection in order to control filter size174 const float4 projPos = mul(modelViewProj, worldPos);175 const float distanceScale = 1.0f / projPos.w;176 */177 178 172 // filter up to a certain convergance value and leave out background (sky) by checking depth 179 173 if ((ao.y < 100.0f) && (col.w < 1e10f)) -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r3168 r3189 290 290 float validPixel; 291 291 292 if ((((squaredLen <= DYNAMIC_OBJECTS_THRESHOLD) && (oldPixel.z <= DYNAMIC_OBJECTS_THRESHOLD)) || 293 (depthDif <= MIN_DEPTH_DIFF)) 292 const bool oldDynamic = (squaredLen <= DYNAMIC_OBJECTS_THRESHOLD); 293 const bool newDynamic = (oldPixel.z <= DYNAMIC_OBJECTS_THRESHOLD); 294 295 if (!(oldDynamic && !newDynamic) && !(!oldDynamic && newDynamic) && 296 !(oldDynamic && newDynamic && (depthDif > MIN_DEPTH_DIFF)) 294 297 && (oldTexCoords.x >= 0.0f) && (oldTexCoords.x < 1.0f) 295 298 && (oldTexCoords.y >= 0.0f) && (oldTexCoords.y < 1.0f)
Note: See TracChangeset
for help on using the changeset viewer.