Is there anyway that *I* can eliminate Z-fighting in games?

Matt2

Diamond Member
Jul 28, 2001
4,762
0
0
As I understand it, "Z-Fighting" is a term used to describe flickering textures.. is this right?

I have this problem on almost every game. IN Far Cry, when looking out towards the landscape, there is always a tiny patch of foilage that is "flickering". It also happens in BF2 where one little section of a building or train (in Karkand) is flickering. It's also pretty bad in GRAW where buildings in the background flicker. It's especially noticable in-bewteen levels when you're riding in the helicopter looking down at Mexico City.

Is there any setting/tweak that eliminates this???

Does anyone else have this problem?

It happens in all Catalyst versions I have tried.

Also, it is most definately NOT artifacting.

EDIT: Every setting in Tray Tools is set to high quality and changing CAT AI changes nothing.
 

xtknight

Elite Member
Oct 15, 2004
12,974
0
71
It is a problem in the game's level where two brushes/faces with different textures overlap each other (they are both fighting for the same Z coordinate). There is nothing you can do short of editing the level or the engine, both of which would be caught by cheat detectors.
 

Matt2

Diamond Member
Jul 28, 2001
4,762
0
0
Thanks for the info xtknight.

Kinda sucks. I'm surprised not more people mention this.
 

xtknight

Elite Member
Oct 15, 2004
12,974
0
71
I'll have to say that I've heard it's more rampant on ATI cards (especially in BF2), which suggests there may be a driver issue.
 

Matt2

Diamond Member
Jul 28, 2001
4,762
0
0
Originally posted by: xtknight
I'll have to say that I've heard it's more rampant on ATI cards (especially in BF2), which suggests there may be a driver issue.

Now that I think about it. I've seen it in Far Cry and BF2 on my X800XL, but cant recall seeing it on my 7800GT SLi setup.

Maybe I'll drop ATI a problem ticket and see what they say. Although I doubt they'll have anything insightful to say.
 

SunnyD

Belgian Waffler
Jan 2, 2001
32,674
146
106
www.neftastic.com
It all has to do with the precision of the Z-Buffer used. Most use a fixed point Z-Buffer, which means decimal degradation for the sake of speed, which means a finite amount of depth precision. This in turn means that because movement in the game is actually "more infinite" than the Z-Buffer, some amount of Z-Fighting will always occur on every card.
 

potato28

Diamond Member
Jun 27, 2005
8,964
0
0
Lower the texture values, or don't use 16x AF and 4x AA at the same time. Only if you're using an ATI(AMD?) card. :)
 

Matt2

Diamond Member
Jul 28, 2001
4,762
0
0
Originally posted by: SunnyD
It all has to do with the precision of the Z-Buffer used. Most use a fixed point Z-Buffer, which means decimal degradation for the sake of speed, which means a finite amount of depth precision. This in turn means that because movement in the game is actually "more infinite" than the Z-Buffer, some amount of Z-Fighting will always occur on every card.

Is there any validity to xtknight's suggestion that it may happen more with ATI cards?

Is there a way to increase Z-Buffer depth outside of the game, assuming it's not already running 32bit buffer? I can remember at least a couple of times where there was a z-buffer depth option in a few games that offered 16bit, 24bit and 32bit settings.
 

xtknight

Elite Member
Oct 15, 2004
12,974
0
71
Interesting. Thanks for the info SunnyD. I was only familiar with the mapper's definition of it. There may be an option in RivaTuner to force Z-Buffer size. Is a 32-bit Z-Buffer even possible? I always thought there was some relation between Z-Buffer size, color depth, and texture size, like all had to add up to a certain amount, and color depth had to be at least 8-bit. Maybe I am thinking of the stencil buffer.
 

Matt2

Diamond Member
Jul 28, 2001
4,762
0
0
Bump for some insight!

I am very interested in this.

So if all graphics cards are going to experience z-fighting as SunnyD implied, then why dont I see it on XBOX360 while playing GRAW?
 

loafbred

Senior member
May 7, 2000
836
58
91
I can confirm what the others said about this being unavoidable, as I've seen some minor glitches in the game "Flatout", where a small patch of sky in one specific part of one or two tracks will show a very noticeable broken texture when using a 9500 Pro, 9600 XT and 9800 Pro. Neither game settings nor driver versions and settings have any influence on it. I've seen the game run on nVidia 6800 GT (AGP), 6800 GS (PCI-E), 7800 GS, 7800 GTX, 7900 GTX, and 7900 GS without this or any other texture anomalies. It's far from being enough to be an irritation, but it can catch your attention.
 

