Changeset 3106 for GTP/trunk/App/Demos/Vis
- Timestamp:
- 11/06/08 16:38:05 (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
r3105 r3106 963 963 mOldProjViewMatrix = mProjViewMatrix; 964 964 mOldEyePos = mEyePos; 965 966 967 /////////////////// 968 969 Matrix4x4 matViewing, matProjection; 965 mEyePos = mCamera->GetPosition(); 970 966 971 967 // hack: temporarily change far to improve precision 972 968 const float oldFar = mCamera->GetFar(); 973 mCamera->SetFar(1e3f); 969 const float oldNear = mCamera->GetNear(); 970 //mCamera->SetFar(1e3f); 971 //mCamera->SetNear(3.0f); 974 972 //mCamera->SetFar(1e2f); 975 973 976 977 //mCamera->GetModelViewMatrix(matViewing); 974 Matrix4x4 matViewing, matProjection; 975 /* 976 mCamera->SetPosition(mOldEyePos - mEyePos); 977 978 mCamera->GetModelViewMatrix(matViewing); 979 mCamera->GetProjectionMatrix(matProjection); 980 981 mOldProjViewMatrix = matViewing * matProjection; 982 mCamera->SetPosition(mEyePos);*/ 983 984 /////////////////// 985 986 978 987 mCamera->GetViewOrientationMatrix(matViewing); 979 988 mCamera->GetProjectionMatrix(matProjection); … … 981 990 mProjViewMatrix = matViewing * matProjection; 982 991 ComputeViewVectors(mCamera, mCornersView[0], mCornersView[1], mCornersView[2], mCornersView[3]); 983 mEyePos = mCamera->GetPosition(); 984 992 985 993 986 994 // switch roles of old and new fbo … … 1018 1026 // revert to old far plane 1019 1027 mCamera->SetFar(oldFar); 1028 mCamera->SetNear(oldNear); 1020 1029 } 1021 1030 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3105 r3106 92 92 /// eye near plane distance 93 93 const float nearDist = 0.2f; 94 //const float nearDist = 1.0f; 94 95 /// eye far plane distance 95 96 float farDist = 1e6f; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3105 r3106 43 43 #define MAX_LOD_LEVEL 10 44 44 45 #define MIN_DEPTH_DIFF 1e-3f 45 //#define MIN_DEPTH_DIFF 5e-3f 46 #define MIN_DEPTH_DIFF 1e-2f 46 47 //#define MIN_DEPTH_DIFF 1e-3f 47 48 #define PRECISION_SCALE 1e-1f -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3105 r3106 5 5 // based on shader of Alexander Kusternig 6 6 7 #define USE_EYESPACE_DEPTH 07 #define USE_EYESPACE_DEPTH 1 8 8 9 9 … … 137 137 uniform float3 oldtl, 138 138 uniform float3 oldtr, 139 float invW 139 float invW, 140 float3 projPos 140 141 //,const uniform float4x4 inverseModelTrafo 141 142 //, float id … … 152 153 //else trafo = inverseModelTrafo * oldModelViewProj; 153 154 154 //float3 translatedPt = float3(worldPos.xy - oldEyePos.xy, worldPos.z + oldEyePos.z);155 //float3 translatedPt = float3(worldPos.x - oldEyePos.x, worldPos.y - oldEyePos.y, worldPos.z - oldEyePos.z);156 155 const float3 translatedPt = worldPos.xyz - oldEyePos; 157 156 … … 175 174 const float projectedEyeSpaceDepth = length(translatedPt) * invlen; 176 175 177 const float depthDif = abs(oldEyeSpaceDepth - projectedEyeSpaceDepth);176 //const float depthDif = abs(oldEyeSpaceDepth - projectedEyeSpaceDepth); 178 177 //const float depthDif = abs(oldEyeSpaceDepth - projectedEyeSpaceDepth) / projectedEyeSpaceDepth; 178 const float depthDif = abs(1.0f - oldEyeSpaceDepth / projectedEyeSpaceDepth); 179 179 180 #else 180 181 // calculate eye space position of sample in old frame 181 182 const float oldDepth = oldPixel.w; 182 183 float3 projectedPos = worldPos.xyz * invW; 184 const float projectedDepth = worldPos.z; 183 const float projectedDepth = projPos.z; 184 //const float projectedDepth = invW * worldPos.z; 185 185 186 186 // vector from eye pos to old sample 187 187 const float depthDif = abs(projectedDepth - oldDepth); 188 //const float depthDif = abs(oldEyeSpaceDepth - projectedEyeSpaceDepth) / projectedEyeSpaceDepth;189 188 #endif 190 189 … … 243 242 #else 244 243 illum_col.w = projectedDepth; 244 #endif 245 245 246 illum_col.z = invW; 246 #endif247 248 247 //illum_col.y = depthDif; 249 248 … … 364 363 float4 projPos = mul(modelViewProj, eyeSpacePos); 365 364 const float w = 1 / projPos.w; 365 projPos *= w; 366 366 float scaleFactor = SAMPLE_RADIUS * w; 367 367 … … 376 376 oldTex, oldModelViewProj, temporalCoherence, 377 377 samples, colors, noiseTex, w, bl, br, tl, tr, 378 oldbl, oldbr, oldtl, oldtr, scaleFactor );378 oldbl, oldbr, oldtl, oldtr, scaleFactor, projPos); 379 379 380 380 //OUT.illum_col.xyz = normal * 0.5f + 0.5f; … … 415 415 float4 ao = tex2Dlod(ssaoTex, float4(IN.texCoord, 0, 0)); 416 416 417 if ((ao.y < 10.0f) && (col.w < 1e10f))418 ao.x = Filter(IN.texCoord, ssaoTex, filterOffs, filterWeights, 1.0f / (1.0f + ao.y));//ao.z);417 //if ((ao.y < 10.0f) && (col.w < 1e10f)) 418 // ao.x = Filter(IN.texCoord, ssaoTex, filterOffs, filterWeights, 1.0f / (1.0f + ao.y));//ao.z); 419 419 420 420 OUT.illum_col = col * ao.x; 421 421 //OUT.illum_col = float4(ao.y, ao.y, ao.y, col.w); 422 422 //OUT.illum_col = float4(ao.x, ao.x, ao.x, col.w); 423 OUT.illum_col.xyz = float3(1.0f - ao.x, 1.0f - ao.y * 1e-2f, 1);423 //OUT.illum_col.xyz = float3(1.0f - ao.x, 1.0f - ao.y * 1e-2f, 1); 424 424 //OUT.illum_col.xyz = float3(1.0f - ao.x, ao.y, 0); 425 425 OUT.illum_col.w = col.w;
Note: See TracChangeset
for help on using the changeset viewer.