Changeset 3232
- Timestamp:
- 12/23/08 17:39:27 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 1 added
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.vcproj
r3230 r3232 776 776 </File> 777 777 <File 778 RelativePath=".\src\shaders\depthOfField.cg" 779 > 780 </File> 781 <File 778 782 RelativePath=".\src\shaders\globillum.cg" 779 783 > -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3231 r3232 65 65 static ShaderProgram *sCgLenseFlareProgram = NULL; 66 66 67 static ShaderProgram *sCgDOFProgram = NULL; 68 67 69 68 70 static GLuint noiseTex2D = 0; … … 74 76 #define NUM_PRECOMPUTED_SAMPLES 240 75 77 static Sample2 samples2[NUM_PRECOMPUTED_SAMPLES]; 76 // number of pcf tabs78 // pcf samples 77 79 static Sample2 pcfSamples[NUM_PCF_TABS]; 80 // dof samples 81 static Sample2 dofSamples[NUM_DOF_TABS]; 78 82 79 83 … … 392 396 sCgPrepareSsaoProgram = sm->CreateFragmentProgram("deferred", "PrepareSsao", "PrepareSsao"); 393 397 sCgLenseFlareProgram = sm->CreateFragmentProgram("lenseFlare", "LenseFlare", "LenseFlare"); 398 sCgDOFProgram = sm->CreateFragmentProgram("depthOfField", "DepthOfField", "DepthOfField"); 394 399 395 400 … … 408 413 "temporalCoherence", "samples", "bl", "br", "tl", 409 414 "tr", "oldModelViewProj", "modelViewProj"}; 415 410 416 sCgGiProgram->AddParameters(giParams, 0, 13); 411 417 … … 433 439 "ssaoFilterRadius", "modelViewProj", "bl", "br", "tl", 434 440 "tr", "w", "h"}; 441 435 442 sCgCombineSsaoProgram->AddParameters(combineSsaoParams, 0, 13); 436 443 … … 471 478 472 479 //////////////// 473 474 480 475 481 string lenseFlareParams[] = … … 479 485 sCgLenseFlareProgram->AddParameters(lenseFlareParams, 0, 9); 480 486 481 487 482 488 //////////////// 483 //-- prepare filters for ssao 489 490 string dofParams[] = {"colorsTex", "filterOffs", "sceneRange"}; 491 492 sCgDOFProgram->AddParameters(dofParams, 0, 3); 493 494 495 //////////////// 496 //-- prepare filter for ssao 484 497 485 498 PrepareSsaoFilter(); … … 500 513 sCgDeferredShadowProgram->SetArray2f(8, (float *)pcfSamples, NUM_PCF_TABS); 501 514 sCgDeferredShadowProgram->SetArray1f(9, (float *)filterWeights, NUM_PCF_TABS); 515 516 517 ///////// 518 //-- pcf tabs for depth of field 519 520 // todo matt: it is stupid to put num samples and width of kernel into constructor => change this!!! 521 PoissonDiscSampleGenerator2D poisson3(NUM_DOF_TABS, 1.0f); 522 poisson2.Generate((float *)dofSamples); 523 524 //float dofWeights[NUM_PCF_TABS]; 525 //sCgDOFProgram->SetArray1f(2, (float *)dofWeights, NUM_DOF_TABS); 502 526 503 527 PrintGLerror("init"); … … 551 575 } 552 576 577 578 /// do depth of field 579 DepthOfField(fbo); 580 553 581 /// compute lense flare 554 582 LenseFlare(fbo, light); … … 1277 1305 1278 1306 1307 void DeferredRenderer::DepthOfField(FrameBufferObject *fbo) 1308 { 1309 ColorBufferObject *colorBuffer = fbo->GetColorBuffer(colorBufferIdx); 1310 GLuint colorsTex = colorBuffer->GetTexture(); 1311 1312 FlipFbos(fbo); 1313 1314 float sceneRange = 1.0f; 1315 1316 int i = 0; 1317 1318 sCgDOFProgram->SetTexture(i ++, colorsTex); 1319 sCgDOFProgram->SetArray2f(i ++, (float *)dofSamples, NUM_DOF_TABS); 1320 sCgDOFProgram->SetValue1f(i ++, sceneRange); 1321 1322 DrawQuad(sCgDOFProgram); 1323 1324 PrintGLerror("LenseFlare"); 1325 } 1326 1327 1279 1328 void DeferredRenderer::SaveFrame(FrameBufferObject *fbo) 1280 1329 { -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.h
r3220 r3232 155 155 void SaveFrame(FrameBufferObject *fbo); 156 156 157 void DepthOfField(FrameBufferObject *fbo); 158 157 159 158 160 //////////// -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.cpp
r3230 r3232 189 189 #else 190 190 191 //static PoissonDiscSampleGenerator2D poisson(mNumSamples, 1.0f);192 //poisson.Generate(samples);193 194 191 PoissonDiscSampleGenerator2D::Generate(samples); 195 192 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3230 r3232 6 6 //-- ssao + gi parameters 7 7 8 //#define NUM_SAMPLES 88 #define NUM_SAMPLES 8 9 9 //#define NUM_SAMPLES 16 10 10 //#define NUM_SAMPLES 24 11 #define NUM_SAMPLES 4811 //#define NUM_SAMPLES 48 12 12 13 13 #define MIN_SAMPLES 8 … … 60 60 #define NUM_DOWNSAMPLES 9 61 61 62 #define NUM_DOF_TABS 16 62 63 63 64 65 //#define USE_GTX 66 64 67 #endif // __SHADERENV_H -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg
r3226 r3232 115 115 float4 ao = tex2Dlod(ssaoTex, float4(IN.texCoord, 0, 0)); 116 116 117 #if 0 // use half size 118 117 119 // the following has to be done for half resolution ssao: 118 120 // get the minimum convergence by exactly sampling the 4 surrounding … … 124 126 125 127 // get position exactly between old texel centers 126 /*float2 center;128 float2 center; 127 129 center.x = (floor(IN.texCoord.x * w - .5f) + 1.0f) / w; 128 130 center.y = (floor(IN.texCoord.y * h - .5f) + 1.0f) / h; … … 137 139 138 140 const float minConvergence = min(m1, m2); 139 const float convergence = minConvergence;*/ 140 //const float convergence = 0; 141 const float convergence = minConvergence; 142 143 #else 144 145 // just take unfiltered convergence in current pixel 141 146 const float convergence = ao.y; 142 147 148 #endif 149 143 150 // filter reaches size 1 pixel when sample size reaches threshold 144 151 // afterwards we do not use the filter anymore -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/common.h
r3230 r3232 47 47 48 48 49 50 51 49 inline float2 myrotate(float2 pt, float angle) 52 50 { … … 60 58 } 61 59 62 63 #define USE_GTX
Note: See TracChangeset
for help on using the changeset viewer.