Archived

This topic is now archived and is closed to further replies.

Triangles clipped become un-triangles....

This topic is 5816 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I have a problem. My software renderer is currently drawing triangles. This is not a problem until they are clipped against the Z plane, as then the will become quads, and I can''t render quads. I hear that you can split the quad into triangles, but I also heard this is hard and complex. Speed is also an important issue- would it be quicker/easier to render convex polys rather than just triangles? I used to do this, but since using the triangle filler things have become slightly faster... and this is a speed increase I really need. Cheers, -Paul

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Depending on how you are doing cliping.... If you know which polys are both on and off screen, test them to see if they will be quads or tris (If one point off screen, two on, then quad, otherwise tri.)
calculate the intersection of the sides of the tri and the screen, which will give you two points.
If quad, you then split into two tris by taking one of the intersection points and the point of the original triangle that was not on the edge that you took the intersection point from.
The points of the two new tris are these two points, and one of other points.

Hopefully that made sense... I''m not sure if it''s the fastest way, but it would work. If texturing the poly''s you''d have to worry about lining up the texture right after the split though, but you''d have to do that anyways.

Hope that helped.

Share this post


Link to post
Share on other sites
Splitting into tris shouldn''t be too hard. I assume you have your verteces in some order, like clickwise, already. In that case, if you have quad ABCD, then you just make tris ABD and BCD.

Share this post


Link to post
Share on other sites