MantisBT
Mantis Bug Tracker Workflow

View Revisions: Issue #21753 All Revisions ] Back to Issue ]
Summary 0021753: Visualization - improve shaded display of conical objects
Revision 2013-08-30 17:57 by abv
Description Shading of truncated conical objects in OCC viewer looks as if Gouraud shading
was not applied: edges between triangles are very visible due to sharp change
of reflected color. See attached image (shaded_cone.gif).

Note that in case of cylinder (or even cone very close to cylinder) shading is
very nice and smooth (see shaded_cylinrdical_cone.gif).

Also shading is smooth for most of the surface of complete cone, though it is
bad on its seam (see shaded_complete_cone.gif).

Here are DRAW commands to create test cones shown on pictures:

- Truncated cone:
Draw{}> pcone p 1 100 100

- Cylindrical cone:
Draw[]> pcone p 99 100 100

- Complete cone:
Draw[] pcone p 0 100 100

The problem is clearly connected with the fact that normals at the corners of
the triangles (used for smoothing) are not taken from the surface but computed
somehow like by averaging normals of each two neighboring triangles. In the
case of truncated cone well-shaped triangles are alternating with very narrow
ones, and likely this causes normals to be computed inadequately.

To solve this problem we can either take normals directly from underlying
surface (which is most correct approach, though probably not so fast), or
improve somehow current algorithm (e.g. do averaging of normals using weights
proportional to area / angle of each triangle connected in the node).
Revision 2010-05-21 18:48 by abv
Description Shading of truncated conical objects in OCC viewer looks as if Gouraud shading
was not applied: edges between triangles are very visible due to sharp change
of reflected color. See attached image (shaded_cone.gif).

Note that in case of cylinder (or even cone very close to cylinder) shading is
very nice and smooth (see shaded_cylinrdical_cone.gif).

Also shading is smooth for most of the surface of complete cone, though it is
bad on its seam (see shaded_complete_cone.gif).

Here are DRAW commands to create test cones shown on pictures:

- Truncated cone:
Draw{}> pcone p 1 100 100

- Cylindrical cone:
Draw[]> pcone p 99 100 100

- Complete cone:
Draw[] pcone p 0 100 100

The problem is clearly connected with the fact that normals at the corners of
the triangles (used for smoothing) are not taken from the surface but computed
somehow like by averaging normals of each two neighboring triangles. In the
case of truncated cone well-shaped triangles are alternating with very narrow
ones, and likely this causes normals to be computed inadequately.

To solve this problem we can either take normals directly from underlying
surface (which is most correct approach, though probably not so fast), or
improve somehow current algorithm (e.g. do averaging of normals using weights
proportional to area / angle of each triangle connected in the node).


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker