Clear the renderer background to the fog color, not black

User-reported: a hard black strip at the horizon, between the arena walls and
the sky geometry. Those pixels aren't covered by any polygon -- the game relies
on the board's own background clear there (the sky dome doesn't extend down to
the wall tops). Our renderer cleared the framebuffer to black, so the gap read
as a black band.

Fill the background with the FOG far-color instead: anything no polygon covers
is at effectively infinite distance = fully fogged, so the horizon gap now
blends seamlessly into the same haze the distant geometry fogs toward (filled
far pixels -> FOG_RGB via the fog blend; unfilled background = FOG_RGB directly
-> continuous). Offline-verified: the black strip becomes a smooth blue-purple
haze band. (The game's actual view-flush back_color may differ slightly from
the fog far-color; the fog color is the physically-consistent proxy until
back_color is parsed off the wire -- noted in code.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-20 11:33:09 -05:00
co-authored by Claude Opus 4.8
parent 20dd8440d3
commit f5fc241603
+10 -1
View File
@@ -210,7 +210,16 @@ class Renderer:
raw[..., 7].view(np.float32),
raw[..., 8].view(np.float32)], axis=-1)
filled = zb > -1e29
img = np.zeros((H, W, 3), np.uint8)
# Clear the background to the FOG far-color, not black: pixels no polygon
# covers (notably the horizon band between the arena walls and the sky
# geometry -- the game relies on the board's background clear there) are
# at effectively infinite distance, i.e. fully fogged. Black left a hard
# black strip at the horizon; fog-colour blends it into the haze. (The
# game's actual back_color from the view flush may differ slightly from
# the fog far-colour; using the fog colour is the physically-consistent
# proxy until back_color is parsed off the wire.)
img = np.empty((H, W, 3), np.uint8)
img[:] = FOG_RGB.astype(np.uint8)
flat = filled & (hasuv <= 0.5)
img[flat] = np.clip(lit[flat], 0, 255).astype(np.uint8)
tzc = np.where(np.abs(tz) < 1.0, np.sign(tz) + (tz == 0), tz)