DiscussionsIssue archiveOCCT:Visualization

Archived issue #0024291

Visualization - move Z-buffer trihedron presentation from TKOpenGl to TKV3d

Open CASCADEOCCT:Visualizationclosed41 public notes

Search issues

Description

Seems more like a bug in OpenGl_Trihedron for perspective projection. OpenGl_Trihedron reuses orientation and projection matrix. It additionally makes matrix translation vectors equal to zero. Such an approach leads to loosing trihedron on the screen for perspective projection.

Normally, reuse of projection matrix for perspective projection would lead to perspective distortion of z-buffer Trihedron, which might differ for different locations of trihedron on the screen.

To evade unwanted distortion and steel keep perspective look of trihedron, it probably needs simply additional call of gl_viewport.

As seen on attached image correct perspective trihedron remains axes orientation and only have shrank line lengths relative to orthographic mode. While distorted trihedron do not represent actual view transformation.

Another possible solution is to leave trihedron to have only ortho projection as it may be seen in some commercial products.

Steps to reproduce

pload VISUALIZATION
pload MODELING
vinit
vgrid r l
vzbufftrihedron
vzoom 10
box b 0 -50 0 10 20 30
vdisplay b
vsetdispmode b 1

vchangecamera proj persp
vzoom 10

Public activity

41 archived notes

Participants are labeled by their role within this record.

01Commenter 1
Dear kgv,

Could you please review current solution?

Considering all arguments I decided to always use ortho projection for trihedron. Code is in branch CR24291.
02Commenter 3
I don't think that proposed solution provides natural results.
03Commenter 3
I agree that it would be better to show trihedron with axes directed in accordance with the local co-ordinate axes at the point where trihedron is located on the picture (i.e. "distorted"), even if it is an object living separately from the rest of the scene. After all, its purpose is to show directions of main axes of global CS. Naturally, the option can be provided allowing the user to choose either "perspective" or "axonometric" trihedron.
04Commenter 3
Dear duv,

I consider fixing general transformation persistence stuff at first step and then remove trihedron-specific computations by general logic.
Please see vsettransmode command and bug23120 (it seems bug23120_1 is exactly the same test and should be removed).

pload MODELING
pload VISUALIZATION
box b1 10 20 30
vinit
vdisplay b1
vsettransmode b1 32 0 0 -1 -1 0
vsetdispmode b1 1
vchangecamera proj persp
05Commenter 5
Dear all,

Please have a look at Attachment 1 (PNG) attached. Snapshot was taken using a third-party 3D visualization tool which is quite successful. Thus I believe both options are acceptable.

I downgrade the priority of this issue to low, not to distract resources from far more important issue #24001.
And I fully agree to rewrite z-buffered trihedron using common rendering scheme, rather than some highly specific sequence of OpenGL calls.
06Commenter 6
Requirement from #0024461 should be also considered, if possible.
07Commenter 4
Branch [archived branch] has been deleted by Commenter 3.

[revision removed]
08Commenter 4
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: isk
Date: Fri Jul 8 17:46:22 2016 +0300

    Refactoring

Author: isk
Date: Fri Jul 8 15:01:08 2016 +0300

    0024291: Visualization - Z-buffer trihedron is lost when switching to perspective projection
09Commenter 4
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
10Commenter 10
Rebase on the branch CR22582_4.
11Commenter 11
Dear Kirill,
please review the branch CR24291.
12Commenter 3
Note that unlike ColorScale, it is desired to keep V3d_View property for displaying static trihedron object - since it is widely used functionality and unnecessary complication of porting should be avoided.

Thus, presentation builder should be moved to general-purpose packages (Prs3d/StdPrs) and re-used in V3d-View and AIS_Trihedron.

