View Issue Details

IDProjectCategoryView StatusLast Update
0031798Open CASCADEOCCT:Visualizationpublic2024-03-25 12:56
Reporterkgv Assigned Tomzernova  
PrioritynormalSeverityminor 
Status resolvedResolutionopen 
Product Version7.4.0 
Target Version7.8.1 
Summary0031798: Visualization, SelectMgr_ViewerSelector - fix comparing depth of direct and indirect triangle hits
DescriptionCurrently, SelectMgr_ViewerSelector sorts picking results basing on a depth along the ray (direct hit) or distance from eye to the closest point within the picking tolerance (indirect hit). In some cases, depth to indirect hit of a surface behind might become closer than distance to direct hit of a surface in front, leading to awkward picking results.

It is proposed to compute the smallest depth always considering picking tolerance, while keeping direct hit as result 3D point.

In addition, it might be reasonable allowing a 0 tolerance for triangulation sensitivities. In this case, selection volume will be implicitly upscaled to 1px, but indirect picking results will be rejected (only direct hits allowed).
Steps To Reproduce
pload MODELING VISUALIZATION
box b1 0 0 0 100  90 1
box b2 0 0 1 100 100 1
vinit View1
vdisplay -dispMode 1 b1
vdisplay -dispMode 1 b2 -highmode 1
vsetcolor b1 RED4
vsetcolor b2 GREEN4
vfit
vselprops -pixTol 10

vselprops -pixTol 100


vselprops -pixTol 2
vselprops -depthTol uniformpx 0.1
vviewparams -scale 2.28866 -proj 0.57735 -0.57735 0.57735 -up -0.408248 0.408248 0.816497 -at 24.7467 48.7768 25.0301
vmoveto 220 231
vstate -entities
TagsNo tags attached.
Test case number

Attached Files

  • occt_pick_surf_behind.png (38,761 bytes)
  • occt_pick_vert_behind.png (53,132 bytes)
  • 0031798.png (26,910 bytes)
  • 0031798_1.png (209,461 bytes)
  • Engine V Twin Revision 02 Simplified.step (972,035 bytes)
  • Detection_KO.png (8,340 bytes)
  • Detection_OK.png (13,023 bytes)

Relationships

related to 0031701 closedbugmaster Open CASCADE Visualization, SelectMgr_ViewerSelector - make depth tolerance configurable 

Activities

kgv

2020-09-27 12:31

developer  

occt_pick_surf_behind.png (38,761 bytes)

kgv

2020-09-27 12:31

developer  

occt_pick_vert_behind.png (53,132 bytes)

git

2020-09-27 12:39

administrator   ~0095357

Branch CR31798_1 has been created by kgv.

SHA-1: b9513dc178fc229cd8398901920e3b1b54460d8f


Detailed log of new commits:

Author: kgv
Date: Sun Sep 27 12:42:10 2020 +0300

    0031798: Visualization, SelectMgr_ViewerSelector - fix comparing depth of direct and indirect triangle hits
    
    SelectMgr_RectangularFrustum now stores also a distance from picking Ray within SelectBasics_PickResult
    to better prioritize results and prefer entities closer to ray.

git

2020-11-17 08:31

administrator   ~0096807

Branch CR31798_2 has been created by age.

SHA-1: 6367fbdb3c085e3f9c82ea1aafedbedb6755678b


Detailed log of new commits:

Author: age
Date: Mon Nov 16 14:53:07 2020 +0300

    0031798: Visualization, SelectMgr_ViewerSelector - fix comparing depth of direct and indirect triangle hits

age

2020-11-17 08:32

developer  

0031798.png (26,910 bytes)

age

2020-11-17 08:32

developer  

0031798_1.png (209,461 bytes)

age

2020-11-17 08:40

developer   ~0096808

In the branch CR31798_2 a new algorithm of depth calculation for triangles was implemented, It computes the nearest distance between projected on the triangle plane camera eye and intersected area of triangle and camera frustum. In most cases it works correctly but when the camera frustum is bigger than triangle (as in attached image 0031798.png) it gives incorrect result.

age

2020-11-17 08:41

developer  

Engine V Twin Revision 02 Simplified.step (972,035 bytes)

osa

2021-01-15 12:20

developer   ~0098130

Last edited: 2021-01-15 12:21

