Ignore:
Timestamp:
11/10/05 01:09:53 (19 years ago)
Author:
mattausch
Message:

fixed pvs bug in bsp view cells

Location:
trunk/VUT/GtpVisibilityPreprocessor
Files:
4 edited

Legend:

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

    r397 r399  
    5656 
    5757Sampling { 
    58         totalSamples    250000 
     58        totalSamples    100000 
    5959        samplesPerPass  3 
    6060} 
     
    8888        #       input fromViewCells 
    8989        #       input fromSceneGeometry 
    90                 samples 100000 
     90                samples 50000 
    9191                sideTolerance 0.005 
    9292        } 
     
    126126        #splitPlaneStrategy 130 
    127127         
    128         splitPlaneStrategy 1024 
     128        splitPlaneStrategy 8 
    129129         
    130         maxPolyCandidates 200 
     130        maxPolyCandidates 50 
    131131        maxRayCandidates 0 
    132132         
     
    134134                # autopartition 
    135135                maxRays 200 
    136                 maxPolygons 5 
     136                maxPolygons 20 
    137137                maxDepth 30 
    138                 minPvs 50 
     138                minPvs -1 
    139139                minArea -0.001 
    140140                 
     
    158158                exportSplits true 
    159159                # how much samples should be used in visualization 
    160                 samples 1000 
     160                samples 100000 
    161161        } 
    162162} 
  • trunk/VUT/GtpVisibilityPreprocessor/src/SamplingPreprocessor.cpp

    r396 r399  
    192192                         
    193193                        if (!ray.intersections.empty()) // second intersection found 
    194                                 { 
    195                                         sampleContributions +=  
    196                                                 AddObjectSamples(ray.intersections[0].mObject, ray); 
    197                                 } 
     194                        { 
     195                                sampleContributions +=  
     196                                        AddObjectSamples(ray.intersections[0].mObject, ray); 
     197                        } 
    198198                } 
    199199        } 
     
    475475                                        { 
    476476                                                ProcessBspViewCells(ray, 
    477                                                                                         object, 
     477                                                                                        reverseSample ? NULL : object, 
    478478                                                                                        faceIndex, 
    479479                                                                                        passContributingSamples, 
     
    907907 
    908908                        // export rays piercing this view cell 
    909                         exporter->ExportRays(vcRays[i], 1000, RgbColor(0, 1, 0)); 
     909                        exporter->ExportRays(vcRays[i], 10000, RgbColor(0, 1, 0)); 
    910910 
    911911                        m.mDiffuseColor = RgbColor(1, 0, 0); 
     
    981981 
    982982                        Exporter *exporter = Exporter::GetExporter(s); 
    983                         exporter->SetFilled(); 
    984  
    985                         ViewCellPvsMap::iterator it = vc->GetPvs().mEntries.begin(); 
    986  
     983                         
    987984                        exporter->SetFilled();//Wireframe(); 
    988985 
     
    1002999                        } 
    10031000 
    1004                         Debug << i << ": pvs size=" << (int)vc->GetPvs().GetSize() << endl; 
     1001                         
     1002                        Debug << i << ": pvs size=" << (int)vc->GetPvs().GetSize()  
     1003                                        << ", piercing rays=" << (int)vcRays[i].size() << endl; 
    10051004 
    10061005                         
    10071006                        // export rays piercing this view cell 
    1008                         exporter->ExportRays(vcRays[i], 10000, RgbColor(0, 1, 0)); 
    1009  
     1007                        exporter->ExportRays(vcRays[i], 1000, RgbColor(0, 1, 0)); 
     1008         
    10101009                        m.mDiffuseColor = RgbColor(1, 0, 0); 
    10111010                        exporter->SetForcedMaterial(m); 
    10121011 
     1012                        ViewCellPvsMap::const_iterator it, 
     1013                                it_end = vc->GetPvs().mEntries.end(); 
     1014 
    10131015                        // output PVS of view cell 
    1014                         for (; it != vc->GetPvs().mEntries.end(); ++ it)  
     1016                        for (it = vc->GetPvs().mEntries.begin(); it != it_end; ++ it)  
    10151017                        { 
    10161018                                Intersectable *intersect = (*it).first; 
    10171019                                if (!intersect->Mailed()) 
    10181020                                { 
     1021                                        Material m = RandomMaterial(); 
     1022                         
     1023                                        exporter->SetForcedMaterial(m); 
     1024 
    10191025                                        exporter->ExportIntersectable(intersect); 
    10201026                                        intersect->Mail(); 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.cpp

    r398 r399  
    274274                } 
    275275 
    276                 contribution += mViewCell->GetPvs().AddSample(ray->sourceObject.mObject); 
     276                if (ray->sourceObject.mObject) 
     277                        contribution += mViewCell->GetPvs().AddSample(ray->sourceObject.mObject); 
    277278 
    278279                if (contribution > 0) 
     
    281282                        ++ contributingSamples; 
    282283                } 
    283  
    284                 // warning: not ordered 
     284                // warning: intersections not ordered 
    285285                ray->bspIntersections.push_back(Ray::BspIntersection((*it)->mMinT, this)); 
    286286        } 
     
    13921392                                // assure that we only count a object  
    13931393                                // once for the front and once for the back side of the plane 
    1394                                 AddToPvs(*ray->intersections[0].mObject, frontData.mPvs, backData.mPvs,  
    1395                                                 cf, frontId, backId, frontAndBackId); 
     1394                                IncPvs(*ray->intersections[0].mObject, frontData.mPvs, backData.mPvs,  
     1395                                          cf, frontId, backId, frontAndBackId); 
    13961396                        } 
    13971397 
    13981398                        // the source object in the origin of the ray 
    1399                         AddToPvs(*ray->sourceObject.mObject, frontData.mPvs, backData.mPvs,  
    1400                                          cf, frontId, backId, frontAndBackId); 
     1399                        if (ray->sourceObject.mObject) 
     1400                        { 
     1401                                IncPvs(*ray->sourceObject.mObject, frontData.mPvs, backData.mPvs,  
     1402                                           cf, frontId, backId, frontAndBackId); 
     1403                        } 
    14011404 
    14021405                        // use #rays to approximate volume 
     
    14291432} 
    14301433 
    1431 void BspTree::AddToPvs(Intersectable &obj, 
    1432                                            int &frontPvs, 
    1433                                            int &backPvs, 
    1434                                            const int cf,  
    1435                                            const int frontId,  
    1436                                            const int backId,  
    1437                                            const int frontAndBackId) const 
     1434void BspTree::IncPvs(Intersectable &obj, 
     1435                                         int &frontPvs, 
     1436                                         int &backPvs, 
     1437                                         const int cf,  
     1438                                         const int frontId,  
     1439                                         const int backId,  
     1440                                         const int frontAndBackId) const 
    14381441{ 
    14391442        if (cf == Ray::COINCIDENT) //TODO: really belongs to no pvs? 
     
    23112314                        } 
    23122315                } 
    2313                 if (!ray->sourceObject.mObject->Mailed()) 
    2314                 { 
    2315                         ray->sourceObject.mObject->Mail(); 
    2316                         ++ pvsSize; 
     2316                if (ray->sourceObject.mObject) 
     2317                { 
     2318                        if (!ray->sourceObject.mObject->Mailed()) 
     2319                        { 
     2320                                ray->sourceObject.mObject->Mail(); 
     2321                                ++ pvsSize; 
     2322                        } 
    23172323                } 
    23182324        } 
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h

    r397 r399  
    730730        /** Computes the pvs of the front and back leaf with a given classification. 
    731731        */ 
    732         void AddToPvs(Intersectable &obj,  
     732        void IncPvs(Intersectable &obj,  
    733733                                  int &frontPvs, 
    734734                                  int &backPvs, 
Note: See TracChangeset for help on using the changeset viewer.