View Issue Details

IDProjectCategoryView StatusLast Update
0031341CommunityOCCT:Visualizationpublic2020-12-02 17:12
ReporterFrancoisLauzon Assigned Tobugmaster  
PrioritynormalSeveritymajor 
Status closedResolutionfixed 
PlatformVisual Studio 2017 / OCC 7.4.0OSWindows 
Product Version6.8.0 
Target Version7.5.0Fixed in Version7.5.0 
Summary0031341: Visualization - Graphic3d_Layer::UpdateCulling() ignores Presentation range
DescriptionFor some reason, when creating multiple point cloud, the creation of additional pointcloud will make previous pointcloud disappear.
The pointcloud could still be highlighted,but are not selectable anymore.

Frustum culling implemented via Graphic3d_Layer::UpdateCulling() has an error in BVH tree traverse code - BVH_Tree::EndPrimitive() is ignored.
Steps To Reproduce
pload MODELING VISUALIZATION
set aList {}
for {set i 0} {$i < 2000} {incr i} { box b$i 2000-$i 2000-$i 2000-$i; lappend aList b$i }
vclear
vinit View1
vtop
vdefaults -autoTriang 0
vdisplay -dispMode 0 {*}$aList
vfit
vzoom 0.9
set nbAll [vstatprofiler allstructs]
set nbRen [vstatprofiler structs]
if { $nbRen != $nbAll } { puts "Error: unexpected culling" }


Compile the attached sample (base on Qt and OCC 7.4.0).
The first step will load a series of pointcloud and use AIS_PointCloud to display them.
When clicking on the dialog box, a second file is loaded and additionnal AIS_PointCloud are created. Pointcloud from the first file will disappear but will remain selectable.

Creating 1 big point cloud will all those points is working fine, it's the creation of all those point cloud that is causing a display bug.



#include <AIS_PointCloud.hxx>
#include <Standard_ReadLineBuffer.hxx>
#include <OSD_OpenFile.hxx>

//! Read 3 float values.
static bool readVec3 (const char* thePos, char*& theNext, gp_Pnt& theVec)
{
  const char* aPos = thePos;
  theVec.SetX (Strtod (aPos, &theNext));
  aPos = theNext;
  theVec.SetY (Strtod (aPos, &theNext));
  aPos = theNext;
  theVec.SetZ (Strtod (aPos, &theNext));
  return aPos != theNext;
}

static void displayCloud (std::vector<gp_Pnt>& thePntList)
{
  if (thePntList.empty())
  {
    return;
  }

  Handle(TColgp_HArray1OfPnt) aPntArray = new TColgp_HArray1OfPnt (1, thePntList.size());
  for (int aPntIter = 0; aPntIter < thePntList.size(); ++aPntIter)
  {
    aPntArray->SetValue (aPntIter + 1, thePntList[aPntIter]);
  }
  thePntList.clear();

  static int aNbPrs = 0;
  Handle(AIS_PointCloud) aPrs = new AIS_PointCloud();
  aPrs->SetPoints (aPntArray);
  aPrs->SetDisplayMode (AIS_PointCloud::DM_Points);
  aPrs->SetHilightMode (AIS_PointCloud::DM_Points);
  aPrs->SetColor (Quantity_NOC_RED);
  ViewerTest::Display (TCollection_AsciiString("p") + (++aNbPrs), aPrs, AIS_PointCloud::DM_Points, false);
}

static void loadXYZ (const TCollection_AsciiString& thePath)
{
  std::ifstream aFile;
  OSD_OpenStream (aFile, thePath.ToCString(), std::ios::binary | std::ios::in);
  if (!aFile)
  {
    std::cerr << "Error: unable opening file '" << thePath << "'\n";
    return;
  }

  std::vector<gp_Pnt> aPntList;
  Standard_ReadLineBuffer aLineBuffer (4096);
  for (;;)
  {
    size_t aLineLen = 0;
    const char* aLine = aLineBuffer.ReadLine (aFile, aLineLen);
    if (aLine == NULL)
    {
      displayCloud (aPntList);
      return;
    }

    gp_Pnt aPnt;
    char* aNext = NULL;
    if (readVec3 (aLine, aNext, aPnt))
    {
      aPntList.push_back (aPnt);
    }
    else
    {
      displayCloud (aPntList);
    }
  }
}

static int VReadXYZ (Draw_Interpretor&, Standard_Integer theArgNb, const char** theArgVec)
{
  if (theArgNb != 2 || ViewerTest::GetAISContext().IsNull()) { return 1; }
  loadXYZ (theArgVec[1]);
  ViewerTest::GetAISContext()->UpdateCurrentViewer();
  return 0;
}


pload MODELING VISUALIZATION
vclear
vinit View1
vtop
vreadxyz ptcloud_file1.xyz
vreadxyz ptcloud_file2.xyz
vrenderparams -culling 0; # OK
vrenderparams -culling 1; # KO
TagsNo tags attached.
Test case numberbugs/vis/bug31341

Attached Files

  • AIS_PointCloud_bug.7z (4,186,187 bytes)
  • pntset_KO.png (2,583 bytes)
  • pntset_OK.png (2,103 bytes)
  • cull_KO.png (1,541 bytes)
  • cull_OK.png (1,362 bytes)

Relationships

child of 0024307 closedapn Open CASCADE TKOpenGl - efficient culling of large number of presentations 

Activities

FrancoisLauzon

2020-01-31 18:25

reporter  

AIS_PointCloud_bug.7z (4,186,187 bytes)

kgv

2020-01-31 23:03

