# ZFighting on ATI, perfect on NVIDIA

This topic is 2005 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello

I am currently rendering water and i have discovered some issues with z-fighting on ATI. I use glPolygonOffset on the water rendering to avoid z-fighting for the water.

glPolygonOffset(1.1f, 4.0f);
Pipeline::render(gLiquidGeometry, gTexInput);
glPolygonOffset(0, 0);


While on NVIDIA water looks perfect without any artifacts like in the following picture for ATI it is completely messed up. Not only do i get weird artifacts but it also "moves" around all the time, you might see that if you move between the 3 pictures which are taken from different camera angles.

NVIDIA:

ATI:

So i wondered: What could be the reason for that? Does anyone know any issues with that?

Greetings

Plerion

Edited by Plerion

##### Share on other sites

How do you create your z-buffer?

##### Share on other sites

This isn't really answering your question but might help you sidestep the problem. I find that the most portable and hassle-free way of z-biasing is to switch to a slightly different projection matrix, typically, I push the near Z out by a small amount.

##### Share on other sites

Hello C0lumbo

I tested that before and got the same problem, working for NVIDIA, not working on my ATI card, sadly.

But on a side note, it doesnt matter if i use some anti-zfighting method or not, on the NVIDIA card i never ever have any zfighting at all even on nearly coplanar triangles...

@Hodgman:

Which part do you mean? I create the z-buffer in the pixel format with 24 bit depth and 8 bit stencil.

PS:
I already had a lot of problems with my ATI card (AMD HD 6990) and OpenGL. The driver had several issues and all that could go wrong went wrong.

Greetings

Plerion

##### Share on other sites
Post G80 hardware, all NVIDIA cards treat half as float, while ATI doesn't. So if you've got a "half" in your shader, make sure it's not related to depth calculation.

Also, on NVIDIA hardware, a D16 depth buffer is just an aliased D32. In ATI isn't.
Use Parallel Nsight & PerfStudio to determine which depth buffer you're actually getting.

In other words, there are multiple places where if you ask the card to give you half precision you will get full, where ati honours your request. The problem is, if you are expecting full precision results...

IIRC debugging shaders in Pix will do half calculations internally as floats, so you won't see some of the overflows or other precision artifacts in pix either. Sucks.

##### Share on other sites

Hello Matias Goldberg

Thank you very much for your hints. Im currently trying to get GPU PerfStudio 2 to work with my application but so far the furthest ive got is "Connecting..." without any notable change....

/EDIT:
Ah, seems like the usual issue: Im running on Win8 and nothing works there...

Greetings

Plerion

Edited by Plerion

##### Share on other sites

glPolygonOffset is allowed to be implementation-dependent and shouldn't be considered a general purpose "z-fighting fix".  See http://www.opengl.org/sdk/docs/man/xhtml/glPolygonOffset.xml

units

Is multiplied by an implementation-specific value to create a constant depth offset. The initial value is 0.

So you probably don't have a bug, just conformant (but unwanted and annoying) behaviour. Best to construct your geometry so that it doesn't z-fight in the first place (admittedly not always possible).

Edited by mhagain

##### Share on other sites

Hello mhagain

I disabled all z-fighting measures in my program but still i have the same result, NVIDIA OK, ATI/AMD unbearable. So i guess that its as Matias suspected a z-buffer issue. But sadly i have no chance to get GPU PerfStudio 2 to run or give any output at all and so i have no idea what z-buffer my ATI-Card is using. I also dont know of another method to get that information.

Greetings

Plerion

##### Share on other sites
GPU PerfStudio uses a network connection to connect to your program which is acting as a server (provided you launched your program by drag 'n dropping your exe to GPUPerfServer.exe).

Check that your Firewall isn't blocking GPUPerfServer.exe & your application too for incoming connections.

##### Share on other sites

Yes, i used the manual that comes with GPU PerfStudio 2. My application starts with the server, the client detects that a server is running with OpenGL. Next i press the pause button in the client, a window pops up "Capturing frame" as caption and "Connecting..." as content. And thats how it remains, no change (The server receives like 10 messages from the client then it halts.)

1. 1
2. 2
3. 3
4. 4
Rutin
11
5. 5

• 12
• 19
• 10
• 14
• 10
• ### Forum Statistics

• Total Topics
632666
• Total Posts
3007723
• ### Who's Online (See full list)

There are no registered users currently online

×