MantisBT
Mantis Bug Tracker Workflow

View Revisions: Issue #29076 All Revisions ] Back to Issue ]
Summary 0029076: Visualization - implement element shrinking Shader
Revision 2019-02-20 22:26 by kgv
Additional information
and documentation updates
Displaying mesh edges is a common approach in mesh structure analysis and in visualization debugging task.

There are 3 possible implementations:
1) glPolygonMode(), unavailable on OpenGL ES.
2) filling dedicated GL_LINES array.
3) GLSL program.

Historically OCCT provides Aspect_IS_HOLLOW interior style for this purpose, which was implemented as glPolygonMode(GL_FRONT_AND_BACK, GL_LINE).
Each solution has its cons and pros:

1) glPolygonMode.
CONS:
- Unavailable on OpenGL ES.
- Fixed line width (1 pixel) on OpenGL, Core Profile.
- Rendering interior + mesh edges requires 2 passes.
- Hardware might render edges shared between triangle twice, reducing performance.
- Wide lines are rendered with visual artifacts.
- Triangles only.
PROS:
- Easy to switch on.
- Line width in pixels.

2) Dedicated GL_LINES array.
CONS:
- Extra memory footprint for additional data.
- Presentation data should be recomputed.
- The same limitations with line width as glPolygonMode
  (1 pixel width with Core Profile, visual artifacts on wide lines).
PROS:
- Better performance than glPolygonMode(),
  because only unique triangle edges are drawn.
- Can be computed for arbitrary polygons (triangles/quads/polygons).

3) GLSL program.
CONS:
- Requires Geometry Shader stage,
  which is available only since OpenGL ES 3.2+ and OpenGL 3.2+,
  and executed considerably slow on hardware
  (even dummy pass-through Geometry Shader drops performance).
- Variable line width,
  becoming twice thicker on edges shared between triangles.
- Visually hollow presentation without AntiAliasing
  might look not that good as normal GL_LINES.
PROS:
- Arbitrary line width,
  no limitation within Core Profile,
  no artifacts on wide lines.
- Variable line width,
  becoming thinner at large camera distance;
  this avoids mesh becoming a solid mess at distance.
- Rendering interior + mesh edges presentation in single pass.
- Shrinking element presentation (as transparent mesh edges).
- Triangles and quads edges;
  quads should be split into triangles in specific edges order.
- Switching on the fly without recomputing presentation,
  as in case of glPolygonMode().
- Smooth mesh edges on top of interior without AntiAliasing.

This patch implements and enables 3rd approach by default, providing a good compromise between performance, functionality and simplicity to activate.
glPolygonMode() remains available on desktop OpenGL and can be enabled via OpenGl_Caps::usePolygonMode, while 2nd approach should be implemented at application level.
Revision 2019-02-20 22:24 by kgv
Additional information
and documentation updates
Displaying mesh edges is a common approach in mesh structure analysis and in visualization debugging task.

There are 3 possible implementations:
1) glPolygonMode(), unavailable on OpenGL ES.
2) filling dedicated GL_LINES array.
3) GLSL program.

Historically OCCT provides Aspect_IS_HOLLOW interior style for this purpose, which was implemented as glPolygonMode(GL_FRONT_AND_BACK, GL_LINE).
Each solution has its cons and pros:

1) glPolygonMode.
CONS:
- Unavailable on OpenGL ES.
- Fixed line width (1 pixel) on OpenGL, Core Profile.
- Rendering interior + mesh edges requires 2 passes.
- Hardware might render edges shared between triangle twice, reducing performance.
- Wide lines are rendered with visual artifacts.
- Triangles only.
PROS:
- Easy to switch on.
- Line width in pixels.

2) Dedicated GL_LINES array.
CONS:
- Extra memory footprint for additional data.
- Presentation data should be recomputed.
- The same limitations with line width as glPolygonMode
  (1 pixel width with Core Profile, visual artifacts on wide lines).
