mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-10 16:04:04 +00:00
02df09e40d
Every visible surface of the enclosure shared one alpha-blended material and was drawn as several overlapping layers: floor, ceiling and four walls as solid BoxMeshes, plus corner curves and fillets generated on top of the box faces they eased into. Alpha-blended surfaces don't write depth and sort per object, so the perimeter composited that tint twice and the corners three times, giving hard-edged trapezoidal patches that re-sorted as the camera moved. The floor box also overhung the walls by 1 m and showed through them. Replace all of it with a single generated mesh covering the inner surface exactly once, every piece cut to meet its neighbours edge-on and only inward-facing triangles emitted. It carries two surfaces: an opaque hull (deck, base fillets, goal bulkheads) and the translucent containment field (walls, corners, ceiling fillets, ceiling). The field shader is additive and unshaded rather than alpha-blended: additive cannot double-darken and composites order-independently, so overlap is structurally invisible, and being unshaded it no longer picks up per-arena light and GI gradients across a 28x40 m panel. Fresnel replaces the old StandardMaterial3D rim, which was a lit effect and the wrong tool. The deck shader draws plating and field markings procedurally from the boundary's own constants, so markings cannot drift from the collision geometry. Per-face MeshInstance3D visibility toggling is gone; the field shader fades facets the camera has crossed outside of per-pixel from one uniform, which is what allows a single merged mesh. Also adds ELEVATED goal mode and the ceiling fillets, and skips the mesh build entirely under --headless, where training spawns instances that never render. Collision is untouched: 166 collider shapes in FLOOR mode and 158 in ELEVATED, verified byte-identical to before, so trained policies in Game/bots/ are unaffected.