MantisBT
Mantis Bug Tracker Workflow

View Revisions: Issue #24437 All Revisions ] Back to Issue ]
Summary 0024437: Visualization - silhouette edges based on OpenGL
Revision 2018-05-23 13:53 by kgv
Description Currently, 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"
Revision 2018-05-22 20:02 by kgv
Description Currently, 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 [^]
Revision 2018-05-22 20:00 by kgv
Description Currently, 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 [^]
Revision 2013-12-05 07:44 by san
Description Currently, 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.


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker