Z-fighting and tile-based rendering
Saturday, May 5, 2012 at 10:15AM
Kevin Conner in Graphics, Screenshots

When you draw two things exactly on top of each other, the GPU can't decide which one draws in front, and you get an effect called z-fighting. On most GPUs z-fighting manifests as an even pattern across all the affected pixels. But on the iPhone and iPad's tile-based GPUs, each tile has its own take on the pattern. It's like a quilt of roundoff error.

I was fooling with Degrees this morning, and I saw z-fighting where an asteroid was being drawn inside the solid part of a level. Tiles are just units of work for the GPU, so they're not supposed to be visible. But here they are. You can feel out how the inputs (shaded, clipped triangles) are different across each tile, and how that can have real consequences for how things are drawn.

Z-fighting is actually much more distracting to the player on tile-based GPUs than on standard GPUs. These patterns flicker and rearrange themselves if you rotate even a little, because the roundoff error resolves differently per title per angle. So the quilt has a time axis. It's a hyperquilt.

Actually I think it kind of looks grungy and cool, and I could use it as part of Degrees's style for occasional effects. But it's probably a health hazard for some players, so I'll pass.

Article originally appeared on Degrees, a game in progress for iPad and iPhone (http://degreesgame.com/).
See website for complete article licensing information.