MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0024437Open CASCADE[OCCT] OCCT:Visualizationpublic2013-12-05 07:442018-05-23 13:53
Reportersan 
Assigned Toasl 
PrioritynormalSeverityfeature 
StatusfeedbackResolutionopen 
PlatformAOSLOS VersionL
Product Version[OCCT] 6.7.0 
Target Version[OCCT] 7.4.0*Fixed in Version 
Summary0024437: Visualization - silhouette edges based on OpenGL
DescriptionCurrently, OCCT runs rather heavy geometrical computations on CPU in order to compute hidden-line representation of an AIS_Shape object. And it works with bugs on some specific kinds of input shapes.

Normally, HLR output includes:
1. Visible face boundaries and visible free edges
2. Silhouette edges
3. Optionally, hidden face boundaries and free edges can be visualized using specific visual attributes (line stipple, different line color, etc.)

These visual results can be produced efficiently using OpenGL and/or GLSL.
Simple algorithms doing this seem to exist for a decade, see e.g. http://www.opengl.org/archives/resources/faq/technical/miscellaneous.htm#misc0010 [^]
A simple implementation is based on OpenGL fixed-pipeline functionality and includes three rendering passes:
a. Draw the shaded triangulation to depth buffer only (nothing drawn to the frame-buffer) with polygon offsets used to shift the depth values a bit farther from the eye. Polygon offsets are needed to avoid depth test artifacts at step (b) below.
b. Draw the face boundaries and stand-alone edges in normal mode (depth test enabled, frame-buffer writes enabled) - like this, all hidden stuff is removed by depth test.
c. Draw the triangulation in GL_LINE polygon mode, with thicker line width and polygon offsets used to shift produced depth values farther from the eye than for step (a) above. Like this, we produce the shape's silhouette.

Naturally, GLSL shaders can be used to produce HLR image of higher quality.

The main advantages of this approach are:
- Invariance with respect to the input geometry: as soon as OCCT is able to triangulate the shape, it can be displayed in HLR correctly.
- High performance and low CPU load: most of the work is done by the graphic card.

It is proposed to consider OpenGL-based HLR as replacement for the current implementation.

Extra references:
- Outline through Geometry Shader and adjacent triangles.
  http://prideout.net/blog/?tag=opengl-silhouette [^]
- Post processing on Geometry Buffer
  https://gamedev.stackexchange.com/questions/68401/how-can-i-draw-outlines-around-3d-models [^]

Implementation of shader should correspond to the idea of outline shader:
1. The first pass uses vertex shader to draw an "inflated" primitives (with given shift along the normal of given vertex); the color is black;
2. During the first pass only the back faces are drawn;
3. The second pass draws the primitives by a standard way (with color corresponding to the background); no inflation is applied;
4. During the second pass only the front faces are drawn;
5. The edges and other primitives (not triangles) are drawn "as is"
Steps To ReproduceThe new test case is implemented:

test bugs vis bug24437
TagsNo tags attached.
Test case number
Attached Filespng file icon hlr_2.png (18,975 bytes) 2018-05-18 14:49
png file icon hlr_1.png (34,107 bytes) 2018-05-21 09:55
png file icon cad_outliuned.png (63,038 bytes) 2018-05-22 21:38

- Relationships

-  Notes
(0075928)
git (administrator)
2018-05-10 16:40

Branch CR24437 has been created by asl.

SHA-1: d26d46876623b7e7eef24628412d4588db546e2b


Detailed log of new commits:

Author: asl
Date: Thu May 10 16:39:09 2018 +0300

    0024437: Efficient HLR visualization based on OpenGL and GLSL
    
    New interior style Aspect_IS_HLR is supported for Graphic3d_AspectFillAre3d.
    If this style is set, the triangles primitive array is drawn using the outline shader.
(0075930)
git (administrator)
2018-05-10 18:05

Branch CR24437 has been updated by asl.

SHA-1: 8b50b0dcbf1cdf41e22c0dd884f50e980692c9b2


Detailed log of new commits:

