feat(perception): ground vision cone in human sensory physiology

- Visible half-angle 150° → 100° (200° arc), matching average human
  binocular field. Blind spot widens from 60° to 160° — genuine
  vulnerability behind the character.
- Forward half-angle stays at 60° (120° arc) — binocular overlap zone.
- Peripheral zone represents combined sensory awareness: visual
  periphery + subconscious sound/motion tracking, not just eyes.
- Per-character VisionConeConfig allows implants and perception modes
  (D-017) to widen beyond the unaugmented baseline.
- Fog shader: smooth back-edge gradient via smoothstep blend between
  Layer 2 (peripheral) and Layer 3 (deep fog), eliminating blocky
  stair-stepped tiles at the rear of the vision cone.
- D-015 updated with physiological basis and per-character config.
- D-017 updated with vision cone modification by perception modes.
- D-020 updated with protocol versioning policy: PROTOCOL_VERSION
  gates wire format, not gameplay parameters.
- DB backup after sprint 21 close.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-27 22:31:29 +01:00
co-authored by Claude Opus 4.6
parent dd0de2ff04
commit a69e69e663
5 changed files with 67 additions and 39 deletions
+27 -24
View File
@@ -73,33 +73,36 @@ void fragment() {
vis = 0.0;
}
if (vis > PERIPHERAL_LOW) {
// In or near vision cone
if (vis > CLEAR_THRESHOLD) {
// Layer 1: Clear — soft edge gradient
// Alpha matches Layer 2 at boundary (coverage=1.0 → 0.25) for continuity
float edge = smoothstep(CLEAR_THRESHOLD, 1.0, vis);
COLOR = vec4(DARK_OVERLAY, 0.25 * (1.0 - edge));
} else {
// Layer 2: Light fog (peripheral + forward edge)
// D-059: animated Perlin noise, 8-10s cycle
float noise_val = texture(noise_tex, tile * 0.03 + vec2(time * 0.11, time * 0.07)).r;
float coverage = smoothstep(PERIPHERAL_LOW, CLEAR_THRESHOLD, vis);
// Blend from heavy fog (alpha ~0.38) to lighter fog near clear edge
// Taper noise to zero near the clear boundary — preserves breathing in deep
// peripheral but keeps the Layer 1/2 transition clean (no curly edge)
float noise_weight = 1.0 - smoothstep(0.5, 1.0, coverage);
float alpha = mix(0.38, 0.25, coverage) + noise_val * 0.05 * noise_weight;
COLOR = vec4(DARK_OVERLAY, alpha);
}
} else if (explored > 0.3) {
// Layer 3: Deep fog (previously explored, no longer in LOS)
if (vis > CLEAR_THRESHOLD) {
// Layer 1: Clear — soft edge gradient
// Alpha matches Layer 2 at boundary (coverage=1.0 → 0.25) for continuity
float edge = smoothstep(CLEAR_THRESHOLD, 1.0, vis);
COLOR = vec4(DARK_OVERLAY, 0.25 * (1.0 - edge));
} else if (vis > PERIPHERAL_LOW || explored > 0.3) {
// Layers 2-3: smooth blend between peripheral fog and deep fog.
// Same gradient approach as the forward cone — smoothstep over the
// blur radius eliminates stair-stepped tile edges at the back of
// the vision cone.
// Layer 2: peripheral fog
float noise_val = texture(noise_tex, tile * 0.03 + vec2(time * 0.11, time * 0.07)).r;
float coverage = smoothstep(PERIPHERAL_LOW, CLEAR_THRESHOLD, vis);
float noise_weight = 1.0 - smoothstep(0.5, 1.0, coverage);
float l2_alpha = mix(0.38, 0.25, coverage) + noise_val * 0.05 * noise_weight;
// Layer 3: deep fog (explored, no longer in LOS)
// D-059: near-monochrome, ~10% zone temperature tint, 15-20s breathing cycle
vec3 zone_tint = texture(zone_tint_tex, tex_uv).rgb;
float noise_val = texture(noise_tex, tile * 0.015 + vec2(time * 0.06, time * 0.045)).r;
float noise_deep = texture(noise_tex, tile * 0.015 + vec2(time * 0.06, time * 0.045)).r;
vec3 tint_color = mix(vec3(0.04), zone_tint, 0.1);
float alpha = mix(0.62, 0.76, noise_val); // Fog breathes
COLOR = vec4(tint_color, alpha);
float l3_alpha = mix(0.62, 0.76, noise_deep);
// Back-edge gradient: blend Layer 2 → Layer 3 over the blur radius.
// PERIPHERAL_LOW * 3.0 ≈ 0.24 — matches the 3-4 tile Gaussian tail.
float back_edge = smoothstep(0.0, PERIPHERAL_LOW * 3.0, vis);
float alpha = mix(l3_alpha, l2_alpha, back_edge);
vec3 color = mix(tint_color, DARK_OVERLAY, back_edge);
COLOR = vec4(color, alpha);
} else {
// Layer 5: Unexplored, no maps — information zero
COLOR = vec4(UNEXPLORED_COLOR, 1.0);