How does one get the top or a bottom of a triangle?

Started by
4 comments, last by JohnnyCode 4 years, 7 months ago

I have a small mesh of triangles and I'd like to know how to tell which side is the top and which side is the bottom. E.g., I have a cube and I'm looking for the interior of the cube as well as the external side of it. Eventually, I'd like to show volumes of my models.

Or if you know of any good links that talk about this, please post.

Advertisement

 

1 hour ago, SR D said:

... a cube and I'm looking for the interior of the cube as well as the external side of it ...

If i understand it right, two concepts play a role here: the winding order of vertices/indices, and surface normals.

The winding I know, but I've not yet drawn or calculated the normals as I'm a bit confused on that. Isn't there a normal for each side? Or is the normal only on the side where I choose the winding order?

The surface normal of a triangle is the cross product of two of its edges.

But i don't know what you're up to. OpenGL for example is content with the winding order alone to determine which sides are front and back. But for more complex things like lighting, one would calculate normals per primitive, vertex or fragment manually, preferably in some shader.

13 hours ago, SR D said:

The winding I know, but I've not yet drawn or calculated the normals as I'm a bit confused on that. Isn't there a normal for each side? Or is the normal only on the side where I choose the winding order?

Normal is a per vertex information, that is, it is on each vertex. Sometimes all three verticies of a triangle has the same pointing normal called triangle normal, what is a normal perpendicular to the triangle the verticies form. Sometimes there are duplicated verticies becouse of unique normal but shared position, take for example a cube- a corner vertex has one position but three distinct normals, each perpendicular to one of the shared triangles, thus you have multiple verticies to conform multiple distinct triangles, they just have a common position.

 

This topic is closed to new replies.

Advertisement