Author: asl
Date: Thu May 10 18:05:06 2018 +0300

    0024437: Efficient HLR visualization based on OpenGL and GLSL
    
    New interior style Aspect_IS_HLR is supported for Graphic3d_AspectFillAre3d.
    If this style is set, the triangles primitive array is drawn using the outline shader.

(0076014)
git (administrator)
2018-05-17 16:07

Branch CR24437 has been updated by asl.

SHA-1: 1f497002579d51251e68c9ddbc8b166d2a9a0dc1


Detailed log of new commits:

Author: asl
Date: Thu May 17 16:07:40 2018 +0300

    0024437: Efficient HLR visualization based on OpenGL and GLSL
    
    New interior style Aspect_IS_HLR is supported for Graphic3d_AspectFillAre3d.
    If this style is set, the triangles primitive array is drawn using the outline shader.

(0076015)
git (administrator)
2018-05-17 16:10

Branch CR24437_1 has been created by asl.

SHA-1: be999be67fd657c11d5352c8c055d53443c12971


Detailed log of new commits:

Author: asl
Date: Thu May 17 16:10:30 2018 +0300

    0024437: Efficient HLR visualization based on OpenGL and GLSL
    
    New interior style Aspect_IS_HLR is supported for Graphic3d_AspectFillAre3d.
    If this style is set, the triangles primitive array is drawn using the outline shader
(0076016)
git (administrator)
2018-05-17 17:02

Branch CR24437 has been updated by asl.

SHA-1: 6ede2957e74bec2ea5ee92f51590a1388629fbc7


Detailed log of new commits:

Author: asl
Date: Thu May 17 17:01:57 2018 +0300

    remove selection attributes

(0076017)
git (administrator)
2018-05-17 17:32

Branch CR24437 has been updated by asl.

SHA-1: d4a3b1f0ec8b0f0d03c4804ef8788a91fe9833e5


Detailed log of new commits:

Author: asl
Date: Thu May 17 17:04:39 2018 +0300

    optimization of vertex moving

(0076030)
git (administrator)
2018-05-18 10:48

Branch CR24437 has been updated by asl.

SHA-1: 48685e81e952cf88c17dd6465cbf34ddee967800


Detailed log of new commits:

Author: asl
Date: Fri May 18 10:48:31 2018 +0300

    debug of HLR presentation

(0076031)
git (administrator)
2018-05-18 10:50

Branch CR24437_1 has been updated forcibly by asl.

SHA-1: 0fb485f958927ddd624801413878cb0c1e8a8fec
(0076033)
asl (developer)
2018-05-18 10:56

The HLR presentation is implemented via the new interior style: Aspect_IS_HLR. When this style is applied to the primitive set of triangles then the outline shader is applied:

1. The first pass draws only back faces with applied shift along normals of faces and with the color of silhouette.
2. The second pass draw only the front faces without shift and with the color of background.
3. The silhouette color is taken from the edge color of the aspect fill area; the silhouette width is calculated on the base of edge width (may be a little incorrect for the projective camera).
(0076035)
kgv (developer)
2018-05-18 12:07

The screenshots demonstrating new feature should be attached to the bug.
(0076037)
git (administrator)
2018-05-18 14:50

Branch CR24437_1 has been updated forcibly by asl.

SHA-1: 2f2b107bff82157bb06c74da6b329cb06c5aafa5
(0076038)
abv (manager)
2018-05-18 15:39

Please consider renaming Aspect_IS_HLR to Aspect_IS_OUTLINE
(0076048)
git (administrator)
2018-05-21 09:50

Branch CR24437_1 has been updated forcibly by asl.

SHA-1: 0e06209cef6b5106c85092d852e764915a15f7b4
(0076049)
asl (developer)
2018-05-21 09:52

the item Aspect_IS_HLR is renamed to Aspect_IS_OUTLINE
(0076102)
git (administrator)
2018-05-22 16:19

Branch CR24437_1 has been updated by kgv.

SHA-1: d529e220616a4409723b3f03cdd87dd0df676b23


Detailed log of new commits:

