PDA

View Full Version : Weird clipping problem



Herr.O
07-29-2004, 11:57 PM
I am drawing a 2D isometric scene with tiles using orthographic projection. When I draw my tiles I use an offset of 0.5 units when placing the vertices (to get pixel exact positions).

All looks fine when I draw the tile in the middle of the screen, but if I place the tile so it spans the viewport edge I get problems. Small "pixel holes" becomes visible in the tile:

http://www.kemisten.nu/lgh10/holes.jpg

I find it strange that there are no visible holes showing on the opposite edge of the tile when it spans the viewport edge. I have tried flipping the edge and draw it in the other direction (CW) but It had no effect.

Anyone seen this problem before and know how to fix it? Any help appriciated.

ZbuffeR
07-30-2004, 07:28 AM
What is you card/driver/OS ?

As the tile touches the edge of the screen, triangles may be retesselated. For example, I have seen vertex lighting changing slightly in such cases. It should not change the edges though.

Have you tried using different coordinates offset ? Ie, (O,O).

Herr.O
08-03-2004, 03:33 AM
I got it to work now. I used a slightly smaller offset (0.25 units). It must have been a rounding error when clipping the triangle. I'm using Windows XP with an nvidia gf ti4400, driver 56.72.

I hope it works on ATI cards also. I have to try it out when I get a chance. The result is quite nice:

http://www.oddgames.com/temp/scr.jpg

:D