DiscussionsIssue archiveOCCT:Visualization

Archived issue #0025675

Visualization - Fix problems and inefficiencies with frustum culling

Open CASCADEOCCT:Visualizationclosed16 public notes

Search issues

Description

Potential problems in method:

OpenGl_BVHTreeSelector::Intersect (const OpenGl_Vec4& theMinPt, const OpenGl_Vec4& theMaxPt)

There are a few places like this:

aFrustumProjMax = myMaxOrthoProjectionPts[0] - DotProduct (OpenGl_Vec4 (1.0f, 0.0f, 0.0f, 1.0f), theMinPt);
aFrustumProjMin = myMinOrthoProjectionPts[0] - DotProduct (OpenGl_Vec4 (1.0f, 0.0f, 0.0f, 1.0f), theMinPt);

In such places homogenios coords are used, thus SAT directions must have W = 0 (not 1.0):

DotProduct (OpenGl_Vec4 (1.0f, 0.0f, 0.0f, 0.0f), theMinPt)

This leads to diffierent result of DOT functiom (extra 1.0).

Moreover, it is inefficient to use DOT here, because

DOT (vec (1, 0, 0, 0), V) = V.x
DOT (vec (0, 1, 0, 0), V) = V.y
DOT (vec (0, 0, 1, 0), V) = V.z

So it is better to eliminate all DOTs to achieve higher performance.

Another shadow point is in traverse function:

      if (theSelector.Intersect (aBVHTree->MinPoint (aNode),
                                 aBVHTree->MaxPoint (aNode)))
      {
        Standard_Integer aIdx = aBVHTree->BegPrimitive (aNode);
        myBVHPrimitives.GetStructureById (aIdx)->MarkAsNotCulled();
        if (aHead < 0)
        {
          return;
        }

        aNode = aStack[aHead];
        --aHead;
      }

Why do we need to ckeck intersection here? All intersections were checked on previous steps.

Steps to reproduce

not required

Public activity

16 archived notes

Participants are labeled by their role within this record.

01Commenter 3
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: vpa
Date: Mon Jan 12 18:08:42 2015 +0300

    0025675: Visaulization - Fix problems and inefficiencies with frustum culling
    
    Removed unnecessary overlap check in traverse of priority list items;
    Slight optimization of calculations in overlap detection methods in OpenGl_BVHTreeSelector
02Commenter 3
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
03Commenter 3
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
04Commenter 3
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
05Commenter 5
Dear Denis,

the patch in branch CR25675 is ready to be reviewed.

For performance comparsion results please see the attached file Attachment 2 (XLS).
06Commenter 3
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
07Commenter 3
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
08Commenter 3
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
09Commenter 9
Dear Denis,

the patch in branch CR25675 was corrected according to your remarks and is ready to be reviewed.

For new performance comparsion results please see the attached file Attachment 1 (XLS).
10Commenter 3
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
11Commenter 11
Dear Commenter 1,

please test the patch.
12Commenter 3
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
13Commenter 13
Dear Commenter 1,
Branch CR25675 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
[revision removed]

Number of compiler warnings:

occt component :
Linux: 18 (18 on master)
Windows: 0 (0 on master)

products component :
Linux: 11 (11 on master)
Windows: 1 (1 on master)

Regressions/Differences:
No regressions/differences

Testing cases:
Not needed

Testing on Linux:
occt component :
Total MEMORY difference: 369741952 / 370076844
Total CPU difference: 54165.1500000001 / 49863.81000000002
products component :
Total MEMORY difference: 110349192 / 110236384
Total CPU difference: 15863.469999999978 / 15774.329999999973

Testing on Windows:
occt component :
Total MEMORY difference: 276104008 / 276284192
Total CPU difference: 34660.28125 / 36894.109375
products component :
Total MEMORY difference: 53810528 / 53717872
Total CPU difference: 8116.5 / 10071.46875

There are no differences in images found by testdiff.
14Commenter 3
Branch [archived branch] has been deleted by Commenter 4.

[revision removed]
15Commenter 3
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: nbv
Date: Fri Oct 9 13:28:20 2015 +0300

    0026675: Eliminate normalization of coordinates in ApproxInt package
    
    Normalization has been eliminated.
    
    Additionally,
    1. Some methods of AppDef_Compute and ApproxInt_MultiLine classes have become inline (for speeding up performance).
    2. Interfaces of AppDef_Compute::Parametrization(...) and BRepAlgo_BooleanOperations::SetApproxParameters() methods have been changed.
    3. Overloaded methods for ApproxInt_Approx::SetParameters(...), TopOpeBRepTool_GeomTool::GetTolerances(...) and TopOpeBRepTool_GeomTool::SetTolerances(...) have been removed (because some fields of these classes are not used more).
    4. Lost comments have been added in BRepApprox_TheMultiLineOfApprox.hxx and GeomInt_TheMultiLineOfWLApprox.hxx files.
    5. Some fields have been deleted from ApproxInt_MultiLine class. Kept members have become constant.
    6. Interface of ksection DRAW-command has been changed.
    7. Some code fragments have been rewritten to make them easier.
    8. Function CleanWline(...) has been added in IntPatch_Intersection.cxx file. See comments in code for detail description.
    
    Adjusting some test case according to their new behavior.
16Commenter 3
Branch [archived branch] has been deleted by Commenter 4.

[revision removed]

Related records