Changeset 3247


Ignore:
Timestamp:
01/05/09 16:48:21 (15 years ago)
Author:
mattausch
Message:

worked on obj loader
played around with ssao sampling

Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.cpp

    r3246 r3247  
    154154void ObjConverter::LoadShape(const VertexArray &faceVertices, 
    155155                                                         const VertexArray &faceNormals, 
    156                                                          const vector<Texcoord> &faceTexcoords) 
     156                                                         const vector<Texcoord> &faceTexcoords, 
     157                                                         Material *mat) 
    157158{ 
    158159        int numElements = (int)faceVertices.size(); 
     
    167168        geom->mTexcoordCount = (int)faceTexcoords.size(); 
    168169 
    169         cout << "number of vertices=" << numElements << endl; 
     170        geom->mMaterial = mat; 
     171 
     172        cout << "new geometry #vts=" << numElements << endl; 
    170173 
    171174        for (int i = 0; i < numElements; ++ i) 
     
    244247        } 
    245248         
     249        Material *currentMat = NULL; 
    246250        VertexArray faceVertices;  
    247251        VertexArray faceNormals; 
     
    279283                                        sscanf(str + 1, "%f %f %f", &x, &y, &z); 
    280284                                        //const float scale = 5e-3f; 
    281                                         const float scale = 1.0f; 
     285                                        const float scale = 5.0f; 
    282286                                        vertices.push_back(SimpleVec(x * scale, y * scale, z* scale)); 
    283287                                        //cout <<"v " << x << " " << y << " "<< z << " "; 
     
    294298                                                faceVertices, faceNormals, faceTexcoords); 
    295299 
    296                                 if (0 && 
    297                                         (((line % 1000) == 999) && !faceVertices.empty())) 
     300                                break; 
     301                        }   // end face 
     302                case 'g': // load a new shape 
     303                        { 
     304                                if (!faceVertices.empty()) 
    298305                                { 
    299306                                        ++ mNumShapes; 
    300307 
    301                                         LoadShape(faceVertices, faceNormals, faceTexcoords); 
     308                                        LoadShape(faceVertices, faceNormals, faceTexcoords, currentMat); 
    302309 
    303310                                        faceVertices.clear(); 
    304311                                        faceNormals.clear(); 
    305312                                        faceTexcoords.clear(); 
     313 
     314                                        currentMat = NULL; 
    306315                                } 
    307  
    308                                 break; 
    309                         }   // end face 
    310                 case 'g': // load a new shape 
    311                         {/* 
    312                                 if (!faceVertices.empty()) 
    313                                 { 
    314                                         ++ mNumShapes; 
    315  
    316                                         LoadShape(faceVertices, faceNormals, faceTexcoords); 
    317  
    318                                         faceVertices.clear(); 
    319                                         faceNormals.clear(); 
    320                                         faceTexcoords.clear(); 
    321                                 }*/ 
    322                         } 
     316                        } 
     317                        break; 
     318                case 'u': // usemtl => material 
     319                        { 
     320                                string matName(str + 7); 
     321                                // throw away linebreak character 
     322                                matName.resize(matName.size() - 1); 
     323 
     324                                currentMat = mMaterialTable[matName]; 
     325                                cout << "matname: " << matName << endl; 
     326                        } 
     327 
    323328                        break; 
    324329                default: 
     
    334339                ++ mNumShapes; 
    335340 
    336                 LoadShape(faceVertices, faceNormals, faceTexcoords); 
     341                LoadShape(faceVertices, faceNormals, faceTexcoords, currentMat); 
    337342 
    338343                faceVertices.clear(); 
     
    364369        /////// 
    365370        //-- texture 
    366  
     371/* 
    367372#ifdef USE_TEXTURE 
    368373        int texId = 0; 
     
    401406                str.write(reinterpret_cast<char *>(&emm), sizeof(SimpleVec)); 
    402407        } 
    403 } 
    404  
    405  
     408*/ 
     409} 
     410 
     411#if 0 
    406412bool ObjConverter::WriteFile(const string &filename) 
    407413{ 
     
    481487        return true; 
    482488} 
     489#else 
     490bool ObjConverter::WriteFile(const string &filename) 
     491{ 
     492        ogzstream ofile(filename.c_str()); 
     493 
     494        if (!ofile.is_open()) 
     495                return false; 
     496         
     497 
     498        ///////// 
     499        //-- write textures 
     500 
     501        int textureCount = (int)mTextures.size(); 
     502 
     503        ofile.write(reinterpret_cast<char *>(&textureCount), sizeof(int)); 
     504 
     505        TextureArray::const_iterator tit, tit_end = mTextures.end(); 
     506         
     507        for (tit = mTextures.begin(); tit != tit_end; ++ tit) 
     508        { 
     509                const string texName = (*tit); 
     510 
     511                int texnameSize = (int)texName.length() + 1; 
     512                ofile.write(reinterpret_cast<char *>(&texnameSize), sizeof(int)); 
     513 
     514                ofile.write(texName.c_str(), sizeof(char) * texnameSize); 
     515 
     516                int boundS = 1, boundT = 1; 
     517 
     518                ofile.write(reinterpret_cast<char *>(&boundS), sizeof(int)); 
     519                ofile.write(reinterpret_cast<char *>(&boundT), sizeof(int)); 
     520        } 
     521 
     522 
     523        /////////// 
     524        //-- write shapes 
     525 
     526        ofile.write(reinterpret_cast<char *>(&mNumShapes), sizeof(int)); 
     527 
     528        vector<Geometry *>::const_iterator it, it_end = mGeometry.end(); 
     529 
     530        for (it = mGeometry.begin(); it != it_end; ++ it) 
     531        { 
     532                WriteGeometry(ofile, *it); 
     533 
     534                 
     535                ///////// 
     536                //-- material 
     537 
     538                Material *mat = (*it)->mMaterial; 
     539 
     540                ofile.write(reinterpret_cast<char *>(&mat->texture), sizeof(int)); 
     541 
     542                bool alphaTestEnabled = false; 
     543                //bool cullFaceEnabled = false; 
     544                bool cullFaceEnabled = true; 
     545                 
     546                ofile.write(reinterpret_cast<char *>(&alphaTestEnabled), sizeof(bool)); 
     547                ofile.write(reinterpret_cast<char *>(&cullFaceEnabled), sizeof(bool)); 
     548 
     549                // material 
     550                bool hasMaterial = true; 
     551                ofile.write(reinterpret_cast<char *>(&hasMaterial), sizeof(bool)); 
     552         
     553                SimpleVec ambient, diffuse, spec, emm; 
     554 
     555                ambient.x = ambient.y = ambient.z = 0.2f; 
     556                //diffuse.x = diffuse.y = diffuse.z = 1.0f; 
     557                diffuse.x = mat->rgb[0]; diffuse.y =mat->rgb[1]; diffuse.z = mat->rgb[2]; 
     558                spec.x = spec.y = spec.z = .0f; 
     559                emm = spec; 
     560 
     561                // only write rgb part of the material 
     562                ofile.write(reinterpret_cast<char *>(&ambient), sizeof(SimpleVec)); 
     563                ofile.write(reinterpret_cast<char *>(&diffuse), sizeof(SimpleVec)); 
     564                ofile.write(reinterpret_cast<char *>(&spec), sizeof(SimpleVec)); 
     565                ofile.write(reinterpret_cast<char *>(&emm), sizeof(SimpleVec)); 
     566        } 
     567 
     568 
     569        int entityCount = 1; 
     570        ofile.write(reinterpret_cast<char *>(&entityCount), sizeof(int)); 
     571 
     572 
     573        ////////// 
     574        //-- write single scene entity 
     575 
     576        // no transformation 
     577        bool hasTrafo = false; 
     578        ofile.write(reinterpret_cast<char *>(&hasTrafo), sizeof(bool)); 
     579 
     580        // a dummy lod 
     581        int numLODs = 1; 
     582        ofile.write(reinterpret_cast<char *>(&numLODs), sizeof(int)); 
     583 
     584        float dist = 0; 
     585        ofile.write(reinterpret_cast<char *>(&dist), sizeof(float)); 
     586 
     587        ofile.write(reinterpret_cast<char *>(&mNumShapes), sizeof(int)); 
     588 
     589        // all shapes belong to this scene entity 
     590        for (int i = 0; i < mNumShapes; ++ i) 
     591        { 
     592                int shapeId = i; 
     593                ofile.write(reinterpret_cast<char *>(&shapeId), sizeof(int)); 
     594        } 
     595 
     596        return true; 
     597} 
     598#endif 
     599 
     600 
     601bool ObjConverter::LoadMaterials(const std::string &matFileName) 
     602{ 
     603        FILE *file; 
     604 
     605        if ((file = fopen(matFileName.c_str(), "r")) == NULL) 
     606        {        
     607                return false; 
     608        } 
     609         
     610        int line = 0; 
     611        const int len = 10000; 
     612        char str[len]; 
     613 
     614        Material *currentMat = NULL; 
     615 
     616 
     617        while (fgets(str, len, file) != NULL) 
     618        { 
     619                //sscanf(str + 1, "%f %f %f", &x, &y, &z); 
     620                vector<string> strings; 
     621 
     622                char *next_token; 
     623 
     624                // extract the triples of the form v/t/n v/t/n ... 
     625                char *pch = strtok_s(str, " \n", &next_token); 
     626 
     627                while (pch) 
     628                { 
     629                        string s(pch); 
     630                        //s += "\n", 
     631                        strings.push_back(s); 
     632 
     633                        pch = strtok_s(NULL, " \n", &next_token);         
     634                } 
     635 
     636                cout << endl; 
     637 
     638                 
     639                if ((strings.size() == 2) && (strcmp(strings[0].c_str(),"newmtl") == 0)) 
     640                { 
     641                        currentMat = new Material(); 
     642                        mMaterialTable[strings[1].c_str()] = currentMat; 
     643                } 
     644 
     645                if ((strings.size() == 2) && (strcmp(strings[0].c_str(),"map_Kd") == 0)) 
     646                { 
     647                        TextureTable::const_iterator it = mTextureTable.find(strings[1]); 
     648 
     649                        int id; 
     650 
     651                        if (it == mTextureTable.end()) // parameter not found 
     652                        { 
     653                                mTextures.push_back(strings[1]); 
     654                                id = (int)mTextures.size(); 
     655                                mTextureTable[strings[1]] = id; 
     656                        } 
     657                        else 
     658                        { 
     659                                id = (*it).second; 
     660                        } 
     661 
     662                        currentMat->texture = id; 
     663                } 
     664 
     665                if ((strings.size() == 4) && (strcmp(strings[0].c_str(),"Kd") == 0)) 
     666                { 
     667                        currentMat->rgb[0] = (float)atof(strings[1].c_str()); 
     668                        currentMat->rgb[1] = (float)atof(strings[2].c_str()); 
     669                        currentMat->rgb[2] = (float)atof(strings[3].c_str()); 
     670                } 
     671 
     672                ++ line; 
     673        } 
     674 
     675        return true; 
     676} 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.h

    r3012 r3247  
    55#include <string> 
    66#include <vector> 
     7#include <map> 
    78 
    8 /*struct SimpleVec 
     9 
     10struct Material 
    911{ 
    10         SimpleVec() {} 
    11         SimpleVec(float _x, float _y, float _z): x(_x), y(_y), z(_z) {} 
     12        float rgb[3]; 
     13        int texture; 
     14}; 
    1215 
    13         float x, y, z; 
    14 };*/ 
     16class Geometry; 
    1517 
    1618typedef std::vector<SimpleVec> VertexArray; 
    1719typedef std::pair<float, float> Texcoord; 
     20typedef std::map<std::string, Material *> MaterialTable; 
     21typedef std::map<std::string, int> TextureTable; 
     22 
     23typedef std::vector<std::string> TextureArray; 
    1824 
    1925class ogzstream; 
     
    2935        bool Convert(const std::string &inputFilename,  
    3036                         const std::string &outputFilename); 
    31         // const std::string textureFilename) const; 
     37                     // const std::string textureFilename) const; 
     38 
     39        bool LoadMaterials(const std::string &matFileName); 
    3240 
    3341        ~ObjConverter(); 
     
    4048                SimpleVec *mNormals; 
    4149                Texcoord *mTexcoords; 
     50                Material *mMaterial; 
    4251 
    4352                int mVertexCount; 
     
    4554        }; 
    4655 
     56typedef std::vector<Geometry *> GeometryArray; 
     57 
    4758        void LoadShape(const VertexArray &faceVertices, 
    4859                           const VertexArray &faceNormals, 
    49                                    const std::vector<Texcoord> &faceTexcoords); 
     60                                   const std::vector<Texcoord> &faceTexcoords,  
     61                                   Material *mat); 
    5062 
    5163        void WriteGeometry(ogzstream &str, Geometry *geom); 
     
    5567 
    5668 
    57         std::vector<Geometry *> mGeometry; 
     69        MaterialTable mMaterialTable; 
     70        TextureTable mTextureTable; 
     71         
     72        TextureArray mTextures; 
     73        GeometryArray mGeometry; 
    5874 
    5975        int mNumShapes; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/main.cpp

    r3146 r3247  
    1414 
    1515        cout << "converting obj to dem format" << endl; 
     16         
     17        if (!converter.LoadMaterials(model_path + argv[3])) 
     18        { 
     19                cerr << "loading materials failed" << endl; 
     20 
     21                std::cin.get(); 
     22                exit(0); 
     23        } 
    1624 
    1725        if (!converter.Convert(model_path + argv[1], model_path + argv[2])) 
     
    2230                exit(0); 
    2331        } 
    24         //std::cin.get(); 
     32 
    2533        cout << "conversion successful" << endl; 
     34        cout << "press any key" << std::cin.get(); 
    2635 
    2736        return 0; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env

    r3246 r3247  
    88 
    99#filename=vienna_full_hp 
     10filename=city 
    1011useLODs=1 
    1112# shadow map size 
     
    2324visibilitySolution=vienna_full-8x3-pgv 
    2425 
     26useSkylightForIllum=0 
    2527 
    2628 
     
    4244#keyForwardMotion=5.0f 
    4345#keyRotation=0.5f 
    44 #keyForwardMotion=20.0f 
     46keyForwardMotion=20.0f 
    4547keyRotation=1.5f 
    4648 
     
    5961## powerplant options 
    6062 
    61 filename=PowerPlantM 
     63#filename=PowerPlantM 
    6264 
    63 keyForwardMotion=200.0f 
    64 mouseMotion=1.0f; 
    65 visibilitySolution=power-plant-2c-xx-1000b-pgv2 
    66 camPosition=-1320.57 -6306.34 3603 
    67 camDirection=0.292156 0.9556 0.0383878 
     65#keyForwardMotion=200.0f 
     66#mouseMotion=1.0f; 
     67#visibilitySolution=power-plant-2c-xx-1000b-pgv2 
     68#camPosition=-1320.57 -6306.34 3603 
     69#camDirection=0.292156 0.9556 0.0383878 
    6870 
    6971 
     
    109111 
    110112# use full resolution ssao (vs. half resoltion) 
    111 ssaoUseFullResolution=0 
     113ssaoUseFullResolution=1 
    112114# ssao kernel radius 
    113115#ssaoKernelRadius=8e-1f 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp

    r3246 r3247  
    14261426{ 
    14271427        mSampleIntensity = sampleIntensity; 
     1428        mRegenerateSamples = true; 
    14281429} 
    14291430 
     
    14321433{ 
    14331434        mKernelRadius = kernelRadius; 
     1435        mRegenerateSamples = true; 
    14341436} 
    14351437 
     
    14381440{ 
    14391441        mSsaoFilterRadius = ssaoFilterRadius; 
     1442        mRegenerateSamples = true; 
    14401443} 
    14411444 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.cpp

    r3235 r3247  
    172172 
    173173QuadraticDiscSampleGenerator2D::QuadraticDiscSampleGenerator2D(int numSamples, float radius): 
    174 PoissonDiscSampleGenerator2D(numSamples, radius) 
     174//PoissonDiscSampleGenerator2D(numSamples, radius) 
     175RandomSampleGenerator2D(numSamples, radius) 
    175176{} 
    176177 
     
    193194#else 
    194195 
    195         PoissonDiscSampleGenerator2D::Generate(samples); 
     196        //PoissonDiscSampleGenerator2D::Generate(samples); 
     197        RandomSampleGenerator2D::Generate(samples); 
    196198 
    197199        Sample2 *s = (Sample2 *)samples; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.h

    r3230 r3247  
    7878        with the distance 
    7979*/ 
    80 class QuadraticDiscSampleGenerator2D: public PoissonDiscSampleGenerator2D 
     80//class QuadraticDiscSampleGenerator2D: public PoissonDiscSampleGenerator2D 
     81class QuadraticDiscSampleGenerator2D: public RandomSampleGenerator2D 
    8182{ 
    8283public: 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3246 r3247  
    142142ViewCell *viewCell = NULL; 
    143143 
     144bool useSkylightForIllum = true; 
     145 
    144146static int globalVisibleId = 0; 
    145147 
     
    456458                env.GetBoolParam(string("usePvs"), usePvs); 
    457459 
     460                env.GetBoolParam(string("useSkylightForIllum"), useSkylightForIllum); 
     461 
    458462                //env.GetStringParam(string("modelPath"), model_path); 
    459463                //env.GetIntParam(string("numSssaoSamples"), numSsaoSamples); 
     
    488492                cout << "use PVS: " << usePvs << endl; 
    489493                cout << "visibilitySolution: " << visibilitySolution << endl; 
    490                  
     494                cout << "useSkylightForIllum" << useSkylightForIllum << endl; 
    491495 
    492496                //cout << "model path: " << model_path << endl; 
     
    571575 
    572576        //LoadModel("fisch.dem", dynamicObjects); 
    573         //LoadModel("hbuddha.dem", dynamicObjects); 
    574577 
    575578        //LoadModel("venusm.dem", dynamicObjects); 
     
    577580        //LoadModel("toyplane2.dem", dynamicObjects); 
    578581        //LoadModel("elephal.dem", dynamicObjects); 
    579  
     582        LoadModel("sibenik.dem", dynamicObjects); 
     583 
     584#if 1 
     585        LoadModel("hbuddha.dem", dynamicObjects); 
     586 
     587        buddha = dynamicObjects.back(); 
     588         
     589        const Vector3 sceneCenter(470.398f, 240.364f, 181.7f); 
     590        //const Vector3 sceneCenter(470.398f, 240.364f, 180.3); 
     591         
     592        Matrix4x4 transl = TranslationMatrix(sceneCenter); 
     593        buddha->GetTransform()->SetMatrix(transl); 
     594 
     595        for (int i = 0; i < 10; ++ i) 
     596        { 
     597                SceneEntity *ent = new SceneEntity(*buddha); 
     598                resourceManager->AddSceneEntity(ent); 
     599 
     600                Vector3 offs = Vector3::ZERO(); 
     601 
     602                offs.x = RandomValue(.0f, 50.0f); 
     603                offs.y = RandomValue(.0f, 50.0f); 
     604 
     605                Vector3 newPos = sceneCenter + offs; 
     606 
     607                transl = TranslationMatrix(newPos); 
     608                Transform3 *transform = resourceManager->CreateTransform(transl); 
     609 
     610                ent->SetTransform(transform); 
     611                dynamicObjects.push_back(ent); 
     612        } 
     613#endif 
     614 
     615         
    580616        resourceManager->mUseNormalMapping = false; 
    581617        resourceManager->mUseSpecialColors = false; 
    582618 
    583         /* 
    584         buddha = dynamicObjects.back(); 
    585          
    586         const Vector3 sceneCenter(470.398f, 240.364f, 181.7f); 
    587         //const Vector3 sceneCenter(470.398f, 240.364f, 180.3); 
    588          
    589         Matrix4x4 transl = TranslationMatrix(sceneCenter); 
    590         buddha->GetTransform()->SetMatrix(transl); 
    591  
    592         for (int i = 0; i < 10; ++ i) 
    593         { 
    594                 SceneEntity *ent = new SceneEntity(*buddha); 
    595                 resourceManager->AddSceneEntity(ent); 
    596  
    597                 Vector3 offs = Vector3::ZERO(); 
    598  
    599                 offs.x = RandomValue(.0f, 50.0f); 
    600                 offs.y = RandomValue(.0f, 50.0f); 
    601  
    602                 Vector3 newPos = sceneCenter + offs; 
    603  
    604                 transl = TranslationMatrix(newPos); 
    605                 Transform3 *transform = resourceManager->CreateTransform(transl); 
    606  
    607                 ent->SetTransform(transform); 
    608                 dynamicObjects.push_back(ent); 
    609         } 
    610         */ 
    611619 
    612620/*      int cityEntities = LoadModel("vienna_full_hp.dem", dynamicObjects); 
     
    942950        Vector3 sunDiffuse; 
    943951 
    944 #if 1 
    945         preetham->ComputeSunColor(lightDir, sunAmbient, sunDiffuse, !useHDRValues); 
    946  
    947         ambient[0] = sunAmbient.x; 
    948         ambient[1] = sunAmbient.y; 
    949         ambient[2] = sunAmbient.z; 
    950  
    951         diffuse[0] = sunDiffuse.x; 
    952         diffuse[1] = sunDiffuse.y; 
    953         diffuse[2] = sunDiffuse.z; 
    954  
    955 #else 
    956          
    957         ambient[0] = .2f; 
    958         ambient[1] = .2f; 
    959         ambient[2] = .2f; 
    960  
    961         diffuse[0] = 1.0f; 
    962         diffuse[1] = 1.0f; 
    963         diffuse[2] = 1.0f; 
    964  
    965 #endif 
     952        if (useSkylightForIllum) 
     953        { 
     954                preetham->ComputeSunColor(lightDir, sunAmbient, sunDiffuse, !useHDRValues); 
     955 
     956                ambient[0] = sunAmbient.x; 
     957                ambient[1] = sunAmbient.y; 
     958                ambient[2] = sunAmbient.z; 
     959 
     960                diffuse[0] = sunDiffuse.x; 
     961                diffuse[1] = sunDiffuse.y; 
     962                diffuse[2] = sunDiffuse.z; 
     963        } 
     964        else 
     965        { 
     966 
     967                ambient[0] = .2f; 
     968                ambient[1] = .2f; 
     969                ambient[2] = .2f; 
     970 
     971                diffuse[0] = 1.0f; 
     972                diffuse[1] = 1.0f; 
     973                diffuse[2] = 1.0f; 
     974        } 
    966975 
    967976        glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); 
     
    10881097#endif 
    10891098 
    1090  
     1099/* 
    10911100                ///////////////////////// 
    10921101                //-- update animations 
     
    10961105 
    10971106                Matrix4x4 rotMatrix = RotationZMatrix(rotAngle); 
    1098                 dynamicObjects[1]->GetTransform()->MultMatrix(rotMatrix); 
     1107                dynamicObjects[2]->GetTransform()->MultMatrix(rotMatrix); 
    10991108 
    11001109                motionPath->Move(0.01f); 
     1110                */ 
    11011111        } 
    11021112 
     
    11891199        { 
    11901200                if (!viewCellsTree) LoadVisibilitySolution(); 
    1191                 LoadPvs();       
     1201 
     1202                LoadPvs(); 
    11921203        } 
    11931204 
     
    13091320                FrameBufferObject::Release(); 
    13101321 
    1311                 if (!deferredShader) deferredShader =  
    1312                         new DeferredRenderer(texWidth, texHeight, camera, ssaoUseFullResolution); 
    1313                  
     1322                if (!deferredShader)  
     1323                { 
     1324                        deferredShader =  
     1325                                new DeferredRenderer(texWidth, texHeight, camera, ssaoUseFullResolution); 
     1326 
     1327                        deferredShader->SetKernelRadius(ssaoKernelRadius); 
     1328                        deferredShader->SetSampleIntensity(ssaoSampleIntensity); 
     1329                        deferredShader->SetSsaoFilterRadius(ssaoFilterRadius); 
     1330                } 
     1331 
    13141332                DeferredRenderer::SHADING_METHOD shadingMethod; 
    13151333 
     
    13311349                deferredShader->SetShadingMethod(shadingMethod); 
    13321350                deferredShader->SetSamplingMethod(samplingMethod); 
    1333                 deferredShader->SetKernelRadius(ssaoKernelRadius); 
    1334                 deferredShader->SetSampleIntensity(ssaoSampleIntensity); 
    1335                 deferredShader->SetSsaoFilterRadius(ssaoFilterRadius); 
     1351                 
    13361352                deferredShader->SetUseTemporalCoherence(useTemporalCoherence); 
    13371353                //deferredShader->SetSortSamples(sortSamples); 
     
    14751491                ssaoKernelRadius *= 0.8f; 
    14761492                cout << "new ssao kernel radius: " << ssaoKernelRadius << endl; 
     1493                if (deferredShader) deferredShader->SetKernelRadius(ssaoKernelRadius); 
    14771494                break; 
    14781495        case '0': 
    14791496                ssaoKernelRadius *= 1.0f / 0.8f; 
     1497                if (deferredShader) deferredShader->SetKernelRadius(ssaoKernelRadius); 
    14801498                cout << "new ssao kernel radius: " << ssaoKernelRadius << endl; 
    14811499                break; 
    14821500        case 'n': 
    14831501                ssaoSampleIntensity *= 0.9f; 
     1502                if (deferredShader) deferredShader->SetSampleIntensity(ssaoSampleIntensity); 
    14841503                cout << "new ssao sample intensity: " << ssaoSampleIntensity << endl; 
    14851504                break; 
    14861505        case 'N': 
    14871506                ssaoSampleIntensity *= 1.0f / 0.9f; 
     1507                if (deferredShader) deferredShader->SetSampleIntensity(ssaoSampleIntensity); 
    14881508                cout << "new ssao sample intensity: " << ssaoSampleIntensity << endl; 
    14891509                break; 
    14901510        case 'o': 
    14911511                ssaoFilterRadius *= 0.9f; 
     1512                if (deferredShader) deferredShader->SetSsaoFilterRadius(ssaoFilterRadius); 
    14921513                cout << "new ssao filter radius: " << ssaoFilterRadius << endl; 
    14931514                break; 
    14941515        case 'O': 
    14951516                ssaoFilterRadius *= 1.0f / 0.9f; 
     1517                if (deferredShader) deferredShader->SetSsaoFilterRadius(ssaoFilterRadius); 
    14961518                cout << "new ssao filter radius: " << ssaoFilterRadius << endl; 
    14971519                break; 
     
    25872609 
    25882610        viewCellsTree = visLoader.Load(vis_filename, bvh); 
     2611 
     2612        if (!viewCellsTree) 
     2613        { 
     2614                cerr << "loading pvs failed" << endl; 
     2615                CleanUp(); 
     2616                exit(0); 
     2617        } 
    25892618} 
    25902619 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h

    r3246 r3247  
    66//-- ssao + gi parameters 
    77 
    8 //#define NUM_SAMPLES 8 
     8#define NUM_SAMPLES 8 
    99//#define NUM_SAMPLES 16 
    10 #define NUM_SAMPLES 24 
     10//#define NUM_SAMPLES 24 
    1111//#define NUM_SAMPLES 48 
    1212 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsao.cg

    r3246 r3247  
    162162 
    163163                // the filtered ssao value 
    164                 ao.x = DiscontinuityFilter(IN.texCoord, ao, col, ssaoTex, normalsTex, colorsTex, filterOffs, scale, bl, br, tl, tr); 
     164                //ao.x = DiscontinuityFilter(IN.texCoord, ao, col, ssaoTex, normalsTex, colorsTex, filterOffs, scale, bl, br, tl, tr); 
    165165        } 
    166166 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg

    r3231 r3247  
    2222}; 
    2323 
    24  
     24// this function is inspired from the paper of shamulgaan in order 
     25// to get a physical expression for the occlusion culling 
    2526inline float occlusionPower(float radius, float dist) 
    2627{ 
Note: See TracChangeset for help on using the changeset viewer.