Could someone elaborate on what z-fighting means? How do we know which are the valid values we can clip z to, and what are the consequences if we don't do so?
keenan
@tib Z-fighting happens due to very small floating point errors in the calculation of depth values. Suppose you rasterize two triangles, which at some screen location $x$ should have depths $d_1(x) < d_2(x)$. However, since these values are computed in floating point (e.g., calculating barycentric coordinates to interpolate depth values at corners, taking a linear combination, doing a perspective divide...) you may have errors in the numerical values $\hat{d}_1(x), \hat{d}_2(x)$ such that $\hat{d}_1(x) > \hat{d}_2(x)$. Since these numerical errors will vary in erratic ways from point to point, the ordering of triangles will also vary erratically and you'll get visual artifacts (jagged edges, etc.). See this slide.
Could someone elaborate on what z-fighting means? How do we know which are the valid values we can clip z to, and what are the consequences if we don't do so?
@tib Z-fighting happens due to very small floating point errors in the calculation of depth values. Suppose you rasterize two triangles, which at some screen location $x$ should have depths $d_1(x) < d_2(x)$. However, since these values are computed in floating point (e.g., calculating barycentric coordinates to interpolate depth values at corners, taking a linear combination, doing a perspective divide...) you may have errors in the numerical values $\hat{d}_1(x), \hat{d}_2(x)$ such that $\hat{d}_1(x) > \hat{d}_2(x)$. Since these numerical errors will vary in erratic ways from point to point, the ordering of triangles will also vary erratically and you'll get visual artifacts (jagged edges, etc.). See this slide.