Author: kgv
Date: Tue May 22 16:19:33 2018 +0300

    Aspect_InteriorStyle - added missing documentation to enum values.
    vsetinteriorstyle now alias to "vaspects -setInteriorStyle".

(0076104)
git (administrator)
2018-05-22 18:43

Branch CR24437_1 has been updated by kgv.

SHA-1: 65c443cf1660db961784fee00a9f618ff51e60b2


Detailed log of new commits:

Author: kgv
Date: Tue May 22 18:43:46 2018 +0300

    # OpenGl_ShaderManager - do not use non-standard vertex attribute normal.
    # Define occIsSilhouettePass as int.

(0076107)
git (administrator)
2018-05-22 20:16

Branch CR24437_1 has been updated by kgv.

SHA-1: bbb6df24bf7a83ab7923c2f46ab3fdec5382a833


Detailed log of new commits:

Author: kgv
Date: Tue May 22 20:16:31 2018 +0300

    # eliminated redundant 3rd rendering pass
    # fixed Perspective projection
    # simplified SILHOUETTE shader program
    # disable Color buffer writes for interior (only SILHOUETTE fills color),
    # so that there is no need to pass background color (gradient works automatically)

(0076108)
git (administrator)
2018-05-22 20:27

Branch CR24437_1 has been updated forcibly by kgv.

SHA-1: e5e77394e82c9dc945840377b0cf968d023d316f
(0076109)
git (administrator)
2018-05-22 21:37

Branch CR24437_1 has been updated by kgv.

SHA-1: 1d5f48c0f8576b9807144d389076fe542ab7931b


Detailed log of new commits:

Author: kgv
Date: Tue May 22 21:37:45 2018 +0300

    vsetedgetype has been extended with -width option.

(0076110)
git (administrator)
2018-05-22 21:41

Branch CR24437_2 has been created by kgv.

SHA-1: 3c713e1989db463ad4cf360e8462a43f0721e0e7


Detailed log of new commits:

Author: asl
Date: Thu May 17 16:10:30 2018 +0300

    0024437: Visualization - silhouette edges based on OpenGL
    
    New interior styles Aspect_IS_OUTLINE and Aspect_IS_OUTLINED_SOLID have been introduced.
    If this style is set, the triangles primitive array is drawn using the outline shader.
    
    vsetinteriorstyle now alias to "vaspects -setInteriorStyle".
    vsetedgetype has been extended with -width option.
(0076111)
kgv (developer)
2018-05-22 21:42

Dear Sergey,

could you please take a look onto the patch with my modifications?
(0076118)
kgv (developer)
2018-05-23 08:27

Alexander,

when you are adding a test case, it should either perform some checks to print KO,
or to dump images for visual comparison (or both).

http://occt-tests/CR24437_2-master-KGV-OCCT/Debian70-64/bugs/vis/bug24437.html [^]
(0076127)
git (administrator)
2018-05-23 10:25

Branch CR24437_2 has been updated by kgv.

SHA-1: ff620cebd5f69c457eca839d06a878871d055fe3


Detailed log of new commits:

Author: kgv
Date: Wed May 23 10:24:36 2018 +0300

    # fix regression with vsetinteriorstyle hatch; added image dump to the test

(0076133)
git (administrator)
2018-05-23 10:54

Branch CR24437_2 has been updated by kgv.

SHA-1: 3c723f1fe810a204aeb67162e5b65af7a016cb9e


Detailed log of new commits:

Author: kgv
Date: Wed May 23 10:53:58 2018 +0300

    # fill background color

(0076134)
git (administrator)
2018-05-23 10:54

Branch CR24437_3 has been created by kgv.

SHA-1: 5ac1eae43c8b5fb2930666faf178e67e6dff7555


Detailed log of new commits:

Author: asl
Date: Thu May 17 16:10:30 2018 +0300

    0024437: Visualization - silhouette edges based on OpenGL
    
    New interior styles Aspect_IS_OUTLINE and Aspect_IS_OUTLINED_SOLID have been introduced.
    If this style is set, the triangles primitive array is drawn using the outline shader.
    
    vsetinteriorstyle now alias to "vaspects -setInteriorStyle".
    vsetedgetype has been extended with -width option.
