the symptom, in your words

"Ground overlays z-fight each other, and a full-lap overlay z-fights itself"

✓ verified on 26.07.22
lane Writing gameplayposted

▸ SYMPTOM

  • Ground markings flicker where two of them meet, the classic depth race.
  • Other markings read as missing. Where the loser is white paint over dark ground, the artefact looks like a marking that was never painted.
  • One owner report often names two bugs: some lines flicker, and some lines are gone. Both are the same depth race.

A dark wear ribbon that outranks a white grid marking draws a band straight through the grid every lap. Correct depth testing of an ordering nobody chose is still a bug.

▸ CAUSE

The house flat-decal rule gets an overlay off the slab: a decal's top face must clear the surface under it. That rule says nothing about the set.

Overlays z-fight each other. Procedural code that writes lifts as arithmetic on two shared constants collapses five overlays onto two values. Five markings landed at exactly 0.04 m over one shared height field, so wherever any two met in plan their top faces were byte-coplanar.

No single call site looks wrong. The defect exists only in the set, which is why a review of the reported markings never finds it.

A full-lap overlay on a self-crossing path z-fights itself. A figure-8 lap, or any ribbon that returns through its own footprint, meets its own second pass. No lift value can separate a surface from itself.

▸ FIX

Give each overlay role a named rung, and never share a rung between two overlays, whether or not they meet in plan today.

  1. Assign one rung per overlay role. "These two do not overlap today" is a footprint argument that fails silently the moment somebody moves a marking.
  2. Read the ladder bottom-to-top as paint layers. Anything meant to be seen outranks the wear it is painted over.
  3. Pick a rung spacing that is not a whole-number divisor of the marking thickness. 11 mm rungs against 20 mm markings make a face-plane collision arithmetically impossible for any number of rungs, not merely absent from today's rungs.

10 mm rungs measured quiet at arena scale.

For a closed overlay on a self-crossing path, add a seam ramp, because a rung cannot separate a surface from its own second pass. Make the lift a function of arclength: a triangular ramp that is 0 at one crossing and 1 at the other. It is continuous and closed at the wrap, so the ribbon gets no seam and no step.

The path's own symmetry does the work. The two passes sit half a lap apart, which is exactly where the ramp's two extremes are, so separation is maximised where it is needed by construction rather than by tuning. Measured: an 8 mm step spread over a 142 m lap raises each 2.37 m station by 0.13 mm and tilts its quad by 0.0032 degrees, nothing a camera can find, while the two passes stay at least 6.9 mm apart across the crossing, about fourteen times the 0.5 mm coplanar tolerance an offline census gates on.

Two ribbons riding the same ramp keep their rung spacing for free. A static rung above them must clear the top of the ramped band, not the ramped rung's base value.

▸ WHY IT WORKS

Gate on 0.5 mm as the coplanar tolerance. About 7 mm of separation was proven stable in play.

Before reaching for depth bias, polygon offset, or a render layer, check whether the codebase has any. A procedural dev-box arena on stock opaque materials typically has none, so vertical lift is the only separation mechanism, and the fix has to be a lift discipline.

Fix the class by census, not the two surfaces the report named. Make it a source-text census that resolves the lift declarations and reads the lift and thickness out of every overlay call site, with four checks:

  1. A box centred at exactly half its thickness parks its lower face flush with the floor.
  2. No two call sites resolve to the same plane with overlapping footprints.
  3. No raw float literal sits at an overlay call site instead of a named rung. This is the drift guard, and the one check that stops the class returning, because every regression starts with somebody typing a fresh literal.
  4. No full-lap overlay on a self-crossing path lacks a seam ramp.

Censusing every overlay emitter across all five arena builders found three unreported instances, including two lane markings in a different arena sharing a byte-identical z-span and crossing at a known point.

Verified on engine 26.07.22: seen in a real project.
s&box moves fast; an undated fix is a liability. Spot a stale detail?
changelog
  • Published

Want to know when new guides or fixes drop? Join the community to help build this out. Report gotchas, flag outdated fixes, or just lurk.

Join the Discord