Yeah, it's actually a lot harder to mitigate then you would think. People have come up with all sorts of tricky ways to fix it but none of them are perfect.
Thanks for tipping me off to how to fix this. My vulkan renderer had terrible z-fighting when decals were placed on top of larger models. This caused the decal quad to fight with the surface that it is on. I realized that my near-plane of 0.1 might be causing it. Setting it to 1.0 made all z-fighting completely go away and my rendered scene now looks sexy af. Thansk!
First of all: Impressive series! It's immensely helpful, very detailed and easy to watch. Please allow me a little remark, though (Which is probably of more interest to other viewers): @ 9:15 you demonstrate that the back of the cube gets depth buffer values of about 0, even though the back is relatively close to the near plane. @ 10:30 you start to explain why: the objects closer to the camera get a "finer resolution" in the depth-buffer. But then you paint the "0" close to the far plane and that is actually reversed. If the "0" was close to the far plane, then all the values between the camera and "0" would be compressed into depth buffer values between -1 and 0. Whereas the relatively small distance between "0" and the far plane be turned into depth buffer values between 0 and +1. But this would mean that the values close to the camera are compressed more, and not less. Instead, the "0" is close to the near plane, so that the relatively short distance between the near plane and "0" get's 50% of the range of the depth buffer values. Your demonstration with the box (@ 9:15) even shows that the "0" is near the back of the cube; and thus relatively close to the near plane.
I think I'm following you here. I believe in later videos I actually uncover a slight lie I told in this video showing the cube turns inside out like a top-hat.
I know what Z-Fighting is, and i kinda understood why the Z-Fighting showed up again as you moved the camera further out even tough the plane didn't touch the cube, but i've no idea what you mean with anything else.
I think the near to far distance is mapped to the -1 to +1 distance with a logarithmic mapping and not a linear one. That's what the end part was all about
Look like a homebrewed toy renderer meant to display how things look like when you tweak some of the values, meant for learning purposes, not for the general public.
One would think that would remedy it, but it does not. When you try to represent an infinite range on a floating point scale, the floating point types become more super crude integers instead. Even if I had a billion-bit floating point type...compared to an infinite range...there's just no way to cover it all.
@@linkenparis9562 It only delays it. It will still occur but from slightly further distances. It may seem like a quick and easy fix until you realize that floats have a performance benefit since they take up half the space of doubles. Flood the GPU cache with doubles and the performance takes a nosedive.
@@JamieKingCS Really? There obviously is a difference but that's kind of like you being offended by me calling you an American rather than a Utahn! Americans often conflate England and the whole UK, it is one of my biggest pet peeves! Thank you for this playlist!
This is still a frequent occurrence in games today...
Yeah, it's actually a lot harder to mitigate then you would think. People have come up with all sorts of tricky ways to fix it but none of them are perfect.
GTA 4 has tons of ZFighting lol especially at the airport
Yeah it’s probably the most common graphical glitch in games
@@sirrivet9557 this and crippling are the most common ones
the fix is literally just moving one texture by 1 unit
Ive been aware of this since I was like 5, didn't know there was a name for it
Same, I also have experienced seeing this in many games even when I was a kid. Fun to finally learn about it in detail.
roblox lol
@@spirit8745 i hate roblox but mc also have z fighting when you mix 1 block and another with a glitch
2021 and we still have problems with z-fighting in a lot of games...
2023 still going strong with the z-chaos, even in modern CAD software. Dissapointing.
nice boingo pfp
Thanks for tipping me off to how to fix this. My vulkan renderer had terrible z-fighting when decals were placed on top of larger models. This caused the decal quad to fight with the surface that it is on. I realized that my near-plane of 0.1 might be causing it. Setting it to 1.0 made all z-fighting completely go away and my rendered scene now looks sexy af. Thansk!
First of all: Impressive series! It's immensely helpful, very detailed and easy to watch.
Please allow me a little remark, though (Which is probably of more interest to other viewers):
@ 9:15 you demonstrate that the back of the cube gets depth buffer values of about 0, even though the back is relatively close to the near plane.
@ 10:30 you start to explain why: the objects closer to the camera get a "finer resolution" in the depth-buffer. But then you paint the "0" close to the far plane and that is actually reversed.
If the "0" was close to the far plane, then all the values between the camera and "0" would be compressed into depth buffer values between -1 and 0. Whereas the relatively small distance between "0" and the far plane be turned into depth buffer values between 0 and +1. But this would mean that the values close to the camera are compressed more, and not less. Instead, the "0" is close to the near plane, so that the relatively short distance between the near plane and "0" get's 50% of the range of the depth buffer values.
Your demonstration with the box (@ 9:15) even shows that the "0" is near the back of the cube; and thus relatively close to the near plane.
I think I'm following you here. I believe in later videos I actually uncover a slight lie I told in this video showing the cube turns inside out like a top-hat.
Still valid!
I am learning Unity for a hobby and this was mentioned, so thank you Jamie from 2013 ;P
Wow, this is really great. Thanks so much for sharing your knowledge!
That's a really cool name for a very mundane problem.
So it has a name! I've always known it since the PS1 but never thought it was phenomenon that would be named.
Thank you, Jamie for the great explanation! I wonder why we need to smash things between -1 and 1 though...
already knew it, seen it many times, but epic video to link to friends that does not know what Z-Fighting is
Really great explanation, thank you
Does this mean we live in a simulation?
ZED FIGHT ! ZED FIGHT ! ZED FIGHT !
WOO !
The bane of my existence
GTA SA IS KING IN Z-FIGHTING
GTA4 is the prince 😉
I know what Z-Fighting is, and i kinda understood why the Z-Fighting showed up again as you moved the camera further out even tough the plane didn't touch the cube, but i've no idea what you mean with anything else.
I think the near to far distance is mapped to the -1 to +1 distance with a logarithmic mapping and not a linear one. That's what the end part was all about
what is this *nerd* in the video going on about???! 😬
i came here for *porn* 😋
What is that software called?
Look like a homebrewed toy renderer meant to display how things look like when you tweak some of the values, meant for learning purposes, not for the general public.
i don't know why i watched this, but it was kinda interesting :D i know z-fighting very well from early 3d games.
Not the Z-fighters I had in mind
Roblox is a perfect example
This still happens on other axes though right?
No. NDC is fixed in this regard.
X and Y is vertical and horizontal.
-Z is forward.
Use double instead of floats. Profit?
One would think that would remedy it, but it does not. When you try to represent an infinite range on a floating point scale, the floating point types become more super crude integers instead. Even if I had a billion-bit floating point type...compared to an infinite range...there's just no way to cover it all.
@@JamieKingCS What about BigDecimal?
@@JamieKingCS so does it still help ?
@@linkenparis9562 It only delays it. It will still occur but from slightly further distances.
It may seem like a quick and easy fix until you realize that floats have a performance benefit since they take up half the space of doubles. Flood the GPU cache with doubles and the performance takes a nosedive.
some people called it "seizure things" lol
h
yt pls recommend this to peopless :((
nice
How to piss off jtoh players
Sounds like john roblox
and in roblox too!
Thought it was called zed fighting
In England, yes.
@@JamieKingCS Don't you mean the UK! & the rest of the English speaking world bar the US ;).
Well I had an English lady chew me out once for calling her British. She was adamant about a difference, but alas...
@@JamieKingCS Really? There obviously is a difference but that's kind of like you being offended by me calling you an American rather than a Utahn! Americans often conflate England and the whole UK, it is one of my biggest pet peeves! Thank you for this playlist!
Glad it’s helping you out. :) and you can call me either
*(Dragonball)* z-fighting 😀
that's the cool kind of z-fighting. 😆
prvni
Lol, Grand Theft Auto 4 pc port
Lol
Funny seizure block
Hbox lied
h
?
DID YOU NOT WATCH THE VIDEO?
2b2t
@Mati.falcon ik but i came here from a 2b2t video lol
Z-Fighting + V-Fighting = Special Military Operation