(0076154)
san (developer)
2018-05-23 12:15

Is the implemented HLR algorithm intended for usage with outline width > 1?
See cad_outliuned.png attached - it does not seem to work.
Can you please consider a possible improvement - else outline width should always be clamped to 1 in the current version.

- Issue History
Date Modified Username Field Change
2013-12-05 07:44 san New Issue
2013-12-05 07:44 san Assigned To => san
2018-05-10 16:03 kgv Relationship added has duplicate 0029752
2018-05-10 16:40 git Note Added: 0075928
2018-05-10 18:05 git Note Added: 0075930
2018-05-10 19:53 san Assigned To san => asl
2018-05-10 19:53 san Status new => assigned
2018-05-17 16:07 git Note Added: 0076014
2018-05-17 16:10 git Note Added: 0076015
2018-05-17 17:02 git Note Added: 0076016
2018-05-17 17:32 git Note Added: 0076017
2018-05-18 10:48 git Note Added: 0076030
2018-05-18 10:50 git Note Added: 0076031
2018-05-18 10:56 asl Note Added: 0076033
2018-05-18 10:56 asl Assigned To asl => san
2018-05-18 10:56 asl Status assigned => resolved
2018-05-18 10:56 asl Steps to Reproduce Updated View Revisions
2018-05-18 11:23 asl Assigned To san => kgv
2018-05-18 12:06 kgv Summary Efficient HLR visualization based on OpenGL and GLSL => Visualization - Efficient HLR visualization based on OpenGL and GLSL
2018-05-18 12:07 kgv Note Added: 0076035
2018-05-18 12:07 kgv Assigned To kgv => asl
2018-05-18 12:07 kgv Priority low => normal
2018-05-18 12:07 kgv Status resolved => feedback
2018-05-18 12:07 kgv Target Version => 7.4.0*
2018-05-18 14:49 asl File Added: hlr_1.png
2018-05-18 14:49 asl File Added: hlr_2.png
2018-05-18 14:50 git Note Added: 0076037
2018-05-18 14:51 asl Assigned To asl => kgv
2018-05-18 14:51 asl Status feedback => resolved
2018-05-18 15:39 abv Note Added: 0076038
2018-05-18 16:35 kgv Relationship added related to 0029787
2018-05-21 09:50 git Note Added: 0076048
2018-05-21 09:52 asl Note Added: 0076049
2018-05-21 09:55 asl File Deleted: hlr_1.png
2018-05-21 09:55 asl File Added: hlr_1.png
2018-05-22 15:10 san Relationship added related to 0029801
2018-05-22 16:19 git Note Added: 0076102
2018-05-22 18:43 git Note Added: 0076104
2018-05-22 20:00 kgv Description Updated View Revisions
2018-05-22 20:02 kgv Description Updated View Revisions
2018-05-22 20:16 git Note Added: 0076107
2018-05-22 20:27 git Note Added: 0076108
2018-05-22 21:05 kgv Summary Visualization - Efficient HLR visualization based on OpenGL and GLSL => Visualization - silhouette edges based on OpenGL
2018-05-22 21:37 git Note Added: 0076109
2018-05-22 21:38 kgv File Added: cad_outliuned.png
2018-05-22 21:41 git Note Added: 0076110
2018-05-22 21:42 kgv Note Added: 0076111
2018-05-22 21:42 kgv Assigned To kgv => san
2018-05-23 08:27 kgv Note Added: 0076118
2018-05-23 10:25 git Note Added: 0076127
2018-05-23 10:54 git Note Added: 0076133
2018-05-23 10:54 git Note Added: 0076134
2018-05-23 12:15 san Note Added: 0076154
2018-05-23 12:15 san Assigned To san => asl
2018-05-23 12:15 san Status resolved => feedback
2018-05-23 13:50 kgv File Added: solidworks-heads-up-view-toolbar-display-style-example-window.jpg
2018-05-23 13:50 kgv File Deleted: solidworks-heads-up-view-toolbar-display-style-example-window.jpg
2018-05-23 13:53 kgv Description Updated View Revisions


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker