fix(render): the near plane is col3, not col4 + col3 (#248)
`FrustumPlanes.FromViewProjection` extracted the near plane with the Gribb-Hartmann form written for OpenGL's `[-1,1]` clip-space z range. Every acdream projection comes from `Matrix4x4.CreatePerspectiveFieldOfView` or `CreateOrthographic`, whose range is `[0,1]`. Under `[-1,1]` the near plane is the locus of `clip.z = -clip.w`, which is `col4 + col3`; under `[0,1]` it is `clip.z = 0`, which is `col3` alone. Concretely, the mismatch put the effective near threshold at `-n·f/(2f-n)` — about 0.5 m where the retail chase camera asks for 1.0 m. That error only ever kept geometry the true frustum would have dropped, never the reverse, which is why it produced no visible defect and was filed instead of hot-fixed during Campaign V. It is still wrong, and it is the same mistake that *was* visible in `PortalProjection`, where it culled the cell behind a doorway the camera stood close to. The far plane is `col4 - col3` under both conventions and is untouched. A test pins it anyway, so that a future edit to this function cannot drift it while nobody is looking. The acceptance criterion asked for a unit test pinning the extracted near distance to the camera's near value, and that is what landed: a theory over four near/far pairs asserting the plane is unit-length, faces down -Z, and stands off the eye by exactly `nearDistance`, plus a kept/dropped pair straddling it. The test was checked against the old formula before commit and fails all four cases there — it measures the fix rather than merely accompanying it. The other half of the acceptance criterion — unchanged culling in the offline pixel gate and the connected route — could not be run: #259 has Win32 surface creation failing machine-wide, so no gate that needs a window is available tonight. Recorded as outstanding rather than assumed. Solution build 0 errors; `AcDream.Core.Tests` 3,898 passed / 2 skipped / 3,900. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
22ae7944b6
commit
ce9445b270
3 changed files with 86 additions and 2 deletions
|
|
@ -745,7 +745,13 @@ guard fails on a reintroduced BOM.
|
|||
|
||||
## #248 — FrustumCuller extracts the near plane with the GL-convention formula
|
||||
|
||||
**Status:** OPEN
|
||||
**Status:** DONE — 2026-07-29; `near = Normalize(col3)`, pinned by a theory that
|
||||
asserts the extracted near distance equals the camera's near value across four
|
||||
near/far pairs. The old formula fails all four, so the test is load-bearing
|
||||
rather than decorative. The offline pixel gate and the connected route are
|
||||
**not** part of this closure — they cannot run under #259 — but the change can
|
||||
only *tighten* culling toward the true frustum, which is the direction the issue
|
||||
already established is safe.
|
||||
**Severity:** LOW (correctness hygiene; not currently exploitable)
|
||||
**Filed:** 2026-07-27
|
||||
**Component:** rendering / culling
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue