Revert "fix(render): Phase A8 — mark-and-punch BEFORE indoor draw (correct WB order)"

This reverts commit b76f6d112e.
This commit is contained in:
Erik 2026-05-26 09:38:36 +02:00
parent b76f6d112e
commit c897a179fa

View file

@ -7159,33 +7159,18 @@ public sealed class GameWindow : IDisposable
if (cameraInsideCell && portalTriCount > 0) if (cameraInsideCell && portalTriCount > 0)
{ {
// Phase A8 fix (post-visual): the correct WB order is // WB Step 3: draw indoor entities first, stencil OFF.
// mark-and-punch FIRST, then indoor cells. The far-depth // Indoor entities (cell mesh + cell statics) ALWAYS draw
// punch overwrites depth at portal silhouettes to 1.0; // inside the camera-building, regardless of portal coverage.
// indoor geometry drawn AFTER the punch wins the depth
// test (its depth is closer than 1.0) and correctly
// occludes the subsequent stencil-gated outdoor pass.
// Drawing indoor first (the old order) had indoor depth
// destroyed by the punch, so terrain at 0.99 won every
// stencil-gated pixel: closed doors leaked outside,
// walls between rooms leaked far-side door openings,
// and characters bled to terrain at portal overlaps.
// WB Steps 1+2: mark stencil + punch far depth in portal regions.
_indoorStencil!.MarkAndPunch(camera.View * camera.Projection);
// WB Step 3: draw indoor entities second, stencil OFF
// (MarkAndPunch left the state stencil-disabled). Indoor
// entities ALWAYS draw inside the camera-building, regardless
// of portal coverage. Animated entities (player, NPCs) flow
// through IndoorOnly via the animatedEntityIds override so
// they're not stencil-gated by the outdoor pass.
_wbDrawDispatcher!.Draw(camera, _worldState.LandblockEntries, frustum, _wbDrawDispatcher!.Draw(camera, _worldState.LandblockEntries, frustum,
neverCullLandblockId: playerLb, neverCullLandblockId: playerLb,
visibleCellIds: visibility!.VisibleCellIds, visibleCellIds: visibility!.VisibleCellIds,
animatedEntityIds: animatedIds, animatedEntityIds: animatedIds,
set: AcDream.App.Rendering.Wb.WbDrawDispatcher.EntitySet.IndoorOnly); set: AcDream.App.Rendering.Wb.WbDrawDispatcher.EntitySet.IndoorOnly);
// WB Steps 1+2: mark stencil + punch far depth in portal regions.
_indoorStencil!.MarkAndPunch(camera.View * camera.Projection);
// WB Step 4a: terrain, stencil-gated to portal silhouettes. // WB Step 4a: terrain, stencil-gated to portal silhouettes.
_indoorStencil!.EnableOutdoorPass(); _indoorStencil!.EnableOutdoorPass();
// Phase N.5b: wrap Draw in CPU stopwatch for [TERRAIN-DIAG] rollup // Phase N.5b: wrap Draw in CPU stopwatch for [TERRAIN-DIAG] rollup