Original Post
Please help! I''m rendering a simple pyramid model and with no perspective at a fairly close viewpoint and I''m getting incorrect polygon ordering. Kinda hard to explain here but it''s a basic pyramid, 4 triangle sides and a square base. At the root is one of the side triangles (p0), behind it one of the sides (p1) and behind p1 is the bottom square (p2). These are all that''s needed to demonstrate the problem so I won''t bother with the other faces.
Now viewing directly at p0, I would see just a triangle so I''ll give it say 10 degrees on the x-axis. Normally I should see the front triangle and a bit of each of the side triangles. however what I''m seeing is the side p1 drawn first, then the bottom piece p2, then p0. It makes sense when I work out the order...
viewpoint v is in front of p0 so it goes to the back node p1 before drawing itself. Now it''s finding that v is behind p1 so going inorder, there are no front nodes, it draws itself, and then handles the back node which is p2. This is where it''s screwing up visually cause p1 is getting drawn before p2. only when the view distance is large does it find v in front of p1 plane for this scenario.
Perspective viewing decreases this problem but still, the draw order is incorrect. Also backface culling gets rid p2 however sometimes I want the backfaces and even when culling them away, I still see this problem coming up on some other models I''ve tested.
Am I missing something? Is having a close near plane and orthogonal viewing the issue?
Sorry if this was too long but I''m pretty stumped.