In the documentation of ShaderLab culling and depth testing you have the following:
Offset
Offset Factor, Units
Allows you specify a depth offset with two parameters. factor and units. Factor scales the maximum Z slope, with respect to X or Y of the polygon, and units scale the minimum resolvable depth buffer value. This allows you to force one polygon to be drawn on top of another although they are actually in the same position. For example Offset 0, -1 pulls the polygon closer to the camera ignoring the polygon’s slope, whereas Offset -1, -1 will pull the polygon even closer when looking at a grazing angle.
I have the following scenery, it’s two cylinders of the same size, one being the sky, one being the horizon on the floor, it is shown exactly how it is expected to render:
This is how it actually looks without playing with the offset factor and units, lots of Z-fighting:
I had to put a fairly high value to Factor
so Z-fighting stops, around 15.
And setting the value of Units
has absolutely no effect.
So I’m a bit at a loss as on how to correctly use both of these parameters.
Question:
Can you explain how shall one understand the meaning and correctly use Factor
and Units
?