Sign in to follow this  

Clipped Polys

This topic is 3861 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

I have a problem with my gouraud shaded renderer. Say there was a quad that gets clipped against the viewport, creating a 6 sided polygon. When split into to triangles in the very last state for rendering, a lot of times (depending on which edge(s) were clipped against the viewport), the colors will look like that shift, since they get interpolated along different vertices. I tried different methods for splitting the poly into triangles, and it still happens. The only solution I can think that would fix the problem is to split the polys into triangles before clipping... but that could potentially slow down the clipper a bit. What is the best compromise or solution for this problem? Also I do my back-face culling at the last stage, after all vertices have been projected. When I cull before this, it always makes polys dissappear just before they should, and reappear just before they should...I think it would look right in a parallel projection. Is this a common problem that happens for people? Thanks. -Scott

Share this post


Link to post
Share on other sites
If you're not using perspective correction for the gouraud shading then you'll get a very slight shift in the colouring when tris are clipped in 3d but it shouldn't really be a problem, if it's quite noticable then it sounds like there's something wrong with your clipping code.
And backface culling shouldn't do that, either if you're using the normal or the winding it should work fine.

Share this post


Link to post
Share on other sites
Thanks. I fixed the coloring problem by just splitting all quads into triangles during initialization, instead of right before they get drawn to the screen. It kept shifting because after a quad was clipped, when the renderer splits them into triangles for rendering sometimes the triangles wouldn't link the original vertices that made triangles when the quad wasn't clipped...

As for the backface culling...I don't know! The winding (after perspective projection) works fine though...so I'll just stick with that for the moment.

I had another question regarding cache misses but I'll post another thread.

Share this post


Link to post
Share on other sites

This topic is 3861 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.

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