developer  

pntset_KO.png (2,583 bytes)

kgv

2020-01-31 23:03

developer  

pntset_OK.png (2,103 bytes)

kgv

2020-02-01 00:30

developer  

cull_KO.png (1,541 bytes)

kgv

2020-02-01 00:31

developer  

cull_OK.png (1,362 bytes)

git

2020-02-01 00:54

administrator   ~0090247

Branch CR31341 has been created by kgv.

SHA-1: 173aa41dc64848af59ab8388016b1cba95cf3eab


Detailed log of new commits:

Author: kgv
Date: Sat Feb 1 00:50:04 2020 +0300

    0031341: Visualization - Graphic3d_Layer::UpdateCulling() ignores Presentation range
    
    Graphic3d_Layer::UpdateCulling() now takes into account BVH_Tree::EndPrimitive().
    'vstatprofiler structs' now properly prints number of structures in case of no culling.

kgv

2020-02-01 02:30

developer   ~0090248

Patch is ready for review.

http://jenkins-test-12.nnov.opencascade.com:8080/view/CR31341-master-KGV/

git

2020-02-09 12:38

administrator   ~0090428

Branch CR31341 has been updated forcibly by kgv.

SHA-1: 1227c74c411deb4cef14d4022a91970995703fbc

osa

2020-02-11 11:11

developer   ~0090465

The patch was reviewed without remarks

bugmaster

2020-02-12 13:54

administrator   ~0090491

Tested in framework of WEEK-7

Combination -
OCCT branch : WEEK-7
master SHA - ed81d053016438d0b36485eefa9da2a90616f824
fe4497f3246e6bc1ced97ac331c148f0809ded15
Products branch : WEEK-7 SHA - fa93736d0dfc60600eb038f1a228db0ca19b8500
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 16972.490000000067 / 16995.740000000096 [-0.14%]
Products
Total CPU difference: 11439.249999999975 / 11455.569999999962 [-0.14%]
Windows-64-VC14:
OCCT
Total CPU difference: 18436.9375 / 18439.6875 [-0.01%]
Products
Total CPU difference: 13329.09375 / 13351.46875 [-0.17%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

git

2020-02-23 12:25

administrator   ~0090651

Branch CR31341 has been deleted by inv.

SHA-1: 1227c74c411deb4cef14d4022a91970995703fbc

Related Changesets

occt: master a2803f37

2020-01-31 21:50:04

kgv


Committer: bugmaster Details Diff
0031341: Visualization - Graphic3d_Layer::UpdateCulling() ignores Presentation range

Graphic3d_Layer::UpdateCulling() now takes into account BVH_Tree::EndPrimitive().
'vstatprofiler structs' now properly prints number of structures in case of no culling.
Affected Issues
0031341
mod - src/Graphic3d/Graphic3d_Layer.cxx Diff File
mod - src/ViewerTest/ViewerTest_ViewerCommands.cxx Diff File
add - tests/bugs/vis/bug31341 Diff File

Issue History

Date Modified Username Field Change
2020-01-31 18:25 FrancoisLauzon New Issue
2020-01-31 18:25 FrancoisLauzon Assigned To => kgv
2020-01-31 18:25 FrancoisLauzon File Added: AIS_PointCloud_bug.7z
2020-01-31 22:54 kgv Steps to Reproduce Updated
2020-01-31 23:01 kgv Steps to Reproduce Updated
2020-01-31 23:02 kgv Steps to Reproduce Updated
2020-01-31 23:03 kgv File Added: pntset_KO.png
2020-01-31 23:03 kgv File Added: pntset_OK.png
2020-01-31 23:04 kgv Product Version => 7.4.0
2020-01-31 23:04 kgv Target Version => 7.5.0
2020-01-31 23:04 kgv Summary Creation of new pointcloud make previous one disappear => Visualization - Creation of new pointcloud make previous one disappear
2020-01-31 23:31 kgv Relationship added child of 0024307
2020-01-31 23:36 kgv Severity minor => major
2020-01-31 23:36 kgv Product Version 7.4.0 => 6.8.0
2020-01-31 23:36 kgv Summary Visualization - Creation of new pointcloud make previous one disappear => Visualization - Graphic3d_Layer::UpdateCulling() ignores Presentation range
2020-01-31 23:36 kgv Description Updated
2020-02-01 00:29 kgv Steps to Reproduce Updated
2020-02-01 00:30 kgv File Added: cull_KO.png
2020-02-01 00:31 kgv File Added: cull_OK.png
2020-02-01 00:54 git Note Added: 0090247
2020-02-01 02:30 kgv Note Added: 0090248
2020-02-01 02:30 kgv Assigned To kgv => osa
2020-02-01 02:30 kgv Status new => resolved
2020-02-09 12:38 git Note Added: 0090428
2020-02-11 11:11 osa Note Added: 0090465
2020-02-11 11:11 osa Assigned To osa => bugmaster
2020-02-11 11:11 osa Status resolved => reviewed
2020-02-12 13:54 bugmaster Note Added: 0090491
2020-02-12 13:54 bugmaster Status reviewed => tested
2020-02-12 13:57 bugmaster Test case number => bugs/vis/bug31341
2020-02-15 14:55 bugmaster Changeset attached => occt master a2803f37
2020-02-15 14:55 bugmaster Status tested => verified
2020-02-15 14:55 bugmaster Resolution open => fixed
2020-02-23 12:25 git Note Added: 0090651
2020-12-02 16:41 emo Fixed in Version => 7.5.0
2020-12-02 17:12 emo Status verified => closed