Finding polygon edges

Started by
1 comment, last by gnoch 19 years, 2 months ago
Hello, I couldn't find this from the archives. I hope someone can help. I have a polygon made of a lot of triangle strips. I'm trying to find the vertices (not the triangles) that form the edges of the polygon, and I couldn't figure out a way to do this. I'm pretty sure this can be done easily because this is done on software-rendering of 3D scenes. Does any here have any experience in doing this? Thanks! (Using DX8.1 by the way)
Advertisement
Do you mean the vertices of the silhouette edge as projected onto the screen (which changes every time the camera moves)? Or the topological boundaries of the mesh, e.g., vertices that form edges that are only connected to one triangle?

A lot of the rendering techniques are based on using the vertex normals to detect the silhouette edge, and the shader uses this normal in a certain way to make the object look like its outline has been sketched. The idea is that, for objects that are somewhat fat (not flattened like a sheet of paper or pancake), vertices whose normal is roughly perpendicular to the camera look-at vector are those vertices that make up the current silhouette.

If you're interested in the topological boundary, just collect all the edges that are connected to only one triangle into a list. The vertices of those edges are the boundary vertices.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
Quote:Original post by grhodes_at_work
Do you mean the vertices of the silhouette edge as projected onto the screen (which changes every time the camera moves)? Or the topological boundaries of the mesh, e.g., vertices that form edges that are only connected to one triangle?

Topological boundaries.

Quote:If you're interested in the topological boundary, just collect all the edges that are connected to only one triangle into a list. The vertices of those edges are the boundary vertices.

I supposed it was something along that line, but I'm not sure how to determine if an edge is not shared by another triangle. Isn't there a mathematical solution to the problem? And I'm not sure it'll work in my case. For example I have a strip made with small triangles, and the strip is connected to a box made with two triangles. The small triangles all touch the larger ones so obviously their edges "touch" the large edges but there's no easy way to find this.

Edit: another problem I have is, I'm looking for a list of vertices, not edges. I have this triangle list (I was mistaken yesterday, it's not a triangle strip, sorry), and sometimes a vertex in a triangle will be along the edge, while the other two vertices will be inside the polygon. I need to select this vertex as well. Maybe I should first get a list of all lines that are along the edge, then go through my vertex buffer and find all vertices that share the same coordinates as the ones on these lines. Then I'll have a complete list. It seems a little complicated, though.

Additionally, although it's not mandatory, I'm trying to find where the edges are pointing (only four possible directions, since these are mainly tesselated rectangles). I supposed it could be done by first getting an edge, seeing if it points mostly vertically or horizontally, and comparing this edge with the other vertex in its triangle, to see where it's pointing?

[Edited by - gnoch on February 8, 2005 7:41:36 AM]

This topic is closed to new replies.

Advertisement