Changeset 3125


Ignore:
Timestamp:
11/13/08 13:14:55 (16 years ago)
Author:
mattausch
Message:

changed tm so no values out of bounds, somehow occlusion error missing again

Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.cpp

    r3124 r3125  
    201201                mGeometry[mStaticGeometrySize + i] = dynamicEntities[i]; 
    202202        } 
     203 
     204        cout << "max depth for testing children" << mMaxDepthForTestingChildren << endl; 
    203205} 
    204206 
     
    227229 
    228230        mMaxDepthForTestingChildren = maxDepthForTestingChildren; 
     231        cout << "max depth for testing children" << mMaxDepthForTestingChildren << endl; 
    229232} 
    230233 
     
    592595        return numNodes; 
    593596} 
    594  
    595 #if TODO 
    596 void Bvh::RenderBoundsImmediate(const BvhNodeContainer &nodes, RenderState *state) 
    597 { 
    598         ///////// 
    599         //-- Render the tight bounds in immediate mode 
    600         BvhNodeContainer::const_iterator nit, nit_end = nodes.end(); 
    601  
    602         for (nit = nodes.begin(); nit != nit_end; ++ nit) 
    603         { 
    604                 BvhNode *node = *nit; 
    605  
    606                 for (int size_t i = 0; i < node->mNumTestNodes; ++ i) 
    607                 { 
    608                         BvhNode *testNode = node->mTestNodesIdx 
    609                         RenderBoundingBoxImmediate((*nit)->GetBox()); 
    610                 } 
    611         } 
    612 } 
    613 #endif 
    614597 
    615598 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3123 r3125  
    472472 
    473473        //LoadModel("fisch.dem", dynamicObjects); 
    474         /*LoadModel("hbuddha.dem", dynamicObjects); 
     474        LoadModel("hbuddha.dem", dynamicObjects); 
    475475        buddha = dynamicObjects.back(); 
    476476         
     
    497497                ent->SetTransform(transform); 
    498498                dynamicObjects.push_back(ent); 
    499         }*/ 
     499        } 
    500500 
    501501 
     
    913913void MainLoop()  
    914914{        
    915 #if 0 
     915#if 1 
    916916        GPUProgramParameters *vtxParams =  
    917917                buddha->GetShape(0)->GetMaterial()->GetTechnique(1)->GetVertexProgramParameters(); 
     
    930930                if (GetOrCreateSceneQuery()->CalcIntersection(newPos)) 
    931931                { 
    932                         Matrix4x4 mat = TranslationMatrix(newPos - ent->GetCenter());// + Vector3(0, 0, ent->GetBoundingBox().Size(2) * 0.5f)); 
     932                        Matrix4x4 mat = TranslationMatrix(newPos - ent->GetCenter()); 
    933933                        ent->GetTransform()->SetMatrix(mat); 
    934934                } 
     
    937937        Matrix4x4 rotMatrix = RotationZMatrix(M_PI * 1e-3f); 
    938938        dynamicObjects[1]->GetTransform()->MultMatrix(rotMatrix); 
     939 
     940 
     941        ///////////////////////// 
     942        //-- update animations 
     943         
     944        motionPath->Move(0.01f); 
     945 
    939946#endif 
    940947 
     
    11641171 
    11651172        glutSwapBuffers(); 
    1166  
    1167  
    1168         ///////////////////////// 
    1169         //-- update animations 
    1170         motionPath->Move(0.01f); 
    11711173} 
    11721174 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3123 r3125  
    174174        // calculate eye space position of sample in old frame 
    175175        const float oldDepth = oldPixel.w; 
     176        // the depth projected into the old frame 
    176177        const float projectedDepth = projPos.z; 
    177         // vector from eye pos to old sample  
     178        // calculate depth difference  
    178179        const float depthDif = abs(projectedDepth - oldDepth); 
    179180 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/tonemap.cg

    r3103 r3125  
    1919}; 
    2020 
    21  
    22 /*float4 DownSample(frag IN, 
    23                                   uniform sampler2D colors, 
    24                                   uniform float2 downSampleOffs[9]): COLOR 
    25 {     
    26     float4 average = .0f; 
    27  
    28         const float4 avgColor = tex2Dlod(colors, float4(IN.texCoord, 0, 0)); 
    29  
    30         float j = 0; 
    31         float4 color; 
    32  
    33     for (int i = 0; i < 9; ++ i) 
    34     { 
    35                 color = tex2Dlod(colors, float4(IN.texCoord + downSampleOffs[i], 0, 0)); 
    36                 if (abs(color.w - avgColor.w) < 1e-3f) 
    37                 { 
    38                         average += color; 
    39                         ++ j; 
    40                 } 
    41     } 
    42          
    43     //average *= 1.0f / 9.0f; 
    44     average *= 1.0f / j; 
    45  
    46     return average; 
    47 }*/ 
    4821  
    4922 
    50 // let bilinear filtering do its work 
    5123float4 DownSample(frag IN, 
    5224                                  uniform sampler2D colors, 
    5325                                  uniform float2 downSampleOffs[NUM_DOWNSAMPLES]): COLOR 
    5426{     
     27        // let bilinear filtering do its work 
    5528        return tex2Dlod(colors, float4(IN.texCoord, 0, 0)); 
    5629/* 
     
    7144        intensity. 
    7245*/ 
    73  
    7446float4 GreyScaleDownSample(frag IN, 
    7547                                                   uniform sampler2D colors, 
     
    148120        float logLum = logLumScaled * LOGLUM_RANGE + MINLOGLUM; 
    149121 
    150         float newImageKey = exp(logLum); 
     122        float newImageKey = max(exp(logLum), 1e-6f); 
    151123 
    152124        // adjust to middle gray 
     
    184156        float logLumScaled = logLum * INV_LOGLUM_RANGE - logLumOffset; 
    185157 
     158        const float expFactor = 0.1f; 
    186159        // exponential smoothing of tone mapping over time 
    187         if (oldLogLum > 1e-5f) // loglum from last frame too bright 
    188                 OUT.col.w = lerp(oldLogLum, logLumScaled, 0.1f); 
     160        if (oldLogLum > 1e-5f) // check if loglum from last frame too small (=> tm too bright) 
     161                OUT.col.w = lerp(oldLogLum, logLumScaled, expFactor); 
    189162        else 
    190163                OUT.col.w = logLumScaled; 
Note: See TracChangeset for help on using the changeset viewer.