- Timestamp:
- 09/04/08 10:14:18 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r2900 r2901 119 119 static void GenerateSamples(int sampling) 120 120 { 121 static SphericalSampleGenerator gauss(NUM_SAMPLES, 0.5f);121 SphericalSampleGenerator gauss(NUM_SAMPLES, 1.0f); 122 122 gauss.Generate((float *)samples3); 123 /* 123 124 /* 124 125 switch (sampling) 125 126 { … … 150 151 float *randomNormals = new float[w * h * 3]; 151 152 153 //SphericalSampleGenerator gauss(w * h, 1.0f); 154 //gauss.Generate(randomNormals); 155 152 156 static HaltonSequence halton; 153 157 float r[2]; … … 158 162 halton.GetNext(2, r); 159 163 160 /* 161 const float theta = 2.0f * acos(sqrt(1.0f - rx)); 162 163 randomNormals[i + 0] = cos(theta); 164 randomNormals[i + 1] = sin(theta); 165 randomNormals[i + 2] = 0;*/ 164 165 //const float theta = 2.0f * acos(sqrt(1.0f - rx)); 166 //randomNormals[i + 0] = cos(theta); 167 //randomNormals[i + 1] = sin(theta); 168 //randomNormals[i + 2] = 0; 166 169 167 170 const float theta = 2.0f * acos(sqrt(1.0f - r[0])); … … 272 275 CG_SOURCE, 273 276 //"src/shaders/ssao.cg", 274 "src/shaders/ssao 2.cg",277 "src/shaders/ssao3d.cg", 275 278 RenderState::sCgFragmentProfile, 276 279 "main", … … 294 297 sOldTexParam = cgGetNamedParameter(sCgSsaoProgram, "oldTex"); 295 298 296 cgGLSetParameter1f(sNoiseMultiplierParam, RandomValue( 3.0f, 17.0f));299 cgGLSetParameter1f(sNoiseMultiplierParam, RandomValue(1.0f, 3.0f)); 297 300 sSamplesParam = cgGetNamedParameter(sCgSsaoProgram, "samples"); 298 301 } … … 328 331 sOldIllumTexGiParam = cgGetNamedParameter(sCgGiProgram, "oldIllumTex"); 329 332 330 cgGLSetParameter1f(sNoiseMultiplierGiParam, RandomValue( 3.0f, 17.0f));333 cgGLSetParameter1f(sNoiseMultiplierGiParam, RandomValue(1.0f, 3.0f)); 331 334 } 332 335 else … … 421 424 const Matrix4x4 &oldProjViewMatrix, 422 425 const Matrix4x4 &projViewMatrix, 423 float expFactor,426 float tempCohFactor, 424 427 ShadowMap *shadowMap) 425 428 { … … 462 465 { 463 466 case SSAO: 464 ComputeSsao(fbo, expFactor, oldProjViewMatrix, projViewMatrix);467 ComputeSsao(fbo, tempCohFactor, oldProjViewMatrix, projViewMatrix); 465 468 CombineSsao(fbo); 466 469 break; 467 470 case GI: 468 ComputeGlobIllum(fbo, expFactor, oldProjViewMatrix);471 ComputeGlobIllum(fbo, tempCohFactor, oldProjViewMatrix); 469 472 CombineIllum(fbo); 470 473 break; … … 492 495 493 496 void DeferredRenderer::ComputeSsao(FrameBufferObject *fbo, 494 float expFactor,497 float tempCohFactor, 495 498 const Matrix4x4 &oldProjViewMatrix, 496 499 const Matrix4x4 &projViewMatrix … … 550 553 cgGLSetParameter1f(sMaxDepthParam, mScaleFactor); 551 554 552 cgGLSetParameter1f(sTemporalCoherenceParam, (mUseTemporalCoherence && !mRegenerateSamples) ? 255: 0);555 cgGLSetParameter1f(sTemporalCoherenceParam, (mUseTemporalCoherence && !mRegenerateSamples) ? tempCohFactor : 0); 553 556 554 557 if (mUseTemporalCoherence || mRegenerateSamples) … … 716 719 717 720 void DeferredRenderer::ComputeGlobIllum(FrameBufferObject *fbo, 718 float expFactor, 719 const Matrix4x4 &oldProjViewMatrix 720 ) 721 float tempCohFactor, 722 const Matrix4x4 &oldProjViewMatrix) 721 723 { 722 724 cgGLSetMatrixParameterfc(sOldModelViewProjMatrixGiParam, (const float *)oldProjViewMatrix.x); 723 725 724 //GLuint colorsTex = mFbo->GetColorBuffer(0)->GetTexture();725 726 GLuint colorsTex = fbo->GetColorBuffer(3)->GetTexture(); 726 727 GLuint positionsTex = fbo->GetColorBuffer(1)->GetTexture(); … … 740 741 741 742 // read the second buffer, write to the first buffer 742 //mNewFbo->Bind();743 743 mFbo->Bind(); 744 744 745 745 glDrawBuffers(2, mrt + mFboIndex); 746 746 747 //GLuint oldSsaoTex = mOldFbo->GetColorBuffer(0)->GetTexture();748 //GLuint oldIllumTex = mOldFbo->GetColorBuffer(1)->GetTexture();749 750 747 GLuint oldSsaoTex = mFbo->GetColorBuffer(2 - mFboIndex)->GetTexture(); 751 748 GLuint oldIllumTex = mFbo->GetColorBuffer(2 - mFboIndex + 1)->GetTexture(); … … 776 773 cgGLSetParameter1f(sMaxDepthGiParam, mScaleFactor); 777 774 778 cgGLSetParameter1f(sTemporalCoherenceGiParam, (mUseTemporalCoherence && !mRegenerateSamples) ? 255: 0);775 cgGLSetParameter1f(sTemporalCoherenceGiParam, (mUseTemporalCoherence && !mRegenerateSamples) ? tempCohFactor : 0); 779 776 780 777
Note: See TracChangeset
for help on using the changeset viewer.