Algorithm implemented in branch CR31798_2 has better results in some cases. But on for "zoomed-out" objects there are incorrect results of detection even for big triangles.
Use the next steps to reproduce:

pload MODELING VISUALIZATION
box b1 0 0 0 100 90 1
box b2 0 0 1 100 100 1
vinit View1
vdisplay -dispMode 1 b1
vdisplay -dispMode 1 b2 -highmode 1
vaspects b1 -drawEdges 1
vaspects b2 -drawEdges 1
vsetcolor b1 RED4
vsetcolor b2 GREEN4
vfit
vselprops -pixTol 10

See results on different zoom - Detection_OK.png and Detection_KO.png

osa

2021-01-15 12:21

developer  

Detection_KO.png (8,340 bytes)

osa

2021-01-15 12:21

developer  

Detection_OK.png (13,023 bytes)

git

2023-09-29 13:42

administrator   ~0114326

Branch CR31798_3 has been created by drochalo.

SHA-1: 8bc5b0f89e83b8463d502bb67f9e1f2e033049f2


Detailed log of new commits:

Author: drochalo
Date: Fri Sep 29 11:38:49 2023 +0100

    0031798: Visualization, SelectMgr_ViewerSelector - fix comparing depth of direct and indirect triangle hits
    
    Added bias to the depth test made for indirect hits.

git

2023-10-03 11:53

administrator   ~0114367

Branch CR31798_3 has been updated by drochalo.

SHA-1: 514d047df7eb4a4c3fe94d661ca6f32e5687dff5


Detailed log of new commits:

Author: drochalo
Date: Tue Oct 3 09:52:42 2023 +0100

     0031798: Visualization, SelectMgr_ViewerSelector - fix comparing depth of direct and indirect triangle hits
    
    Replaced bias approach to depth test criterion to instead use bool that marks if a hit was direct or not. The bool is used in processing elements and in matching methods.

drochalo

2023-10-03 15:59

developer   ~0114368

The changes made solve the issue at hands but produced some differences in other test cases. Please review if additional changes are necessary.
Link to test: http://jenkins-test-10.nnov.opencascade.com/view/CR31798_3-master-drochalo/

Issue History

Date Modified Username Field Change
2020-09-27 12:31 kgv New Issue
2020-09-27 12:31 kgv Assigned To => kgv
2020-09-27 12:31 kgv Relationship added related to 0031701
2020-09-27 12:31 kgv File Added: occt_pick_surf_behind.png
2020-09-27 12:31 kgv File Added: occt_pick_vert_behind.png
2020-09-27 12:32 kgv Steps to Reproduce Updated
2020-09-27 12:35 kgv Description Updated
2020-09-27 12:39 git Note Added: 0095357
2020-11-12 12:01 kgv Assigned To kgv => age
2020-11-12 12:01 kgv Status new => assigned
2020-11-17 08:31 git Note Added: 0096807
2020-11-17 08:32 age File Added: 0031798.png
2020-11-17 08:32 age File Added: 0031798_1.png
2020-11-17 08:40 age Note Added: 0096808
2020-11-17 08:41 age File Added: Engine V Twin Revision 02 Simplified.step
2021-01-15 12:20 osa Note Added: 0098130
2021-01-15 12:21 osa File Added: Detection_KO.png
2021-01-15 12:21 osa File Added: Detection_OK.png
2021-01-15 12:21 osa Note Edited: 0098130
2021-08-24 14:19 kgv Target Version 7.6.0 => 7.7.0
2022-08-17 11:57 kgv Target Version 7.7.0 => 7.8.0
2023-08-01 15:09 dpasukhi Target Version 7.8.0 => Unscheduled
2023-09-21 17:48 ebelouso Assigned To age => drochalo
2023-09-28 18:59 drochalo Target Version Unscheduled => 7.8.0
2023-09-29 13:42 git Note Added: 0114326
2023-10-03 11:53 git Note Added: 0114367
2023-10-03 15:59 drochalo Assigned To drochalo => mzernova
2023-10-03 15:59 drochalo Status assigned => feedback
2023-10-03 15:59 drochalo Note Added: 0114368
2024-03-25 12:56 dpasukhi Status feedback => resolved
2024-03-25 12:56 dpasukhi Target Version 7.8.0 => 7.8.1