fix(render): near plane 1.0m -> 0.1m (retail Render::znear) - corner see-through-wall; file #107-#109

The collided camera eye sits 0.3m from walls (viewer_sphere radius); a 1.0m near plane clipped the wall face away, so pressing the camera into a corner showed the clear color through the wall (gate result: unchanged by the flood fix - it was never a flood bug). Retail sets Render::znear = 0.1 flat in SetFOVRad (decomp :342173, initializer :1101867). All four cameras aligned. Also files #107 (indoor spawn wedge, 3-for-3), #108 (cellar-up terrain sweep across door opening), #109 (exit-door texture/background oscillation) from the 2026-06-10 visual gate; gate confirms the dac8f6a flood fix: room-room + indoor-outdoor transitions clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-10 10:48:53 +02:00
parent dac8f6ad1f
commit 137b4f2d25
5 changed files with 68 additions and 5 deletions

View file

@ -59,8 +59,9 @@ public sealed class ChaseCamera : ICamera
public Matrix4x4 View =>
Matrix4x4.CreateLookAt(Position, _lookAt, Vector3.UnitZ);
// Near plane 0.1 m = retail Render::znear (see RetailChaseCamera.Projection).
public Matrix4x4 Projection =>
Matrix4x4.CreatePerspectiveFieldOfView(FovY, Aspect, 1f, 5000f);
Matrix4x4.CreatePerspectiveFieldOfView(FovY, Aspect, 0.1f, 5000f);
/// <summary>
/// Update the camera position to follow the player. <paramref name="isOnGround"/>

View file

@ -32,8 +32,9 @@ public sealed class FlyCamera : ICamera
}
}
// Near plane 0.1 m = retail Render::znear (see RetailChaseCamera.Projection).
public Matrix4x4 Projection
=> Matrix4x4.CreatePerspectiveFieldOfView(FovY, Aspect, 1f, 5000f);
=> Matrix4x4.CreatePerspectiveFieldOfView(FovY, Aspect, 0.1f, 5000f);
/// <summary>
/// Integrate position for one frame based on WASD + vertical keys.

View file

@ -1,4 +1,4 @@
using System.Numerics;
using System.Numerics;
namespace AcDream.App.Rendering;
@ -24,5 +24,5 @@ public sealed class OrbitCamera : ICamera
}
public Matrix4x4 Projection
=> Matrix4x4.CreatePerspectiveFieldOfView(FovY, Aspect, 1f, 5000f);
=> Matrix4x4.CreatePerspectiveFieldOfView(FovY, Aspect, 0.1f, 5000f);
}

View file

@ -38,8 +38,15 @@ public sealed class RetailChaseCamera : ICamera
public float Aspect { get; set; } = 16f / 9f;
public float FovY { get; set; } = MathF.PI / 3f;
public Matrix4x4 View { get; private set; } = Matrix4x4.Identity;
// Near plane = retail Render::znear = 0.1 m (decomp :342130/:342173/:1101867 —
// Render::SetFOVRad sets 0.1 flat; the legacy set_vdst variant is max(0.1, vdst·0.25)).
// MUST be smaller than the 0.3 m camera-collision sphere (PhysicsCameraCollisionProbe.
// ViewerSphereRadius): with the old 1.0 m near, a wall the collided eye sits 0.3 m from
// fell INSIDE the near plane and was clipped away — pressing the camera into a corner
// let you see straight through the wall to the clear color (§4 corner residual,
// user-gated 2026-06-10).
public Matrix4x4 Projection =>
Matrix4x4.CreatePerspectiveFieldOfView(FovY, Aspect, 1f, 5000f);
Matrix4x4.CreatePerspectiveFieldOfView(FovY, Aspect, 0.1f, 5000f);
// ── Public tunables (per-instance) ──────────────────────────────