Changeset 3301 for GTP/trunk/App/Demos/Vis/FriendlyCulling
- Timestamp:
- 02/11/09 17:40:23 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3300 r3301 57 57 58 58 static ShaderProgram *sCgCombineSsaoProgram = NULL; 59 static ShaderProgram *sCgFilterSsaoProgram = NULL; 59 60 static ShaderProgram *sCgCombineIllumProgram = NULL; 60 61 static ShaderProgram *sCgLogLumProgram = NULL; … … 326 327 } 327 328 329 /////// 330 //-- the illumination fbo is either half size or full size 331 328 332 mIllumFbo = new FrameBufferObject(downSampledWidth, downSampledHeight, FrameBufferObject::DEPTH_NONE); 329 //mIllumFbo = new FrameBufferObject(w, h, FrameBufferObject::DEPTH_NONE);330 333 331 334 mFBOs.push_back(mIllumFbo); … … 359 362 // for performance reasons we use a smaller texture and repeat it over the screen 360 363 CreateNoiseTex2D(mIllumFbo->GetWidth() / 4, mIllumFbo->GetWidth() / 4); 361 //CreateNoiseTex2D(mIllumFbo->GetWidth(), mIllumFbo->GetWidth()); 362 364 363 365 mProjViewMatrix = IdentityMatrix(); 364 366 mOldProjViewMatrix = IdentityMatrix(); … … 397 399 //sCgCombineSsaoProgram = sm->CreateFragmentProgram("combineSsao", "CombineSsaoHalfRes", "CombineSsao"); 398 400 sCgCombineSsaoProgram = sm->CreateFragmentProgram("combineSsaoSep", "CombineSsaoFullRes", "CombineSsao"); 401 sCgFilterSsaoProgram = sm->CreateFragmentProgram("combineSsaoSep", "FilterSsaoFullRes", "FilterSsao"); 399 402 sCgAntiAliasingProgram = sm->CreateFragmentProgram("antialiasing", "main", "AntiAliasing"); 400 403 sCgToneProgram = sm->CreateFragmentProgram("tonemap", "ToneMap", "ToneMap"); … … 454 457 sCgCombineSsaoProgram->AddParameters(combineSsaoParams, 0, 7); 455 458 459 460 //////////////// 461 462 string filterSsaoParams[] = 463 {"colorsTex", "ssaoTex", "bl", "br", "tl", "tr", "xyStep"}; 464 465 sCgFilterSsaoProgram->AddParameters(filterSsaoParams, 0, 7); 466 456 467 457 468 ////////////// … … 572 583 case SSAO: 573 584 ComputeSsao(fbo, mTempCohFactor); 585 FilterSsao(fbo); 574 586 CombineSsao(fbo); 575 587 break; … … 1027 1039 1028 1040 1029 void DeferredRenderer:: CombineSsao(FrameBufferObject *fbo)1041 void DeferredRenderer::FilterSsao(FrameBufferObject *fbo) 1030 1042 { 1031 1043 GLuint colorsTex = fbo->GetColorBuffer(colorBufferIdx)->GetTexture(); 1032 1044 GLuint normalsTex = fbo->GetColorBuffer(1)->GetTexture(); 1033 1045 GLuint ssaoTex = mIllumFbo->GetColorBuffer(mIllumFboIndex)->GetTexture(); 1046 1047 mIllumFbo->Bind(); 1048 glDrawBuffers(1, mrt + mIllumFboIndex + 1); 1049 1050 1051 int i = 0; 1052 1053 sCgFilterSsaoProgram->SetTexture(i ++, colorsTex); 1054 sCgFilterSsaoProgram->SetTexture(i ++, ssaoTex); 1055 1056 for (int j = 0; j < 4; ++ j, ++ i) 1057 { 1058 sCgFilterSsaoProgram->SetValue3f(i, mCornersView[j].x, mCornersView[j].y, mCornersView[j].z); 1059 } 1060 1061 sCgFilterSsaoProgram->SetValue2f(i ++, 1.0f / (float)mWidth, 0); 1062 1063 DrawQuad(sCgFilterSsaoProgram); 1064 1065 PrintGLerror("combine ssao"); 1066 } 1067 1068 1069 void DeferredRenderer::CombineSsao(FrameBufferObject *fbo) 1070 { 1071 GLuint colorsTex = fbo->GetColorBuffer(colorBufferIdx)->GetTexture(); 1072 GLuint normalsTex = fbo->GetColorBuffer(1)->GetTexture(); 1073 GLuint ssaoTex = mIllumFbo->GetColorBuffer(mIllumFboIndex + 1)->GetTexture(); 1034 1074 1035 1075 FlipFbos(fbo); … … 1053 1093 1054 1094 //sCgCombineSsaoProgram->SetValue2f(i ++, 1.0f / (float)mWidth, 1.0f / (float)mHeight); 1055 sCgCombineSsaoProgram->SetValue2f(i ++, 1.0f / (float)mWidth, 0); 1056 1057 DrawQuad(sCgCombineSsaoProgram); 1058 1059 PrintGLerror("combine ssao"); 1060 } 1061 1062 1063 void DeferredRenderer::CombineSsao2(FrameBufferObject *fbo) 1064 { 1065 GLuint colorsTex = fbo->GetColorBuffer(colorBufferIdx)->GetTexture(); 1066 GLuint normalsTex = fbo->GetColorBuffer(1)->GetTexture(); 1067 GLuint ssaoTex = mIllumFbo->GetColorBuffer(mIllumFboIndex)->GetTexture(); 1068 1069 FlipFbos(fbo); 1070 1071 int i = 0; 1072 1073 sCgCombineSsaoProgram->SetTexture(i ++, colorsTex); 1074 sCgCombineSsaoProgram->SetTexture(i ++, normalsTex); 1075 sCgCombineSsaoProgram->SetTexture(i ++, ssaoTex); 1076 1077 sCgCombineSsaoProgram->SetArray2f(i ++, (float *)ssaoFilterOffsets, NUM_SSAO_FILTER_SAMPLES); 1078 sCgCombineSsaoProgram->SetArray1f(i ++, (float *)ssaoFilterWeights, NUM_SSAO_FILTER_SAMPLES); 1079 sCgCombineSsaoProgram->SetValue1f(i ++, mSsaoFilterRadius); 1080 1081 sCgCombineSsaoProgram->SetMatrix(i++, mProjViewMatrix); 1082 1083 for (int j = 0; j < 4; ++ j, ++ i) 1084 { 1085 sCgCombineSsaoProgram->SetValue3f(i, mCornersView[j].x, mCornersView[j].y, mCornersView[j].z); 1086 } 1087 1088 sCgCombineSsaoProgram->SetValue1f(i ++, mIllumFbo->GetColorBuffer(mIllumFboIndex)->GetWidth()); 1089 sCgCombineSsaoProgram->SetValue1f(i ++, mIllumFbo->GetColorBuffer(mIllumFboIndex)->GetHeight()); 1095 sCgCombineSsaoProgram->SetValue2f(i ++, 0, 1.0f / (float)mHeight); 1090 1096 1091 1097 DrawQuad(sCgCombineSsaoProgram); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.h
r3296 r3301 168 168 void DepthOfField(FrameBufferObject *fbo); 169 169 170 void CombineSsao2(FrameBufferObject *fbo);170 void FilterSsao(FrameBufferObject *fbo); 171 171 172 172 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg
r3299 r3301 184 184 185 185 /** Function combining image and indirect illumination buffer using a 186 depth and normal aware discontinuity filter. We assume that 187 we are using half resolution ssao for this version of the combineSsao 186 depth and normal aware discontinuity filter. 188 187 */ 189 188 pixel CombineSsaoFullRes(fragment IN,
Note: See TracChangeset
for help on using the changeset viewer.