Z fighting tricks

Hi,

What method to avoid z fighting do you prefer?

1. Polygon offset function
2. Eric Lengyel's projection matrix trick (GPG1)
3. Another method (which?)

I know that the first method is the most accurate but I think it has performance penalty...

Your thoughts?

Cheers,

S.
 
I'm looking for a robust method to render decals without z fighting problems.

Also, if you are using a floating point Z, reverse the "typical" depth mapping so that you instead have screen space 1=>near clip and screen space 0=> far/infinity**.


**The far clip distance typically has negligible effect on the depth accuracy so you can put far clip at infinity.
 
The combination of these two should be more than enough.

For coplanar objects those two are not sufficient. Any amount of precision won't help. You'll need some kind of bias, either in the projection matrix, in world space or a depth bias.
 
For coplanar objects those two are not sufficient. Any amount of precision won't help. You'll need some kind of bias, either in the projection matrix, in world space or a depth bias.
Perhaps a preprocess step in the modelling phase and multi-texturing in the rendering?
 
Perhaps a preprocess step in the modelling phase and multi-texturing in the rendering?
That's doable for static decals, but if you have a rectangular wall, and want to add a scorch mark from someone's rocket, that seems like a lot of work to avoid Z fighting as opposed to simply using polygon offset.
 
For coplanar objects those two are not sufficient. Any amount of precision won't help. You'll need some kind of bias, either in the projection matrix, in world space or a depth bias.
Isn't that exactly what the suggestion was; adding a bias (through moving the near plane)? Or maybe I misinterpretated, coz it was what I was expecting to read...
 
Isn't that exactly what the suggestion was; adding a bias (through moving the near plane)? Or maybe I misinterpretated, coz it was what I was expecting to read...

Well, that might work if you apply it only on the decal pass, but the way I understood it I assumed he meant globally pushing the near plane forward, which is something that won't help in that particular case. I'm not sure how well it would work to change the near plane for just one pass though.
 
Back
Top