13Commenter 4
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: isk
Date: Fri Jul 8 15:01:08 2016 +0300

    0024291: Visualization - Z-buffer trihedron is lost when switching to perspective projection
    Remove the next methods from Graphic3d_CView: TriedronDisplay, TriedronErase, ZBufferTriedronSetup, TriedronEcho.
    Delete OpenGl_Trihedron class.
    Add a new class V3d_Trihedron.
14Commenter 14
Dear Kirill,
Please review the branch CR24291_1.
15Commenter 4
Branch [archived branch] has been updated by Participant.

[revision removed]


Detailed log of new commits:

Author: isk
Date: Wed Oct 12 11:58:30 2016 +0300

    Fix remarks by Kirill.

16Commenter 4
Branch [archived branch] has been updated by Participant.

[revision removed]


Detailed log of new commits:

Author: isk
Date: Wed Oct 12 15:00:45 2016 +0300

    Drop redundant code

17Commenter 4
Branch [archived branch] has been created by Participant.

[revision removed]


No new revisions were added by this update.
18Commenter 4
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
19Commenter 4
Branch [archived branch] has been updated by Participant.

[revision removed]


Detailed log of new commits:

Author: isk
Date: Thu Oct 13 12:41:43 2016 +0300

    Fix remarks by Kirill.

20Commenter 4
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
21Commenter 21
Dear Kirill,
please review the branch CR24291_2.
22Commenter 4
Branch [archived branch] has been updated by Commenter 3.

[revision removed]


Detailed log of new commits:

Author: Commenter 3
Date: Thu Oct 13 23:27:50 2016 +0300

    Not implemented method V3d_View::TriedronEcho() and enum Aspect_TypeOfTriedronEcho have been removed.
    
    V3d_Trihedron - do not create structure before display.
    Define single-view Graphic3d_ViewAffinity directly.

23Commenter 4
Branch [archived branch] has been created by Commenter 3.

[revision removed]


Detailed log of new commits:

Author: isk
Date: Fri Jul 8 15:01:08 2016 +0300

    0024291: Visualization - move Z-buffer trihedron presentation from TKOpenGl to TKV3d
    
    Not implemented method V3d_View::TriedronEcho() and enum Aspect_TypeOfTriedronEcho have been removed.
    The following methods have been removed from Graphic3d_CView class:
    TriedronDisplay(), TriedronErase(), ZBufferTriedronSetup(), TriedronEcho().
    New class V3d_Trihedron has been added as replacement of removed OpenGl_Trihedron
    which now uses Graphic3d_TMF_TriedronPers persistence.
24Commenter 4
Branch [archived branch] has been updated forcibly by Commenter 3.

[revision removed]
25Commenter 3
Please test the patch in branches CR24291_3 (OCCT and Products).
26Commenter 4
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
27Commenter 27
Branches CR24291_3 from occt and products git-repositories have been rebased on the current masters
28Commenter 28
Dear Commenter 2,