xtknight

Elite Member
Oct 15, 2004
12,974
0
71
Originally posted by: loafbred
I can confirm what the others said about this being unavoidable, as I've seen some minor glitches in the game "Flatout", where a small patch of sky in one specific part of one or two tracks will show a very noticeable broken texture when using a 9500 Pro, 9600 XT and 9800 Pro. Neither game settings nor driver versions and settings have any influence on it. I've seen the game run on nVidia 6800 GT (AGP), 6800 GS (PCI-E), 7800 GS, 7800 GTX, 7900 GTX, and 7900 GS without this or any other texture anomalies. It's far from being enough to be an irritation, but it can catch your attention.

Do you know if it's a problem with the map though? That confirms it's not a problem with one specific card, but we still don't know if it's the drivers or the map.
 

SunnyD

Belgian Waffler
Jan 2, 2001
32,674
146
106
www.neftastic.com
Originally posted by: xtknight
Interesting. Thanks for the info SunnyD. I was only familiar with the mapper's definition of it. There may be an option in RivaTuner to force Z-Buffer size. Is a 32-bit Z-Buffer even possible? I always thought there was some relation between Z-Buffer size, color depth, and texture size, like all had to add up to a certain amount, and color depth had to be at least 8-bit. Maybe I am thinking of the stencil buffer.

Yeah, there are 32-bit Z buffers. But again, for the sake of speed, keep in mind that they usually choose to do fixed-point math. ATI may choose to use less decimal places in their precision than NVIDIA, which could account for more issues with ATI.

It does also in a way deal with the map itself. Z fighting will mostly come into contention with multipass texture maps, where with the two textures overlapping, and the fixed point calculations, sometimes one Z value rounds greater than the other under a given angle.

Matt2, I bet if you try really really hard, you can find Z fighting on an XBox 360. More than likely you're too busy staying alive to notice one small corner somewhere flickering or something.
 

xtknight

Elite Member
Oct 15, 2004
12,974
0
71
Isn't it up to the game engine to set the properties (data type, resolution of elements) of the Z-Buffer, and the driver has to obey those properties? Is there a limit to the actual size (not resolution) of the whole Z-Buffer? It seems as though it could make up for the lost resolution by increasing the size, but does the engine lack the intelligence to do this?
 

Munky

Diamond Member
Feb 5, 2005
9,372
0
76
The zbuffer precision can be set from within the game engine, and in OpenGL for example you have to specify the zbuffer precision if you want to use it. I've played around with it in my projects. There's noticeable difference between 16 and 24 bit, but I didn't see any difference between 24 and 32 bit - I'm not even sure if 32-bit zbuffer is supported. However, if you have 2 overlapping geometry polys in the same plane then you usually get zfighting regardless of the zbuffer precision. To avoid the issue you must either have no overlapping polygons or code the engine in such a way to compensate for it. OpenGL has a built in feature that can be used for this purpose. I do not know, however, of a way to eliminate zfighting in a game that already exhibits it.
 

BFG10K

Lifer
Aug 14, 2000
22,709
3,000
126
The problem referred to in the original post could also be texture aliasing which is a totally different issue to Z-fighting.
 

evolucion8

Platinum Member
Jun 17, 2005
2,867
3
81
And trying to change the LOD setting using ATi Tray Tool, may that help to fight the problem a bit?? I have seen that using the correct value may reduce that flickering effect.
 

SunnyD

Belgian Waffler
Jan 2, 2001
32,674
146
106
www.neftastic.com
Originally posted by: munky
The zbuffer precision can be set from within the game engine, and in OpenGL for example you have to specify the zbuffer precision if you want to use it. I've played around with it in my projects. There's noticeable difference between 16 and 24 bit, but I didn't see any difference between 24 and 32 bit - I'm not even sure if 32-bit zbuffer is supported. However, if you have 2 overlapping geometry polys in the same plane then you usually get zfighting regardless of the zbuffer precision. To avoid the issue you must either have no overlapping polygons or code the engine in such a way to compensate for it. OpenGL has a built in feature that can be used for this purpose. I do not know, however, of a way to eliminate zfighting in a game that already exhibits it.

I wasn't referring to the bit-ness. I was referring to where the hardware manufacturer arbitrarily puts the fixed point decimal in the calculation.
 

BFG10K

Lifer
Aug 14, 2000
22,709
3,000
126
It's interesting this topic just happened to come up now. When testing my 8800 GTS in games that had Z fighting in the past (Descent 3, Vietcong and Undying) I notice the problem's fixed while my past ATi and nVidia cards had the issue.

