- Timestamp:
- 11/09/08 13:34:36 (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
r3110 r3111 253 253 mSamplingMethod(SAMPLING_POISSON), 254 254 mShadingMethod(DEFAULT), 255 mIllumFboIndex(0) 255 mIllumFboIndex(0), 256 invTrafo(IdentityMatrix()) 256 257 { 257 258 /////////// … … 337 338 string ssaoParams[] = 338 339 {"colors", "normals", "oldTex", "noiseTex", "temporalCoherence", 339 "samples", "bl", "br", "tl", "tr", "modelViewProj", "oldModelViewProj", 340 "oldEyePos", "oldbl", "oldbr", "oldtl", "oldtr", "attribsTex", "inverseModelTrafo"}; 340 "samples", "bl", "br", "tl", "tr", 341 "modelViewProj", "oldModelViewProj", "oldEyePos", "oldbl", "oldbr", 342 "oldtl", "oldtr", "attribsTex", "inverseModelTrafo"}; 341 343 sCgSsaoProgram->AddParameters(ssaoParams, 0, 19); 342 344 343 345 string giParams[] = 344 346 {"colors", "normals", "noiseTex", "oldSsaoTex", "oldIllumTex", 345 "temporalCoherence", "samples", "bl", "br", "tl", "tr", "oldModelViewProj", "modelViewProj"}; 347 "temporalCoherence", "samples", "bl", "br", "tl", 348 "tr", "oldModelViewProj", "modelViewProj"}; 346 349 sCgGiProgram->AddParameters(giParams, 0, 13); 347 350 … … 562 565 sCgSsaoProgram->SetTexture(i ++, attribsTex); 563 566 564 sCgSsaoProgram->SetMatrix(i ++, IdentityMatrix()); 567 sCgSsaoProgram->SetMatrix(i ++, invTrafo); 568 //sCgSsaoProgram->SetMatrix(i ++, IdentityMatrix()); 565 569 566 570 DrawQuad(sCgSsaoProgram); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.h
r3085 r3111 60 60 static int colorBufferIdx; 61 61 62 Matrix4x4 invTrafo; 62 63 63 64 protected: -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3110 r3111 212 212 static int sCurrentMrtSet = 0; 213 213 214 static Matrix4x4 invTrafo = IdentityMatrix(); 215 214 216 215 217 ////////////// … … 234 236 ShadowMap *shadowMap = NULL; 235 237 DirectionalLight *light = NULL; 236 DeferredRenderer * ssaoShader = NULL;238 DeferredRenderer *deferredShader = NULL; 237 239 238 240 //SceneEntity *cube = NULL; … … 462 464 463 465 LoadModel("hbuddha.dem", dynamicObjects); 464 //LoadModel("hbuddha2.dem", dynamicObjects);465 466 buddha = dynamicObjects.back(); 466 467 … … 528 529 dynamicObjects[i]->mId = 0; 529 530 530 buddha->mId = 50;531 buddha->mId = 250; 531 532 532 533 … … 897 898 void MainLoop() 898 899 { 899 Vector3 oldPos = motionPath->GetCurrentPosition(); 900 901 //motionPath->Move(0.3f); 902 motionPath->Move(0.01f); 903 904 nMatrix mat = 905 Vector3 planepos = motionPath->GetCurrentPosition(); 906 907 Matrix4x4 mat = TranslationMatrix(planepos); 908 buddha->GetTransform()->SetMatrix(mat); 900 static Matrix4x4 invTrafo = IdentityMatrix(); 901 902 Vector3 buddhaPos = motionPath->GetCurrentPosition(); 903 Matrix4x4 trafo = TranslationMatrix(buddhaPos); 904 buddha->GetTransform()->SetMatrix(trafo); 905 906 ///////////// 909 907 910 908 Vector3 oldPos = camera->GetPosition(); … … 1070 1068 FrameBufferObject::Release(); 1071 1069 1072 if (! ssaoShader) ssaoShader =1070 if (!deferredShader) deferredShader = 1073 1071 new DeferredRenderer(texWidth, texHeight, camera); 1074 1072 … … 1085 1083 shadingMethod = DeferredRenderer::DEFAULT; 1086 1084 1087 1088 ssaoShader->SetShadingMethod(shadingMethod);1089 ssaoShader->SetSamplingMethod(samplingMethod);1090 ssaoShader->SetUseTemporalCoherence(useTemporalCoherence);1085 deferredShader->invTrafo = invTrafo; 1086 deferredShader->SetShadingMethod(shadingMethod); 1087 deferredShader->SetSamplingMethod(samplingMethod); 1088 deferredShader->SetUseTemporalCoherence(useTemporalCoherence); 1091 1089 1092 1090 ShadowMap *sm = showShadowMap ? shadowMap : NULL; 1093 ssaoShader->Render(fbo, ssaoTempCohFactor, light, useHDR, sm);1091 deferredShader->Render(fbo, ssaoTempCohFactor, light, useHDR, sm); 1094 1092 } 1095 1093 … … 1130 1128 1131 1129 glutSwapBuffers(); 1130 1131 1132 ///////////////////////// 1133 1134 //motionPath->Move(0.3f); 1135 motionPath->Move(0.01f); 1136 Vector3 oldBuddhaPos = buddhaPos; 1137 // new position 1138 buddhaPos = motionPath->GetCurrentPosition(); 1139 1140 Vector3 diff = oldBuddhaPos - buddhaPos; 1141 //Vector3 diff = buddhaPos - oldBuddhaPos; 1142 1143 invTrafo = TranslationMatrix(diff); 1144 //cout<< "diff " << diff << endl; 1132 1145 } 1133 1146 … … 1704 1717 DEL_PTR(perfGraph); 1705 1718 DEL_PTR(fbo); 1706 DEL_PTR( ssaoShader);1719 DEL_PTR(deferredShader); 1707 1720 DEL_PTR(light); 1708 1721 DEL_PTR(visCamera); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3110 r3111 145 145 float4 illum_col; 146 146 147 147 148 //////////// 148 149 //-- dynamic objects 149 150 150 float4x4 trafo; 151 152 if (id < 10) 153 trafo = oldModelViewProj; 154 else 155 trafo = inverseModelTrafo * oldModelViewProj; 151 //float4x4 trafo = (id < 10.0f) ? oldModelViewProj : mul(oldModelViewProj, inverseModelTrafo); 152 float4x4 trafo = mul(oldModelViewProj, inverseModelTrafo); 156 153 157 154 // compute translational portion 158 155 const float3 translatedPt = worldPos.xyz - oldEyePos; 156 159 157 160 158 ///////////////// … … 167 165 // fit from unit cube into 0 .. 1 168 166 const float2 oldTexCoords = backProjPos.xy * 0.5f + 0.5f; 169 170 167 // retrieve the sample from the last frame 171 168 const float4 oldPixel = tex2Dlod(oldTex, float4(oldTexCoords, .0f, .0f)); … … 173 170 174 171 #if USE_EYESPACE_DEPTH 172 175 173 // calculate eye space position of sample in old frame 176 174 const float oldEyeSpaceDepth = oldPixel.w;
Note: See TracChangeset
for help on using the changeset viewer.