Triangles clipped become un-triangles....
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
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.
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement