Sign in to follow this  
staticVoid2

Clipping

Recommended Posts

hi, I have a problem to do with clipping and texture mapping, basically I have a function that applies a texture to a triangle using basic interpolation, when I perform transformations on points from world space to view space I clip them to the Z plane, for each face/triangle this can leave me with either another triangle or a quadrangle. If the result is a quadrangle I'm not sure how to split this into another two triangles to pass to the texture function. because i'm using the sutherland hodgman algorithm the result points are stored in an unordered list so I can't determine which are the shared points of the two triangles. Is there a more efficient way of doing this, or in other words how is it normally done?

Share this post


Link to post
Share on other sites
Quote:
the result points are stored in an unordered list so I can't determine which are the shared points of the two triangles.


You can't, because there's nothing to determine. You have created two new triangles from one triangle, so you have to decide what vertex belongs to what triangle. It won't make a difference as long as you make sure that the winding order is correct.

Share this post


Link to post
Share on other sites
Like I said, as long as you make sure that the vertex winding order is correct, it should work, though in your example it seems like the two triangles have different winding orders. I think the second one should be 0, 2, 3, or the first one should be 0, 2, 1, depending on what you consider to be a front facing triangle (i.e., clockwise or counter-clockwise).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this