Changeset 3106 for GTP


Ignore:
Timestamp:
11/06/08 16:38:05 (16 years ago)
Author:
mattausch
Message:

reprojection working much better using 1 - eyespacedepth / oldEyeSpaceDepth

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  
    963963        mOldProjViewMatrix = mProjViewMatrix; 
    964964        mOldEyePos = mEyePos; 
    965  
    966  
    967         /////////////////// 
    968  
    969         Matrix4x4 matViewing, matProjection; 
     965        mEyePos = mCamera->GetPosition(); 
    970966 
    971967        // hack: temporarily change far to improve precision 
    972968        const float oldFar = mCamera->GetFar(); 
    973         mCamera->SetFar(1e3f); 
     969        const float oldNear = mCamera->GetNear(); 
     970        //mCamera->SetFar(1e3f); 
     971        //mCamera->SetNear(3.0f); 
    974972        //mCamera->SetFar(1e2f); 
    975973 
    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 
    978987        mCamera->GetViewOrientationMatrix(matViewing); 
    979988        mCamera->GetProjectionMatrix(matProjection); 
     
    981990        mProjViewMatrix = matViewing * matProjection; 
    982991        ComputeViewVectors(mCamera, mCornersView[0], mCornersView[1], mCornersView[2], mCornersView[3]); 
    983         mEyePos = mCamera->GetPosition(); 
    984  
     992         
    985993 
    986994        // switch roles of old and new fbo 
     
    10181026        // revert to old far plane 
    10191027        mCamera->SetFar(oldFar); 
     1028        mCamera->SetNear(oldNear); 
    10201029} 
    10211030 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3105 r3106  
    9292/// eye near plane distance 
    9393const float nearDist = 0.2f; 
     94//const float nearDist = 1.0f; 
    9495/// eye far plane distance 
    9596float farDist = 1e6f; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h

    r3105 r3106  
    4343#define MAX_LOD_LEVEL 10 
    4444 
    45 #define MIN_DEPTH_DIFF 1e-3f 
     45//#define MIN_DEPTH_DIFF 5e-3f 
     46#define MIN_DEPTH_DIFF 1e-2f 
    4647//#define MIN_DEPTH_DIFF 1e-3f 
    4748#define PRECISION_SCALE 1e-1f 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3105 r3106  
    55// based on shader of Alexander Kusternig 
    66 
    7 #define USE_EYESPACE_DEPTH 0 
     7#define USE_EYESPACE_DEPTH 1 
    88 
    99 
     
    137137                                                                uniform float3 oldtl, 
    138138                                                                uniform  float3 oldtr, 
    139                                                                 float invW 
     139                                                                float invW, 
     140                                                                float3 projPos 
    140141                                                                //,const uniform float4x4 inverseModelTrafo 
    141142                                                                //, float id 
     
    152153        //else trafo = inverseModelTrafo * oldModelViewProj; 
    153154 
    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); 
    156155        const float3 translatedPt = worldPos.xyz - oldEyePos; 
    157156 
     
    175174        const float projectedEyeSpaceDepth = length(translatedPt) * invlen; 
    176175         
    177         const float depthDif = abs(oldEyeSpaceDepth - projectedEyeSpaceDepth); 
     176        //const float depthDif = abs(oldEyeSpaceDepth - projectedEyeSpaceDepth); 
    178177        //const float depthDif = abs(oldEyeSpaceDepth - projectedEyeSpaceDepth) / projectedEyeSpaceDepth; 
     178        const float depthDif = abs(1.0f - oldEyeSpaceDepth / projectedEyeSpaceDepth); 
     179 
    179180#else 
    180181        // calculate eye space position of sample in old frame 
    181182        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; 
    185185 
    186186        // vector from eye pos to old sample  
    187187        const float depthDif = abs(projectedDepth - oldDepth); 
    188         //const float depthDif = abs(oldEyeSpaceDepth - projectedEyeSpaceDepth) / projectedEyeSpaceDepth; 
    189188#endif 
    190189 
     
    243242#else 
    244243        illum_col.w = projectedDepth; 
     244#endif 
     245 
    245246        illum_col.z = invW; 
    246 #endif 
    247          
    248247        //illum_col.y = depthDif; 
    249248 
     
    364363        float4 projPos = mul(modelViewProj, eyeSpacePos); 
    365364        const float w = 1 / projPos.w; 
     365        projPos *= w; 
    366366        float scaleFactor = SAMPLE_RADIUS * w; 
    367367         
     
    376376                                              oldTex, oldModelViewProj, temporalCoherence, 
    377377                                              samples, colors, noiseTex, w, bl, br, tl, tr, 
    378                                                                           oldbl, oldbr, oldtl, oldtr, scaleFactor); 
     378                                                                          oldbl, oldbr, oldtl, oldtr, scaleFactor, projPos); 
    379379 
    380380        //OUT.illum_col.xyz = normal * 0.5f + 0.5f; 
     
    415415        float4 ao = tex2Dlod(ssaoTex, float4(IN.texCoord, 0, 0)); 
    416416 
    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); 
    419419 
    420420        OUT.illum_col = col * ao.x; 
    421421        //OUT.illum_col = float4(ao.y, ao.y, ao.y, col.w); 
    422422        //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); 
    424424        //OUT.illum_col.xyz = float3(1.0f - ao.x, ao.y, 0); 
    425425        OUT.illum_col.w = col.w; 
Note: See TracChangeset for help on using the changeset viewer.