Changeset 2070


Ignore:
Timestamp:
02/01/07 11:18:15 (17 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/generate_viewcells.env

    r2069 r2070  
    1212 
    1313Preprocessor { 
    14 samplesPerPass 6000000 
     14samplesPerPass 3000000 
    1515        useGlRenderer false 
    1616        type vss 
     
    1919        loadMeshes false 
    2020        # internal raycaster 
    21         #rayCastMethod 0 
     21        rayCastMethod 0 
    2222        # intel raycaster 
    23         rayCastMethod 1 
     23#       rayCastMethod 1 
    2424        exportVisibility false 
    2525        loadKdTree false 
     
    190190VspBspTree { 
    191191        Construction { 
    192                 samples 900000 
     192                samples 200000 
    193193                epsilon 0.0000001 
    194194                randomize false 
     
    238238                minGlobalCostRatio      0.0001 
    239239 
    240                 maxViewCells            6000 
     240                maxViewCells            3000 
    241241         
    242242                # used for pvs criterium 
  • GTP/trunk/Lib/Vis/Preprocessing/src/AxisAlignedBox3.cpp

    r1999 r2070  
    1010#include "Halton.h" 
    1111#include "Triangle3.h" 
     12#include "VssRay.h" 
    1213 
    1314 
     
    566567} 
    567568#endif 
     569 
     570int AxisAlignedBox3::IsInside(const VssRay &v) const 
     571{ 
     572        return IsInside(v.mTermination) && IsInside(v.mOrigin); 
     573} 
     574 
    568575 
    569576bool 
  • GTP/trunk/Lib/Vis/Preprocessing/src/AxisAlignedBox3.h

    r1999 r2070  
    1313class Polygon3; 
    1414class Mesh; 
     15class VssRay; 
    1516struct Triangle3; 
    1617 
     
    122123  virtual int IsInside(const Vector3 &v) const; 
    123124   
     125  virtual int IsInside(const VssRay &v) const; 
     126 
    124127  /** Test if the box makes sense. 
    125128  */ 
  • GTP/trunk/Lib/Vis/Preprocessing/src/InternalRayCaster.cpp

    r2003 r2070  
    207207        { 
    208208                CastRay(*sit, vssRays, sbox, castDoubleRays, pruneInvalidRays); 
     209                if (!vssRays.empty() && (!vssRays.back() || !sbox.IsInside(*vssRays.back()))) 
     210                cout << "error " << *vssRays.back()<<endl; 
    209211        } 
    210212 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r2069 r2070  
    12461246 
    12471247        SimpleRayContainer::const_iterator rit, rit_end = rays.end(); 
    1248  
     1248cout << "here1 " << vssRays.size()<<endl; 
    12491249        SimpleRayContainer rayBucket; 
    12501250        int i = 0; 
     
    12761276         
    12771277                if ((int)rays.size() > 100000 && i % 100000 == 0) 
    1278                   cout<<"\r"<<i<<"/"<<(int)rays.size()<<"\r"; 
    1279         } 
    1280      
     1278                        cout << "here2 " << vssRays.size()<<endl; 
     1279                  //cout<<"\r"<<i<<"/"<<(int)rays.size()<<"\r"; 
     1280        } 
     1281    cout << "here3 " << vssRays.size()<<endl; 
    12811282        // cast rest of rays 
    12821283        SimpleRayContainer::const_iterator sit, sit_end = rayBucket.end(); 
     
    13051306        cout << "here5 " << vssRays.size()<<endl; 
    13061307 
    1307         if (1) { 
     1308        int m = 850000; 
     1309 
     1310        if (1 && (int)rays.size() > m + 50) { 
    13081311          VssRayContainer tmpRays; 
    1309           int m = 700000; 
    1310            
     1312                   
    13111313          for (int i=m; i < m+20; i++) { 
    13121314                  if (vssRays[i]) 
    1313                 tmpRays.push_back(vssRays[i]);           
     1315                  {cout<<"e"; 
     1316                tmpRays.push_back(vssRays[i]); 
     1317                  } 
     1318                  else cout <<"d"; 
    13141319          } 
    13151320          ExportRays("sorted_rays2.x3d", tmpRays, 200); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.cpp

    r2035 r2070  
    5555        return false; 
    5656 
    57   if (tmin >= 1.0f || tmax <=0.0f) 
     57  if (tmin >= 1.0f || tmax <= 0.0f) 
    5858        return false; 
    5959   
     
    7171} 
    7272 
    73 /** Checks if ray is valid, (e.g., not in empty view space or outside the view space) 
     73/** Checks if ray is valid 
     74        (e.g., not in empty view space or outside the view space) 
    7475*/ 
    7576bool 
     
    245246          } 
    246247        } 
    247  
    248          
    249         // regardless of the pruneInvalidRays setting reject rays whic degenerate to a point 
     248         
     249        // regardless of the pruneInvalidRays setting reject  
     250        // rays whic degenerate to a point 
    250251        if (EpsilonEqualV3(hitA.mPoint, hitB.mPoint, Limits::Small)) { 
    251252          return 0; 
    252253        } 
    253          
    254254         
    255255        const bool validA = ValidateRay(simpleRay.mOrigin, simpleRay.mDirection, box, hitA); 
     
    264264        // reset both contributions 
    265265        if (!validA || !validB) { 
    266           if (pruneInvalidRays) 
     266          if (0 || pruneInvalidRays) 
    267267                return 0; 
    268268           
     
    313313                if (validA) 
    314314                  vssRay->mFlags |= VssRay::Valid; 
    315  
    316315                 
    317316                vssRay->mDistribution = simpleRay.mDistribution; 
     
    327326#endif 
    328327 
    329           if (castDoubleRay && (!pruneInvalidRays || hitB.mObject)) 
    330                 { 
    331                   VssRay *vssRay = mVssRayPool.Alloc(); 
    332                                  
    333                   *vssRay = VssRay( 
    334                                                    clipA, 
    335                                                    hitB.mPoint, 
    336                                                    hitA.mObject, 
    337                                                    hitB.mObject, 
    338                                                    mPreprocessor.mPass, 
    339                                                    simpleRay.mPdf 
    340                                                    ); 
    341                   if (validB) 
     328        if (castDoubleRay && (!pruneInvalidRays || hitB.mObject)) 
     329        { 
     330                VssRay *vssRay = mVssRayPool.Alloc(); 
     331 
     332                *vssRay = VssRay( 
     333                        clipA, 
     334                        hitB.mPoint, 
     335                        hitA.mObject, 
     336                        hitB.mObject, 
     337                        mPreprocessor.mPass, 
     338                        simpleRay.mPdf 
     339                        ); 
     340 
     341                if (validB) 
    342342                        vssRay->mFlags |= VssRay::Valid; 
    343343 
    344                    
    345344                vssRay->mDistribution = simpleRay.mDistribution; 
    346345                vssRay->mGeneratorId = simpleRay.mGeneratorId; 
     
    348347                ++ hits; 
    349348                //cout << "vssray 2: " << *vssRay << endl; 
    350                 } 
     349        } 
    351350#if DEBUG_RAYCAST 
    352351          Debug<<"PR4"<<flush; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VspBspTree.cpp

    r2069 r2070  
    331331                ExtractPolygons(object, polys); 
    332332 
    333                 mBoundingBox.Include(object->GetBox()); // add to BSP tree aabb 
     333                 // add to BSP tree aabb 
     334                mBoundingBox.Include(object->GetBox()); 
    334335        } 
    335336 
     
    427428        VssRayContainer::const_iterator rit, rit_end = sampleRays.end(); 
    428429 
     430        ///////// 
    429431        //-- store rays 
    430432        for (rit = sampleRays.begin(); rit != rit_end; ++ rit) 
     
    928930                if (1) 
    929931                { 
    930                         float cFront = (float)tFrontData.mPvs * tFrontData.mProbability; 
    931                         float cBack = (float)tBackData.mPvs * tBackData.mProbability; 
    932                         float cData = (float)tData.mPvs * tData.mProbability; 
    933  
     932                        const float cFront = (float)tFrontData.mPvs * tFrontData.mProbability; 
     933                        const float cBack = (float)tBackData.mPvs * tBackData.mProbability; 
     934                        const float cData = (float)tData.mPvs * tData.mProbability; 
    934935                         
    935                         float costDecr =  
     936                        const float costDecr =  
    936937                                (cFront + cBack - cData) / mBoundingBox.GetVolume(); 
    937938 
     
    946947                } 
    947948 
    948          
     949                //////////// 
    949950                //-- push the new split candidates on the stack 
     951 
    950952                VspBspSubdivisionCandidate frontCandidate; 
    951953                frontCandidate.mParentData = tFrontData; 
     
    957959                EvalSubdivisionCandidate(backCandidate); 
    958960         
     961                cout << "f cost: " << frontCandidate.mPriority << endl; 
     962                cout << "b cost: " << backCandidate.mPriority << endl; 
    959963                tQueue.push(frontCandidate); 
    960964                tQueue.push(backCandidate); 
     
    10171021        leaf->mProbability = tData.mProbability; 
    10181022 
    1019                 // finally evaluate stats until this leaf 
    1020                 if (0) 
     1023                // finally evaluate stats for this leaf 
     1024                if (1) 
    10211025                        EvaluateLeafStats(tData);                
    10221026        } 
     
    12991303        mLocalSubdivisionCandidates->clear(); 
    13001304 
    1301         int requestedSize = 2 * (int)(rays.size()); 
     1305        const int requestedSize = 2 * (int)(rays.size()); 
     1306 
    13021307        // creates a sorted split candidates array 
    13031308        if (mLocalSubdivisionCandidates->capacity() > 500000 && 
     
    13251330                if (0) ClipValue(pos, minBand, maxBand); 
    13261331                 
    1327                 mLocalSubdivisionCandidates->push_back(SortableEntry(positive ? SortableEntry::ERayMin : SortableEntry::ERayMax,  
     1332                mLocalSubdivisionCandidates-> 
     1333                        push_back(SortableEntry(positive ? SortableEntry::ERayMin : SortableEntry::ERayMax,  
    13281334                                                                        pos, (*ri).mRay)); 
    13291335 
     
    13331339                if (0) ClipValue(pos, minBand, maxBand); 
    13341340 
    1335                 mLocalSubdivisionCandidates->push_back(SortableEntry(positive ? SortableEntry::ERayMax : SortableEntry::ERayMin,  
     1341                mLocalSubdivisionCandidates-> 
     1342                        push_back(SortableEntry(positive ? SortableEntry::ERayMax : SortableEntry::ERayMin,  
    13361343                                                                        pos, (*ri).mRay)); 
    13371344        } 
    13381345 
    1339         stable_sort(mLocalSubdivisionCandidates->begin(), mLocalSubdivisionCandidates->end()); 
     1346        sort(mLocalSubdivisionCandidates->begin(), mLocalSubdivisionCandidates->end()); 
    13401347} 
    13411348 
Note: See TracChangeset for help on using the changeset viewer.