Branch CR24291_3 from occt git-repository (and CR24291_3 from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested.
[revision removed]
[revision removed]

Number of compiler warnings:
occt component:
   Linux: 0 (0 on master)
   Windows: 0 (0 on master)
   MasOS: 0 (0 on master)
products component:
   Linux: 63
   Windows: 0
   MacOS: 1170

Regressions/Differences:
http://occt-tests/CR24291_3-CR24291_3-OCCT/Debian70-64/summary.html
http://occt-tests/CR24291_3-CR24291_3-OCCT/Windows-64-VC10/summary.html
bugs vis bug71, bug23225, bug25500, bug26424

Testing on Linux:
occt component:
Total MEMORY difference: 90392248 / 90569079 [-0.20%]
Total CPU difference: 19432.209999999977 / 19463.759999999937 [-0.16%]
products component:
Total MEMORY difference: 30090956 / 30069397 [+0.07%]
Total CPU difference: 5316.359999999972 / 5271.849999999968 [+0.84%]

Testing on Windows:
occt component:
Total MEMORY difference: 57222500 / 57250244 [-0.05%]
Total CPU difference: 17921.379279898712 / 18101.186032498666 [-0.99%]
products component:
Total MEMORY difference: 21302043 / 21265221 [+0.17%]
Total CPU difference: 5104.586721499955 / 5148.189000999964 [-0.85%]

There are differences in images found by testdiff:
http://occt-tests/CR24291_3-CR24291_3-OCCT/Debian70-64/diff-Debian70-64.html
http://occt-tests/CR24291_3-CR24291_3-OCCT/Windows-64-VC10/diff-Windows-64-VC10-image.html
v3d glsl msaa
v3d glsl tiles
v3d raytrace bug24819
bugs vis bug71
bugs vis bug26434
29Commenter 29
Dear Kirill,

Branches CR24291_3 from occt and products het-repositories have been rejected due to:
- regressions/differences/improvements
- differences in images
30Commenter 4
Branch [archived branch] has been updated by Commenter 3.

[revision removed]


Detailed log of new commits:

Author: Commenter 3
Date: Mon Oct 17 17:18:58 2016 +0300

    V3d_Trihedron - declare arrows default colors to Red/Green/Blue.
    Enable dummy texture mapping to disable environment texture map.
    V3d_Trihedron::TrihedronStructure has been defined for handling device lost.

31Commenter 4
Branch [archived branch] has been created by Commenter 3.

[revision removed]


Detailed log of new commits:

Author: isk
Date: Fri Jul 8 15:01:08 2016 +0300

    0024291: Visualization - move Z-buffer trihedron presentation from TKOpenGl to TKV3d
    
    Not implemented method V3d_View::TriedronEcho() and enum Aspect_TypeOfTriedronEcho have been removed.
    The following methods have been removed from Graphic3d_CView class:
    TriedronDisplay(), TriedronErase(), ZBufferTriedronSetup(), TriedronEcho().
    New class V3d_Trihedron has been added as replacement of removed OpenGl_Trihedron
    which now uses Graphic3d_TMF_TriedronPers persistence.
32Commenter 3
Please test updated patch in branch CR24291_4.
33Commenter 3
Sorry, a couple of test cases should be updated.
34Commenter 4
Branch [archived branch] has been updated forcibly by Commenter 3.

[revision removed]
35Commenter 3
Please test the patch.
36Commenter 36
Dear Commenter 2,

Branch CR24291_4 from occt git-repository (and CR24291_3 from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested.
[revision removed]
[revision removed]

Number of compiler warnings:
occt component:
   Linux: 0 (0 on master)
   Windows: 0 (0 on master)
   MasOS: 0 (0 on master)
products component:
   Linux: 63
   Windows: 0
   MacOS: 1133

Regressions/Differences:
Not detected

Testing on Linux:
occt component:
Total MEMORY difference: 90307296 / 90561844 [-0.28%]
Total CPU difference: 19484.48000000003 / 19463.559999999936 [+0.11%]
products component:
Total MEMORY difference: 30075861 / 30069397 [+0.02%]
Total CPU difference: 5323.709999999971 / 5271.849999999968 [+0.98%]

Testing on Windows:
occt component:
Total MEMORY difference: 57216554 / 57243619 [-0.05%]
Total CPU difference: 17947.727848798633 / 18100.624428898667 [-0.84%]
products component:
Total MEMORY difference: 21302040 / 21265221 [+0.17%]
Total CPU difference: 5084.47819259995 / 5148.189000999964 [-1.24%]
37Commenter 4
Branch [archived branch] has been deleted by Commenter 3.

[revision removed]
38Commenter 4
Branch [archived branch] has been deleted by Commenter 3.

[revision removed]
39Commenter 4
Branch [archived branch] has been deleted by Commenter 3.

[revision removed]
40Commenter 4
Branch [archived branch] has been deleted by Commenter 3.

[revision removed]
41Commenter 4
Branch [archived branch] has been deleted by Commenter 3.

[revision removed]

Related records