DS9 Devlog

When Two Surfaces Fight

Hunting the shimmer that appears when two faces occupy the same spot, plus a door that opens late and a lift band that sinks while its lamp stays put.

Written on Oct 28 from my logs.

Shimmer

If two surfaces sit in exactly the same place, the graphics card can’t decide which is in front. It picks one per pixel, and as you move the pick changes: you see a shimmering patch on the wall. The name for it is z-fighting, and rooms built from lots of overlapping parts are full of it.

I built a detector that finds every pair of faces sharing a plane, even ones a fraction of a millimetre apart, and a rule for fixing them: nudge one face a few millimetres off the other. Today it went room by room:

Room Pairs before After
Replimat 624 0
Security 2,119 0
Quarters 2,167 0
Cargo bay, Ops, docking ring, airlock, habitat, Quark’s, exterior cleared in the same pass 0

The Promenade went through that evening too, and its pass finished just after midnight.

How far apart is far enough?

The gap you need depends on how far away you’re looking. The depth buffer has less precision at a distance, so faces that are fine close up can still fight across a long room. The turbolift car’s parts, for instance, were seated 6.5 mm apart so they hold up along a 44.3 m sightline down the shaft. The exterior is judged differently from the interiors for the same reason: its check is measured against the depth precision at the far end of the view, and faces that met on one plane there were seated one step apart and the seams between coarse tiles welded shut.

Some of the fixes were about not breaking things on the way:

  • In Ops, the stools, chairs, shared doors and frames were reseated, and the seats were kept out of the collision shapes so you can still walk past them.
  • In the cargo bay, the rungs above the east door now run right up to the door edge, with no bare wall strip beside them.
  • In Quark’s, the copper at the corridor entrance sits behind its reveals and the screen slabs sit inside their boxes.

Does it actually flicker?

Before fanning that fix out everywhere, I wanted proof that flagged pairs really flicker on screen. Not every flagged pair does, and the cargo-bay helper couldn’t capture any shimmer on the old build. So another helper picked the biggest pairs in several areas, recorded them in the real browser while the camera crept past, and counted flipping pixels against a control with one face hidden. That measurement shaped tomorrow’s work.