How can I display a hollow cylinder.

I’m trying to find a technique for hiding all but the end circular and side lines for a cylinder. Similar to hidden lines. I think I’m just missing something simple.

My I suggest gluCylinder, a good example of it is on the http://nehe.gamedev.net

Originally posted by jbarton:
I’m trying to find a technique for hiding all but the end circular and side lines for a cylinder. Similar to hidden lines. I think I’m just missing something simple.

Actually, nexusone, I think he is saying he wants the silhouette of the cylinder.

Yeah, I’ve played with that but I can’t get rid of the other straight lines. Example: when viewed from a non-ortho position a hidden cylinder would have one ellipse, 2 lines and an elliptical arc. What I’m getting is the normal ellipse, elliptical arc and all the lines for each face. I’m looking a some combination of a boundary or subtracting the other lines some how.

The solution to this problem is very similar to that of “toon” shading. When toon shading, you have to take an arbitrarily complex 3D model and reduce it to its prominent edges. This sounds much like what you want to do but with a simple cylinder instead.

DFrey, that sounds right, but wouldn’t that leave the other lines showing on the cylinder?
Right now I’m placing the same GL_FILL cylinder after a GL_Line cylinder in the background color and that works ok except for the other lines.

Thanks.

Which edges would show is tunable. Though I doubt you could guarantee that improper edges would never be shown. The only two other methods I can think of are:

  1. The method you currently are using, which does not remove the interior edges (and may suffer from invariancy issues).
  2. Draw the cylinder piecewise, taking into account the cylinder’s view orientation.

[This message has been edited by DFrey (edited 03-15-2002).]

DFrey,
Do you know where I can find a good example of the toon method?

Are you also wanting to be able to look through the cylinder?
Maybe a texture map?
And if you needed to see through it add a apha channel for a mask.

Something like this:

| |
| |

Another thought with a little math, build a custom function plot a circle and arc based on the rotation…

Originally posted by jbarton:
Yeah, I’ve played with that but I can’t get rid of the other straight lines. Example: when viewed from a non-ortho position a hidden cylinder would have one ellipse, 2 lines and an elliptical arc. What I’m getting is the normal ellipse, elliptical arc and all the lines for each face. I’m looking a some combination of a boundary or subtracting the other lines some how.

[This message has been edited by nexusone (edited 03-15-2002).]

Nexusone,
No the cylinder should appear solid line a 2 line drawing. I’m trying to come up with a method to create a printable drawing for piping.

A custom function should not be hard to write, just draw a 2D circle, arc and connect them with two lines.

Originally posted by jbarton:
Nexusone,
No the cylinder should appear solid line a 2 line drawing. I’m trying to come up with a method to create a printable drawing for piping.

Ok, I’ll give that a try. I’ll have to figure out how to find the points I need based on the angle of view. Does that sound right?

Thanks for the help.

A quick search on Google turns up lots of hits. I’ve seen and learned alot from Jeff Lander’s papers and demos. And I found a link for his paper on toon shading: http://www.darwin3d.com/gamedev/articles/col0300.pdf

If you want the cylinder to be a wireframe, you just use an appropriate 1D shading texture that allows the edges to be opaque and everything else to be transparent.

Thanks everyone you’ve given me a lot to try.