I'm sure it's somehow related to the exemplary AF offered on the G80.
 

xtknight

Elite Member
Oct 15, 2004
12,974
0
71
How would AF fix overlapping textures or a short Z-Buffer? Would it just lessen the effect? Is the Z-Buffer size the same on the G80 as it was on the G7x? Additionally, what is texture aliasing? Is that where you see half of a different texture overlapping another every time you move your mouse one pixel? Are these all interchangeable terms?

I'll try and make an animated gif sort of thing of this effect (in a broken Quake3 map) to make sure we're all on the same page.
 

BFG10K

Lifer
Aug 14, 2000
22,709
3,000
126
Hmm...how would AF fix overlapping textures or a short Z-Buffer? Would it just lessen the effect?
I'm not totally clear on this yet but I'm sure it has something to do with it.

Is the Z-Buffer size the same on the G80 as it was on the G7x?
I believe so.

Additionally, what is texture aliasing?
It's the same thing as polygon aliasing but on textures (i.e. jagged edges within textures).

This grating shot (taken from here) illustrates texture aliasing. At a distance the flickering can be confused with Z fighting which is why I mentioned this in my first post in this thead.

In any case the three games I listed above definitely suffer from Z fighting until I run them on the 8800 GTS and the textures then sit perfectly in place.
 

Matt2

Diamond Member
Jul 28, 2001
4,762
0
0
Originally posted by: BFG10K
It's interesting this topic just happened to come up now. When testing my 8800 GTS in games that had Z fighting in the past (Descent 3, Vietcong and Undying) I notice the problem's fixed while my past ATi and nVidia cards had the issue.

I'm sure it's somehow related to the exemplary AF offered on the G80.

So do u think it might be the AF itself on my R580 that is causing the flickering?

If I were to reduce the AF or turn it completely off, what would that do? Less flickering or more?

I'll try to reproduce the flickering in Ghost Recon at different AF levels later tonight when I get home.

I'll also try adjusting the LOD in Tray Tools as evolucion8 suggested.
 

BFG10K

Lifer
Aug 14, 2000
22,709
3,000
126
So do u think it might be the AF itself on my R580 that is causing the flickering?
I think what you're describing might be texture aliasing and not Z fighting.

Z fighting is where two (or more) polygons join and they alternate being in front of each other during movement, causing the area to wiggle.

Texture aliasing OTOH is crawling/moire/rolling lines within the texture, usually on busy lines and in high detail areas.

The only cure for texture aliasing is super-sampling anti-aliasing. You could also reduce the game's texture detail to the lowest level and see if that helps (the blurring of the textures should make less aliasing).

Maybe you should post up some screenshots, circle the affected areas and describe what you're seeing during movement and we can go from there.
 

Matt2

Diamond Member
Jul 28, 2001
4,762
0
0
Originally posted by: BFG10K
So do u think it might be the AF itself on my R580 that is causing the flickering?
I think what you're describing might be texture aliasing and not Z fighting.

Z fighting is where two (or more) polygons join and they alternate being in front of each other during movement, causing the area to wiggle.

Texture aliasing OTOH is crawling/moire/rolling lines within the texture, usually on busy lines and in high detail areas.

The only cure for texture aliasing is super-sampling anti-aliasing. You could also reduce the game's texture detail to the lowest level and see if that helps (the blurring of the textures should make less aliasing).

Maybe you should post up some screenshots, circle the affected areas and describe what you're seeing during movement and we can go from there.

Alright, I'm gonna try and get it in a FRAPs video, I think that would be the easiest way to see it.

Where can I upload the movie to for free?
 

LittleNemoNES

Diamond Member
Oct 7, 2005
4,142
0
0
Originally posted by: Matt2
Originally posted by: BFG10K
So do u think it might be the AF itself on my R580 that is causing the flickering?
I think what you're describing might be texture aliasing and not Z fighting.

Z fighting is where two (or more) polygons join and they alternate being in front of each other during movement, causing the area to wiggle.

Texture aliasing OTOH is crawling/moire/rolling lines within the texture, usually on busy lines and in high detail areas.

The only cure for texture aliasing is super-sampling anti-aliasing. You could also reduce the game's texture detail to the lowest level and see if that helps (the blurring of the textures should make less aliasing).

Maybe you should post up some screenshots, circle the affected areas and describe what you're seeing during movement and we can go from there.

Alright, I'm gonna try and get it in a FRAPs video, I think that would be the easiest way to see it.

Where can I upload the movie to for free?

rapidshare.com will work