Changeset 330


Ignore:
Timestamp:
10/16/05 12:42:54 (19 years ago)
Author:
mattausch
Message:

samplepreprocessor: rays are added inside sampleperpass loop. sample count fixed (add sampleperpass count for each object)

Location:
trunk/VUT/GtpVisibilityPreprocessor
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/scripts/default.env

    r329 r330  
    99#       filename vienna.x3d 
    1010#       filename ../data/vienna/vienna-simple.x3d 
    11 #       filename ../data/vienna/vienna-buildings.x3d 
     11        filename ../data/vienna/vienna-buildings.x3d 
    1212#       filename ../data/vienna/viewcells-25-sel.x3d 
    13         filename ../data/atlanta/atlanta2.x3d 
     13#       filename ../data/atlanta/atlanta2.x3d 
    1414#       filename ../data/soda/soda.dat 
    1515#       filename ../data/soda/soda5.dat 
     
    5656 
    5757Sampling { 
    58         totalSamples    1000000 
     58        totalSamples    5000 
    5959        samplesPerPass  20 
    6060} 
    6161 
    6262ViewCells { 
    63         # hierarchy kdTree 
     63        #hierarchy kdTree 
    6464        hierarchy bspTree 
    6565        # hierarchy sceneDependent 
     
    6969         
    7070#       filename ../data/atlanta/atlanta_viewcells_large.x3d 
    71 #       filename ../data/vienna/viewcells-25-sel.x3d 
    72         filename ../data/vienna/viewcells-25.x3d 
     71        filename ../data/vienna/viewcells-25-sel.x3d 
     72#       filename ../data/vienna/viewcells-25.x3d 
    7373#       filename ../data/vienna/viewcells-large-sel.x3d 
    7474} 
     
    7979        #       input fromViewCells 
    8080        #       input fromSceneGeometry 
    81                 samples 50000 
     81                samples 3000 
    8282                sideTolerance 0.002 
    8383        } 
  • trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp

    r329 r330  
    151151        // cast ray to KD tree to find intersection with other objects 
    152152        mKdTree->CastRay(ray); 
    153         cout << "k"; 
     153         
    154154        if (mViewCellsType == BSP_VIEW_CELLS) 
    155155        { 
     
    157157                if (mBspTree) 
    158158                { 
    159                         cout << "uhhhhhhh year" << endl; 
    160159                        mBspTree->CastRay(ray); 
    161160                 
     
    171170        else 
    172171        { 
    173                 cout << "z" << endl; 
    174172                if (ray.leaves.size()) { 
    175173                        sampleContributions += AddNodeSamples(object, ray); 
     
    308306                cout << "totalSamples: "  << totalSamples; 
    309307                for (i = 0; i < objects.size(); i++) { 
    310                         printf("\nsampling object %d of %d, samples %d\n", i, (int)objects.size(), passSamples); 
     308                         
     309                        Debug << "\nsampling object " << i << " of " << (int)objects.size() << " sample " << passSamples << endl; 
    311310 
    312311                        KdNode *nodeToSample = NULL; 
     
    373372                        int sampleContributions; 
    374373                         
     374                        long startTime = GetTime(); 
     375 
    375376                        if (viewcellSample) { 
    376377                                nodeToSample = mKdTree->GetRandomLeaf(Plane3(normal, point)); 
    377                                  
     378                                         
    378379                                for (int k=0; k < mSamplesPerPass; k++) { 
    379380                                        if (nodeToSample) { 
     
    396397                                        // construct a ray 
    397398                                        SetupRay(ray, point, direction); 
    398                                          cout << "s"; 
     399                                         
    399400                                        sampleContributions = CastRay(object, ray); 
    400                                         cout << "r"; 
     401 
     402                                        // CORR matt: put inside loop 
     403                                        if ( i < pvsOut ) 
     404                                                rays[i].push_back(ray); 
     405                 
     406                                        if (!ray.intersections.empty()) { 
     407                                                // check whether we can add this to the rays 
     408                                                for (int j = 0; j < pvsOut; j++) { 
     409                                                        if (objects[j] == ray.intersections[0].mObject) { 
     410                                                                rays[j].push_back(ray); 
     411                                                        } 
     412                                                } 
     413                                        } 
     414 
    401415                                        if (mViewCellsType == BSP_VIEW_CELLS)  
    402416                                        { 
     
    435449                                //                              object->GetRandomVisibleMesh(Plane3(normal, point)); 
    436450                        } 
    437                  
    438                         // NOTE: should be inside loop 
    439                         if ( i < pvsOut ) 
    440                                 rays[i].push_back(ray); 
    441                  
    442                         if (!ray.intersections.empty()) { 
    443                                         // check whether we can add this to the rays 
    444                                 for (int j = 0; j < pvsOut; j++) { 
    445                                         if (objects[j] == ray.intersections[0].mObject) { 
    446                                                 rays[j].push_back(ray); 
    447                                         } 
    448                                 } 
    449                         } 
    450                  
    451                         passSamples++; 
     451                        long t = TimeDiff(startTime, GetTime()); 
     452                        Debug << "pass time: " << t << endl; 
     453                 
     454                        passSamples += mSamplesPerPass; 
    452455                 
    453456                        if (sampleContributions) { 
     
    456459                        } 
    457460                } 
    458                 cout << "pass samples: " << passSamples << endl; 
    459                 totalSamples += passSamples; 
     461         
     462                // CORR matt: must add pass samples 
     463                totalSamples += passSamples; // totalSamples ++; 
    460464                 
    461465                //    if (pass>10) 
     
    588592                                        if (!objects[j]->Mailed()) 
    589593                                        { 
     594                                                //if (j == 2198)m.mDiffuseColor = RgbColor(1, 0, 1); 
     595                                                //else m.mDiffuseColor = RgbColor(1, 1, 0); 
     596                                                exporter->SetForcedMaterial(m); 
    590597                                                exporter->ExportIntersectable(objects[j]); 
    591598                                                objects[j]->Mail(); 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp

    r329 r330  
    672672 
    673673        long startTime = GetTime(); 
    674         cout << "**** Contructing tree using scene geometry ****\n"; 
     674        cout << "**** Contructing bsp tree ****\n"; 
    675675 
    676676        while (!tStack.empty())  
     
    831831        // partition rays 
    832832        interior->SplitRays(rays, frontRays, backRays); 
    833         Debug << "jdfjfj43" << endl; 
     833         
    834834        // split polygons with split plane 
    835835        mStat.splits +=interior->SplitPolygons(polys,  
  • trunk/VUT/GtpVisibilityPreprocessor/src/main.cpp

    r329 r330  
    5757          } 
    5858         
    59           Debug << "do2" << endl; 
    6059          p->BuildBspTree(); 
    6160          p->Export("vc_bsptree.x3d", false, false, true); 
     
    6463          bool exportSplits = false; 
    6564          environment->GetBoolValue("BspTree.exportSplits", exportSplits); 
    66 Debug << "do3" << endl; 
     65 
    6766          // export the bsp splits 
    6867          if (exportSplits) 
Note: See TracChangeset for help on using the changeset viewer.