From b537f3a95288879c0b2cdbbdb4a8e89858ba8566 Mon Sep 17 00:00:00 2001 From: Erik Date: Mon, 27 Jul 2026 22:38:02 +0200 Subject: [PATCH] Revert "feat(render): Campaign V slice V4d-1 - converge terrain's view and projection" This reverts commit 0cb1059765446336509c2d605ae8a782c1b90fbc. --- .../Rendering/Shaders/terrain_modern.vert | 12 +++--------- src/AcDream.App/Rendering/TerrainModernRenderer.cs | 7 ++----- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/AcDream.App/Rendering/Shaders/terrain_modern.vert b/src/AcDream.App/Rendering/Shaders/terrain_modern.vert index c3fc9b4c..db8224ef 100644 --- a/src/AcDream.App/Rendering/Shaders/terrain_modern.vert +++ b/src/AcDream.App/Rendering/Shaders/terrain_modern.vert @@ -13,14 +13,8 @@ layout(location = 3) in uvec4 aPacked1; layout(location = 4) in uvec4 aPacked2; layout(location = 5) in uvec4 aPacked3; -// Campaign V slice V4d-1 (2026-07-27): uView/uProjection converged into the -// single uViewProjection that GpuPushConstants carries, so terrain can move -// onto the pinned push-constant block at V4d-2. The product is now formed on -// the CPU (camera.View * camera.Projection) instead of per vertex here; the -// two are the same transform, and System.Numerics' row-vector layout uploaded -// untransposed reads in GLSL as the transpose, so (View*Proj)^T == Proj^T * -// View^T is exactly the uProjection * uView this replaced. -uniform mat4 uViewProjection; +uniform mat4 uView; +uniform mat4 uProjection; struct Light { vec4 posAndKind; @@ -171,7 +165,7 @@ void main() { // the un-nudged heightmap via TerrainSurface.SampleZ. // Closes issue #100; supersedes the hiddenTerrainCells cell-collapse hack. vec3 terrainPos = vec3(aPos.xy, aPos.z - 0.01); - gl_Position = uViewProjection * vec4(terrainPos, 1.0); + gl_Position = uProjection * uView * vec4(terrainPos, 1.0); // Phase U.3: terrain clip gate against the single OutsideView region. With // uTerrainClipCount == 0 (U.3 default) the first loop is skipped and the diff --git a/src/AcDream.App/Rendering/TerrainModernRenderer.cs b/src/AcDream.App/Rendering/TerrainModernRenderer.cs index 6f5bb8c3..643a2d1a 100644 --- a/src/AcDream.App/Rendering/TerrainModernRenderer.cs +++ b/src/AcDream.App/Rendering/TerrainModernRenderer.cs @@ -501,11 +501,8 @@ public sealed unsafe class TerrainModernRenderer : IDisposable // unified camera matrix everywhere, so no separate viewpoint divergence can occur. _shader.Use(); UploadTextureTilingOnce(); - // Campaign V slice V4d-1: one uViewProjection, matching the field - // GpuPushConstants already carries, instead of the separate uView and - // uProjection the shader used to combine per vertex. viewProjection is - // the same product the visibility pass above already computed. - _shader.SetMatrix4("uViewProjection", viewProjection); + _shader.SetMatrix4("uView", camera.View); + _shader.SetMatrix4("uProjection", camera.Projection); var (terrainHandle, alphaHandle) = _atlas.GetBindlessHandles(); // Campaign V slice V2b: pass each handle's binding=9 table slot