Changeset 3079 for GTP


Ignore:
Timestamp:
10/29/08 18:21:41 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src
Files:
4 edited

Legend:

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

    r3068 r3079  
    732732        glDrawBuffers(1, mrt + colorBufferIdx); 
    733733 
    734         float filterOffsets[NUM_DOWNSAMPLES * 2]; 
    735         float filterWeights[NUM_DOWNSAMPLES]; 
    736  
    737         PoissonDiscSampleGenerator2 poisson(NUM_DOWNSAMPLES, 1.0f); 
     734        float filterOffsets[NUM_SSAO_FILTERSAMPLES * 2]; 
     735        float filterWeights[NUM_SSAO_FILTERSAMPLES]; 
     736 
     737        PoissonDiscSampleGenerator2 poisson(NUM_SSAO_FILTERSAMPLES, 1.0f); 
    738738        poisson.Generate((float *)filterOffsets); 
    739739 
    740         const float xoffs = 2.0f / fbo->GetWidth(); 
    741         const float yoffs = 2.0f / fbo->GetHeight(); 
    742  
    743         for (int i = 0; i < NUM_DOWNSAMPLES; ++ i) 
     740        const float filterWidth = 10.0f; 
     741        const float xoffs = filterWidth / fbo->GetWidth(); 
     742        const float yoffs = filterWidth / fbo->GetHeight(); 
     743 
     744        for (int i = 0; i < NUM_SSAO_FILTERSAMPLES; ++ i) 
    744745        { 
    745746                float x = filterOffsets[2 * i + 0]; 
     
    756757        sCgCombineSsaoProgram->SetTexture(1, ssaoTex); 
    757758 
    758         sCgCombineSsaoProgram->SetArray2f(2, (float *)filterOffsets, NUM_DOWNSAMPLES); 
    759         sCgCombineSsaoProgram->SetArray1f(3, (float *)filterWeights, NUM_DOWNSAMPLES); 
     759        sCgCombineSsaoProgram->SetArray2f(2, (float *)filterOffsets, NUM_SSAO_FILTERSAMPLES); 
     760        sCgCombineSsaoProgram->SetArray1f(3, (float *)filterWeights, NUM_SSAO_FILTERSAMPLES); 
    760761         
    761762        DrawQuad(sCgCombineSsaoProgram); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3078 r3079  
    458458        //-- load some dynamic stuff 
    459459 
    460         LoadModel("hbuddha.dem", dynamicObjects); 
     460        /*LoadModel("hbuddha.dem", dynamicObjects); 
    461461        buddha = dynamicObjects.back(); 
    462462         
     
    480480                ent->SetTransform(transform); 
    481481                dynamicObjects.push_back(ent); 
    482         } 
     482        }*/ 
    483483 
    484484 
     
    880880 
    881881        Matrix4x4 mat = TranslationMatrix(planepos); 
    882         buddha->GetTransform()->SetMatrix(mat); 
     882        //buddha->GetTransform()->SetMatrix(mat); 
    883883 
    884884        Vector3 oldPos = camera->GetPosition(); 
     
    942942 
    943943                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
    944  
    945944                glEnableClientState(GL_NORMAL_ARRAY); 
    946  
    947945                break; 
    948946 
     
    963961                // (should be handled by render state) 
    964962                glShadeModel(GL_FLAT); 
    965  
    966  
    967963                break; 
    968964 
     
    978974                // (should be handled by render state) 
    979975                glShadeModel(GL_FLAT); 
    980                  
    981  
    982976                break; 
    983977         
     
    994988                glEnableClientState(GL_NORMAL_ARRAY); 
    995989                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
    996  
    997990                break; 
    998991        } 
     
    10191012        } 
    10201013        else 
    1021         {glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
     1014        { 
    10221015                // actually render the scene geometry using the specified algorithm 
    10231016                traverser->RenderScene(); 
    1024                 //for (int i = 0; i < sceneEntities.size(); ++ i) 
    1025                 //      sceneEntities[i]->Render(&state); 
    10261017        } 
    10271018 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h

    r3017 r3079  
    1010 
    1111// for quadratic falloff 
    12 #define SAMPLE_INTENSITY 0.1f 
    13 //#define SAMPLE_INTENSITY 0.2f 
     12//#define SAMPLE_INTENSITY 0.1f 
     13#define SAMPLE_INTENSITY 0.07f 
    1414 
    1515#define SAMPLE_RADIUS 8e-1f 
     
    4444#define WHITE_LUMINANCE 3e4f 
    4545 
     46 
    4647/////////////////// 
    4748 
    4849#define NUM_DOWNSAMPLES 16 
    4950 
     51#define NUM_SSAO_FILTERSAMPLES 100 
    5052 
    5153#endif // __SHADERENV_H 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3034 r3079  
    236236float Filter(float2 texCoord,  
    237237                         uniform sampler2D ssaoTex, 
    238                          uniform float2 filterOffs[NUM_DOWNSAMPLES], 
    239                          uniform float filterWeights[NUM_DOWNSAMPLES] 
     238                         uniform float2 filterOffs[NUM_SSAO_FILTERSAMPLES], 
     239                         uniform float filterWeights[NUM_SSAO_FILTERSAMPLES] 
    240240) 
    241241{ 
     
    243243        float w = .0f; 
    244244 
    245         for (int i = 0; i < NUM_DOWNSAMPLES; ++ i) 
     245        for (int i = 0; i < NUM_SSAO_FILTERSAMPLES; ++ i) 
    246246        { 
    247247                average += filterWeights[i] * tex2Dlod(ssaoTex, float4(texCoord + filterOffs[i], 0, 0)).x; 
     
    258258                          uniform sampler2D colors, 
    259259                          uniform sampler2D ssaoTex, 
    260                           uniform float2 filterOffs[NUM_DOWNSAMPLES], 
    261                           uniform float filterWeights[NUM_DOWNSAMPLES] 
     260                          uniform float2 filterOffs[NUM_SSAO_FILTERSAMPLES], 
     261                          uniform float filterWeights[NUM_SSAO_FILTERSAMPLES] 
    262262                          ) 
    263263{ 
     
    267267        float3 ao = tex2Dlod(ssaoTex, float4(IN.texCoord, 0, 0)); 
    268268 
    269         //if (ao.y < 2000.0f)  
    270         //      ao.x = Filter(IN.texCoord, ssaoTex, filterOffs, filterWeights); 
     269        if (ao.y < 10.0f)  
     270                ao.x = Filter(IN.texCoord, ssaoTex, filterOffs, filterWeights); 
    271271 
    272272        OUT.illum_col = col * ao.x; 
Note: See TracChangeset for help on using the changeset viewer.