Skip to main content
gamedev.net
🔒 Locked

Algorithm to remove overlapping polygons

Started by UUDi Jan 14, 2005 at 5:07 AM 2 replies 1.5k views
Original Post
UUDi
UUDi
Hello. I'm writing a program with 3D data. The problem is that there is no z-buffer available, so I would want to cut the polygons that are overlapping each other. What would be a good way to cut a quad or a triangle, which has some of its corners a little underneath another polygon. The overlapping polygons are never totally on top of each other. Only the corners are. Where should I start? thanks for any help.
benryves
benryves
Why not have a z buffer? It's the easiest way to do it.
Failing that, build up a list of all the triangles you're going to draw with average z of each (just add up the three corners), then sort them using that value into back-to-front order. The result isn't very good, but it works.

EDIT: The Quicksort algorithm is pretty good for this.
[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]
GameCat
GameCat
I'm not entirely sure what you're trying to do, but if all you want is to render these polygons without a z-buffer yuo might want to google the scanline algorithm for rendering, also known as active edge list. It's robust unlike the painter's algorithm. It's also much more complex to implement though.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.