Changeset 3286 for GTP


Ignore:
Timestamp:
01/19/09 10:28:16 (15 years ago)
Author:
mattausch
Message:

worked on visualizations

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

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env

    r3285 r3286  
    2121shadowSize=4096 
    2222# the filenames given to recorded frames (+ number.bmp) 
    23 recordedFramesSuffix=frames/vienna_frame 
     23#recordedFramesSuffix=frames/vienna_frame 
     24recordedFramesSuffix=frames_100_pgv/vienna_frame 
     25#recordedFramesSuffix=frames_50_spgvu/vienna_frame 
    2426# the filename for the statistics 
    2527statsFilename=mystats 
    26 walkThroughSuffix=walkthrough_pp_1 
     28#walkThroughSuffix=walkthrough_pp_1 
     29walkThroughSuffix=walkthrough_vienna 
    2730#walkThroughSuffix=path_pp 
    2831 
     
    3033usePvs=0 
    3134 
    32 # if using pvs, this specifies the name of the visibility solutin 
     35# if using pvs, this specifies the name of the visibility solution 
    3336#visibilitySolution=vienna_full-8x3-pgv 
    3437#visibilitySolution=vienna_full-8x3-spgvu 
     
    3740#visibilitySolution=mypompeii-2x1-obvh-pgv 
    3841visibilitySolution=myvienna-3x1-obvh-pgv 
     42#visibilitySolution=myvienna-3x1-obvh-refu 
     43#visibilitySolution=myvienna-3x1-obvh-spgvu 
    3944 
    4045viewCellsScaleFactor=1.0f 
     
    4247 
    4348skyDomeScaleFactor=80.0f 
     49 
     50#visibilitySolutionInitialState=50000000 
     51visibilitySolutionInitialState=100000000 
    4452 
    4553 
     
    6169# move speed 
    6270#keyForwardMotion=5.0f 
    63 #keyRotation=0.5f 
     71keyRotation=0.5f 
    6472keyForwardMotion=20.0f 
    65 keyRotation=1.5f 
     73#keyRotation=1.5f 
     74keyForwardMotion=30.0f 
    6675 
    6776# initial camera position 
     
    8190#lightDirection=-0.8f 1.0f -0.7f 
    8291#lightDirection=-0.3f 0.2f -0.7f 
    83 lightDirection=-0.14002 0.812842 -0.565404 
     92#lightDirection=-0.14002 0.812842 -0.565404 
     93#lightDirection=-0.77596 -0.614785 -0.141158 
     94#lightDirection=-0.785914 -0.583277 -0.20525 
     95lightDirection=0.509293 0.784034 -0.35484 
     96 
    8497 
    8598##################### 
     
    153166#useSkylightForIllum=1 
    154167#skyDomeScaleFactor=1000.0f 
     168 
     169 
     170camPosition=1145.31 413.602 186.678 
     171camDirection=-0.917729 -0.397207 -0 
     172lightDirection=0.509293 0.784034 -0.35484 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/VisibilitySolutionLoader.cpp

    r3285 r3286  
    157157        CreateIdSortedList2(bvh->GetStaticRoot(), nodes); 
    158158        //CreateIdSortedList(bvh, nodes); 
    159 /*      ofstream outstream("test.log"); 
    160  
    161         BvhNode *f = ((BvhInterior *)bvh->GetStaticRoot())->GetFront(); 
    162         BvhNode *b = ((BvhInterior *)bvh->GetStaticRoot())->GetBack(); 
    163  
    164         outstream << "front: " << f->GetFirstEntity() << " " << f->GetLastEntity() << endl; 
    165         outstream << "back: " << b->GetFirstEntity() << " " << b->GetLastEntity() << endl; 
    166  
    167         for (size_t i = 0; i < nodes.size(); ++ i) 
    168         { 
    169                 BvhNode *n = nodes[i]; 
    170                 //if (nodes[i]->GetId() >= nodes.size()) cout << "id " << nodes[i]->GetId() << endl; 
    171                 if (n->IsVirtualLeaf()) 
    172                 { 
    173                         int geometrySize; 
    174                         AxisAlignedBox3 box; 
    175                         SceneEntity **ent = bvh->GetGeometry(n, geometrySize); 
    176                         box = SceneEntity::ComputeBoundingBox(ent, geometrySize); 
    177  
    178                         outstream << n->GetFirstEntity() << " " << n->GetLastEntity() << " " << n->GetBox() << " " << box << endl; 
    179                 } 
    180         } 
    181 */               
     159 
     160        const int tenpercent = number / 10; 
     161        int j = 0; 
     162 
    182163        for (int i = 0; i < number; ++ i)  
    183164        { 
    184                 if ((i % number / 10) ==  (number / 10 - 1)) 
    185                         cout << 100 * (i + 1) / 100 << "percent loaded" << endl; 
     165                if ((i % tenpercent) == (tenpercent - 1)) 
     166                { 
     167                        j += 10; 
     168                        cout << j << " percent of the view cells loaded" << endl; 
     169                } 
    186170 
    187171                fread(&entries, sizeof(int), 1, fw); 
     
    196180         
    197181                        BvhNode *node = nodes[objectId]; 
    198                         //if (i == 100) outstream << "t " << time << " "; 
    199182                        mViewCells[i]->mPvs.AddEntry(bvh, node, time); 
    200183                } 
    201184        } 
    202  
    203         //outstream.close(); 
    204185 
    205186        return true; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3285 r3286  
    157157 
    158158float shotRays = .0f; 
     159/// the visibility solution is initialized at this number of rays shot that  
     160int visibilitySolutionInitialState = 0; 
    159161 
    160162 
     
    480482                env.GetFloatParam(string("viewCellsScaleFactor"), viewCellsScaleFactor); 
    481483                env.GetFloatParam(string("skyDomeScaleFactor"), skyDomeScaleFactor); 
     484                env.GetIntParam(string("visibilitySolutionInitialState"), visibilitySolutionInitialState); 
    482485                 
    483486                //env.GetStringParam(string("modelPath"), model_path); 
     
    11921195                if (!walkThroughPlayer->ReadNextFrame(camera))  
    11931196                { 
     1197                        cout << "reached end of walkthrough" << endl; 
    11941198                        currentReplayFrame = -1; 
    11951199                        replayPath = false; 
     
    12161220        { 
    12171221                if (!walkThroughRecorder) 
     1222                { 
    12181223                        walkThroughRecorder = new WalkThroughRecorder(walkThroughSuffix + ".log"); 
    1219                  
    1220                 if ((Distance(oldPos, camera->GetPosition()) > 1e-6f) || 
     1224                } 
     1225 
     1226                // question: check if player has moved more than a minimum distance? 
     1227 
     1228                if (0 ||  
     1229                        (Distance(oldPos, camera->GetPosition()) > 1e-6f) || 
    12211230                        (DotProd(oldDir, camera->GetDirection()) < 1.0f - 1e-6f)) 
    12221231                { 
     
    12391248                        LoadVisibilitySolution(); 
    12401249                        applicationTimer.Start(); 
     1250                        shotRays = visibilitySolutionInitialState; 
    12411251                } 
    12421252 
     
    18241834                        cout << "recording frames on replaying" << endl; 
    18251835                else 
    1826                         cout << "finished recording frames on replaying" << endl; 
     1836                        cout << "not recording frames on replaying" << endl; 
    18271837                break; 
    18281838        case GLUT_KEY_LEFT: 
     
    23752385                } 
    23762386 
    2377                 glColor3f(1.0f, 1.0f, 1.0f); 
     2387                glColor3f(0.0f, 1.0f, 0.0f); 
     2388 
    23782389                static char *alg_str[] = { 
    23792390                        "Frustum Cull" 
     
    23842395                }; 
    23852396         
    2386 #if 0 
    23872397                if (!showAlgorithmTime) 
    23882398                { 
     
    23902400                        {                        
    23912401                                sprintf(msg[7], "%s:  %6.1f fps", alg_str[renderMode], fps);             
    2392                                 myfont.DrawString(msg[7], 1.3f, 690.0f, 760.0f);//, top_color, bottom_color); 
     2402                                myfont.DrawString(msg[7], 1.3f, winWidth - 350, winHeight - 30.0f); 
    23932403                        } 
     2404 
     2405                        int mrays = (int)shotRays / 1000000; 
     2406                        sprintf(msg[7], "%s:  %04d M rays", alg_str[renderMode], mrays);         
     2407                        myfont.DrawString(msg[7], 1.3f, winWidth - 350, winHeight - 60.0f); 
    23942408                } 
    23952409                else 
    23962410                { 
    23972411                        sprintf(msg[7], "%s:  %6.1f ms", alg_str[renderMode], rTime); 
    2398                         myfont.DrawString(msg[7], 1.3f, 690.0f, 760.0f);//, top_color, bottom_color); 
    2399                 } 
    2400 #else 
    2401                 int mrays = (int)shotRays / 1000000; 
    2402                 sprintf(msg[7], "%s:  %04d M rays", alg_str[renderMode], mrays);         
    2403                 //myfont.DrawString(msg[7], 1.3f, 690.0f, 760.0f);//, top_color, bottom_color); 
    2404                 myfont.DrawString(msg[7], 1.3f, winWidth - 350, winHeight - 30.0f);//, top_color, bottom_color); 
    2405 #endif 
    2406         } 
    2407  
     2412                        myfont.DrawString(msg[7], 1.3f, winWidth - 350, winHeight - 30.0f); 
     2413                } 
     2414 
     2415                glColor3f(1.0f, 1.0f, 1.0f); 
     2416        } 
     2417 
     2418        glColor3f(1, 1, 1); 
    24082419        glDisable(GL_BLEND); 
    24092420        glDisable(GL_TEXTURE_2D); 
     
    26642675        viewCell = viewCellsTree->GetViewCell(camera->GetPosition()); 
    26652676 
    2666         // assume 60 FPS 
    2667         const float raysPerMs = pvsTotalSamples / pvsTotalTime; 
    2668         const float scale = renderTime * raysPerMs; 
    2669  
    2670         cout << "rays per sec: " << raysPerMs << endl; 
    2671  
    2672         //const float elapsedAlgorithmTime = applicationTimer.Elapsedms(false); 
    2673         //int numTriangles = 0; 
     2677        const float elapsedAlgorithmTime = applicationTimer.Elapsedms(false); 
     2678 
     2679        // assume 60 FPS, total time is in secs 
     2680        const float raysPerMs = 2.0f * pvsTotalSamples / (pvsTotalTime * 1000.0f); 
     2681        //shotRays = visibilitySolutionInitialState + elapsedAlgorithmTime * raysPerMs; 
     2682        //shotRays += 1000 * raysPerMs / 60.0f; 
     2683 
     2684        //cout << "totalt: " << pvsTotalTime << endl; 
     2685        //cout << "rays per ms: " << raysPerMs << endl; 
    26742686 
    26752687        SceneEntity::SetCurrentVisibleId(globalVisibleId); 
     
    26792691                PvsEntry entry = viewCell->mPvs.GetEntry(i); 
    26802692#ifdef USE_TIMESTAMPS 
    2681                 if ((entry.mTimeStamp < 0.0f) || (entry.mTimeStamp <= shotRays)) 
    2682 #else 
    2683                 if (1) 
     2693                if (!((entry.mTimeStamp < 0.0f) || (entry.mTimeStamp <= shotRays))) 
     2694                        continue; 
    26842695#endif 
    2685                 { 
    2686                         entry.mEntity->SetVisibleId(globalVisibleId); 
    2687                         //numTriangles += entry.mEntity->CountNumTriangles(); 
    2688                 } 
    2689         } 
    2690  
    2691         shotRays += scale; 
     2696                entry.mEntity->SetVisibleId(globalVisibleId); 
     2697                //numTriangles += entry.mEntity->CountNumTriangles(); 
     2698        } 
     2699 
    26922700        ++ globalVisibleId; 
    26932701} 
Note: See TracChangeset for help on using the changeset viewer.