Ignore:
Timestamp:
12/01/08 18:38:36 (16 years ago)
Author:
mattausch
Message:

only adapting filter size left ...

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

Legend:

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

    r3202 r3203  
    548548        else 
    549549        { 
    550                 BvhNodeContainer::const_iterator nit, nit_end = nodes.end(); 
    551  
    552                 /*for (nit = nodes.begin(); nit != nit_end; ++ nit) 
    553                 { 
    554                         BvhNode *node = *nit; 
    555  
    556                         for (int i = 0; i < node->mNumTestNodes; ++ i) 
    557                         { 
    558                                 RenderBoundingBoxImmediate(mTestNodes[node->mTestNodesIdx + i]->GetBox()); 
    559                         } 
    560                 }*/ 
    561  
    562550                renderedBoxes = PrepareBoundsWithDrawArrays(nodes); 
    563551                RenderBoundsWithDrawArrays(renderedBoxes, state); 
     
    13151303        else 
    13161304        { 
    1317                 glPolygonMode(GL_FRONT, GL_LINE); 
    1318                 BvhNodeContainer nodes; 
    1319                 nodes.push_back(node); 
    1320                 int renderedBoxes = PrepareBoundsWithDrawArrays(nodes); 
    1321                 RenderBoundsWithDrawArrays(renderedBoxes, state); 
    1322                 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 
    1323  
    1324                 /*for (int i = 0; i < node->mNumTestNodes; ++ i) 
     1305                for (int i = 0; i < node->mNumTestNodes; ++ i) 
    13251306                { 
    13261307                        RenderBoxForViz(mTestNodes[node->mTestNodesIdx + i]->GetBox()); 
    1327                 }*/ 
     1308                } 
    13281309        } 
    13291310 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3197 r3203  
    479479        //-- load some dynamic stuff 
    480480 
    481         resourceManager->mUseNormalMapping = true; 
     481        //resourceManager->mUseNormalMapping = true; 
    482482        //resourceManager->mUseNormalMapping = false; 
    483483 
    484         LoadModel("fisch.dem", dynamicObjects); 
    485         //LoadModel("hbuddha.dem", dynamicObjects); 
     484        //LoadModel("fisch.dem", dynamicObjects); 
     485        LoadModel("hbuddha.dem", dynamicObjects); 
    486486        //LoadModel("venusm.dem", dynamicObjects); 
    487487        //LoadModel("camel.dem", dynamicObjects); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h

    r3202 r3203  
    77 
    88//#define NUM_SAMPLES 8 
    9 #define NUM_SAMPLES 16 
    10 //#define NUM_SAMPLES 24 
     9//#define NUM_SAMPLES 16 
     10#define NUM_SAMPLES 96 
    1111 
    12 //#define SAMPLE_INTENSITY 0.1f 
    13 #define SAMPLE_INTENSITY 2.0f 
     12#define SAMPLE_INTENSITY 0.3f 
     13//#define SAMPLE_INTENSITY 2.0f 
    1414 
    1515#define SAMPLE_RADIUS 8e-1f 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg

    r3198 r3203  
    194194        const float m2 = min(texelCenterConv.z, texelCenterConv.w); 
    195195 
    196         const float convergence = min(m1, m2); 
     196        const float minConvergence = min(m1, m2); 
     197 
     198        const float convergence = step(200.0f, minConvergence) * minConvergence; 
    197199        //const float convergence = ao.y; 
    198200 
     
    205207                const float distanceScale = 1.0f; 
    206208 
     209                // descend to zero filter size after reaching thres pixels 
    207210                const float convergenceWeight = thres / (SSAO_FILTER_WIDTH - 1.0f); 
    208211                const float convergenceScale = convergenceWeight / (convergence + convergenceWeight); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3199 r3203  
    174174        float total_ao = .0f; 
    175175        float numSamples = .0f; 
     176        float validSamples = .0f; 
    176177 
    177178        for (int i = 0; i < NUM_SAMPLES; ++ i)  
     
    233234#endif 
    234235                // check if the samples have been valid in the last frame 
    235                 //numSamples += (1.0f - step(1.0f, lengthToSample)) * sampleColor.x; 
     236                validSamples += (1.0f - step(1.0f, lengthToSample)) * sampleColor.x; 
     237 
    236238                ++ numSamples; 
    237239        } 
     
    239241        total_ao /= numSamples; 
    240242 
    241         return float3(max(0.0f, 1.0f - total_ao), .0f, numSamples); 
     243        return float3(max(0.0f, 1.0f - total_ao), validSamples, numSamples); 
    242244} 
    243245 
     
    287289                const float2 texcoord = IN.texCoord.xy + offsetTransformed * scaleFactor; 
    288290 
    289                 const float4 sampleColor = tex2Dlod(colors, float4(texcoord, 0, 0)); 
     291                const float4 sampleColor = tex2Dlod(colors, float4(texcoord, .0f, .0f)); 
    290292                const float3 samplePos = ReconstructSamplePos(sampleColor.w, texcoord, bl, br, tl, tr); 
    291293                 
     
    303305                // angle between current normal and direction to sample controls AO intensity. 
    304306                const float cosAngle = max(dot(dirSample, normal), .0f); 
    305          
    306                 // the distance_scale offset is used to avoid singularity that occurs at global illumination when  
    307                 // the distance to a sample approaches zero 
    308                 //const float aoContrib = SAMPLE_INTENSITY / (DISTANCE_SCALE + lengthToSample * lengthToSample); 
    309307                const float aoContrib = SAMPLE_INTENSITY / sqrLen; 
    310308                //const float aoContrib = (1.0f > lengthToSample) ? occlusionPower(9e-2f, DISTANCE_SCALE + lengthToSample): .0f; 
     
    321319 
    322320                // check if the samples have been valid in the last frame 
    323                 validSamples += (1.0f - step(1.0f, lengthToSample)) * sampleColor.x; 
     321                // hack: the distance measure can fail in some cases => choose something different 
     322                const float tooFarAway = step(1.0f, lengthToSample); 
     323                validSamples += (1.0f - tooFarAway) * sampleColor.x; 
    324324                //validSamples += sampleColor.x; 
    325325 
    326326                ++ numSamples; 
    327                 //if ((validSamples < 1.0f) && (newWeight > 20) && (numSamples >= 8)) break; 
     327 
     328                //if ((validSamples < 1.0f) && (newWeight > 200) && (numSamples >= 8)) break; 
     329                if ((validSamples < 1.0f) && (numSamples >= 8)) break; 
    328330        } 
    329331 
     
    401403        if (eyeSpaceDepth < 1e10f) 
    402404        { 
    403                 //ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight); 
    404                 ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), normals); 
     405                ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight); 
     406                //ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), normals); 
    405407        } 
    406408        else 
Note: See TracChangeset for help on using the changeset viewer.