Z-fighting
Flickering where two surfaces overlap.
The GPU decides which surface is in front using a depth buffer with limited precision. When two surfaces sit at almost the same depth, like a decal on a wall or two overlapping floors, rounding makes them take turns winning pixel by pixel, and they flicker as the camera moves. It gets worse far from the camera.
Try this: Move the camera: the overlapping planes flicker. Turn on a small offset (O), or raise the near plane with ↑.
Move the camera.
Prompt bit
Works for 2D or 3D in any engine (Unity, Unreal, Godot, web). Paste the short one for a quick fix, or the detailed one when you want it done properly.
Fix z-fighting: never place two surfaces at the same depth, give decals a small depth bias instead of a big offset, push the near clip plane out to about 0.1 m (not 0.001), and keep the far plane only as far as you can see.
Find and fix z-fighting (3D, any engine). In the level: remove duplicate or overlapping coplanar faces, and do not stack two floors at the same height. For decals, posters and road markings, use the engine decal system or a small depth bias or polygon offset rather than moving geometry; if you must move them, offset by 1 to 2 cm along the normal. Improve depth precision: raise the near clip plane as far as you can (0.1 to 0.3 m, not 0.01) and lower the far plane to what you need; precision depends mostly on the near plane. Use a 24 or 32-bit depth buffer, and reversed-Z with a floating-point buffer for big worlds. For huge scenes, split rendering of very distant objects (separate camera pass) or use logarithmic depth. For UI or effects that must sit on surfaces, render them in a later pass with depth testing adjusted. Check with a slow camera pan in the distance.
Where it's used
- Level design: overlapping floors and walls
- Decals: bullet holes, posters, road lines
- Large worlds: distant terrain and buildings
- Imported models: duplicated faces
- Coplanar effects: shadows and water planes
Common mistakes
A near plane of 0.01 (ruins precision everywhere), fixing it by moving decals huge distances so they float, ignoring duplicate faces from model exports, and only testing up close where it does not show.
Writing this with an AI assistant? See our best AI coding assistants for game developers.
Missing a concept? Request one.