PROS:
- Better performance than glPolygonMode(),
  because only unique triangle edges are drawn.
- Can be computed for arbitrary polygons (triangles/quads/polygons).

3) GLSL program.
CONS:
- Requires Geometry Shader stage,
  which is available only since OpenGL ES 3.2+ and OpenGL 3.2+,
  and executed considerably slow on hardware
  (even dummy pass-through Geometry Shader drops performance).
- Variable line width,
  becoming twice thicker on edges shared between triangles.
- Visually hollow presentation without AntiAliasing
  might look not that good as normal GL_LINES.
PROS:
- Arbitrary line width,
  no limitation within Core Profile,
  no artifacts on wide lines.
- Variable line width,
  becoming thinner at large camera distance;
  this avoids mesh becoming a solid mess at distance.
- Rendering interior + mesh edges presentation in single pass.
- Shrinking element presentation (as transparent mesh edges).
- Triangles and quads edges.
- Switching on the fly without recomputing presentation
  (as in case of glPolygonMode).
- Smooth mesh edges on top of interior without AntiAliasing.

This patch implements and enables 3rd approach by default, providing a good compromise between performance, functionality and simplicity to activate.
glPolygonMode() remains available on desktop OpenGL and can be enabled via OpenGl_Caps::usePolygonMode, while 2nd approach should be implemented at application level.
Revision 2019-02-20 22:23 by kgv
Additional information
and documentation updates
Displaying mesh edges is a common approach in mesh structure analysis and in visualization debugging task.

There are 3 possible implementations:
1) glPolygonMode(), unavailable on OpenGL ES.
2) filling dedicated GL_LINES array.
3) GLSL program.

Historically OCCT provides Aspect_IS_HOLLOW interior style for this purpose, which was implemented as glPolygonMode(GL_FRONT_AND_BACK, GL_LINE).
Each solution has its cons and pros:

1) glPolygonMode.
CONS:
- Unavailable on OpenGL ES.
- Fixed line width (1 pixel) on OpenGL, Core Profile.
- Rendering interior + mesh edges requires 2 passes.
- Hardware might render edges shared between triangle twice, reducing performance.
- Wide lines are rendered with visual artifacts.
- Triangles only.
PROS:
- Easy to switch on.
- Line width in pixels.

2) Dedicated GL_LINES array.
CONS:
- Extra memory footprint for additional data.
- Presentation data should be recomputed.
- The same limitations with line width as glPolygonMode
  (1 pixel width with Core Profile, visual artifacts on wide lines).
PROS:
- Better performance than glPolygonMode(),
  because only unique triangle edges are drawn.
- Can be computed for arbitrary polygons (triangles/quads/polygons).

3) GLSL program.
CONS:
- Requires Geometry Shader stage,
  which is available only since OpenGL ES 3.2+ and OpenGL 3.2+,
  and executed considerably slow on hardware
  (even dummy pass-through Geometry Shader drops performance).
- Variable line width,
  becoming twice thicker on edges shared between triangles.
- Visually hollow presentation without AntiAliasing
  might look not that good as normal GL_LINES.
PROS:
- Arbitrary line width,
  no limitation within Core Profile,
  no artifacts on wide lines.
- Variable line width,
  becoming thinner at large camera distance;
  this avoids mesh becoming a solid mess at distance.
- Rendering interior + mesh edges presentation in single pass.
- Shrinking element presentation (as transparent mesh edges).
- Triangles and quads edges.
- Switching on the fly without recomputing presentation
  (as in case of glPolygonMode).
- Smooth mesh edges on top of interior without AntiAliasing.

This patch implements and enables 3rd approach by default (glPolygonMode() remains available on desktop OpenGL and can be enabled via OpenGl_Caps::usePolygonMode, while 2nd approach should be implemented at application level), providing a good compromise between performance, functionality and simplicity to activate.
Revision 2017-09-02 22:55 by kgv
Additional information
and documentation updates


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker