From d2f604b783b99216530cd77f1525bbdfa30d2344 Mon Sep 17 00:00:00 2001 From: zzuegg Date: Wed, 11 Mar 2026 13:22:57 +0100 Subject: [PATCH] fix: correct parallel projection frustum plane normals for left/right MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit getLeft() returns up×direction but fromFrame() uses direction×up as the view matrix X axis. These are negatives of each other. The hardcoded parallel projection coefficients (1 for left, -1 for right) built plane normals from getLeft(), causing them to point opposite to the view matrix. This made frustum culling reject visible geometry for any camera with a non-standard orientation (e.g. looking along +Z) or asymmetric frustum values in parallel projection mode. Fix: negate the left/right coefficients so plane normals align with the view matrix's X axis. Co-Authored-By: Claude Opus 4.6 --- jme3-core/src/main/java/com/jme3/renderer/Camera.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/renderer/Camera.java b/jme3-core/src/main/java/com/jme3/renderer/Camera.java index 35f9b8d806..e623d392f8 100644 --- a/jme3-core/src/main/java/com/jme3/renderer/Camera.java +++ b/jme3-core/src/main/java/com/jme3/renderer/Camera.java @@ -1344,10 +1344,14 @@ public void onFrustumChange() { coeffTop[0] = -frustumNear * inverseLength; coeffTop[1] = frustumTop * inverseLength; } else { - coeffLeft[0] = 1; + // getLeft() returns up×direction, but the view matrix (fromFrame) + // uses direction×up = -getLeft() as its X axis. Negate the left/right + // coefficients so the frustum plane normals match the view matrix, + // giving correct culling for any camera orientation. + coeffLeft[0] = -1; coeffLeft[1] = 0; - coeffRight[0] = -1; + coeffRight[0] = 1; coeffRight[1] = 0; coeffBottom[0] = 1;