From 748f35ccb87f8382c5b49c9189798b339ff4fde8 Mon Sep 17 00:00:00 2001 From: Bastiaan Olij Date: Thu, 11 Sep 2025 20:53:19 +1000 Subject: [PATCH] Fix fixed size flag on StandardMaterial3D when rendering in stereo --- scene/resources/material.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index cd42fd1e064..a26d604bd78 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -1357,7 +1357,7 @@ void vertex() {)"; if (flags[FLAG_FIXED_SIZE]) { code += R"( // Fixed Size: Enabled - if (PROJECTION_MATRIX[3][3] != 0.0) { + if (PROJECTION_MATRIX[2][3] == 0.0) { // Orthogonal matrix; try to do about the same with viewport size. float h = abs(1.0 / (2.0 * PROJECTION_MATRIX[1][1])); // Consistent with vertical FOV (Keep Height). @@ -1367,7 +1367,7 @@ void vertex() {)"; MODELVIEW_MATRIX[2] *= sc; } else { // Scale by depth. - float sc = -(MODELVIEW_MATRIX)[3].z; + float sc = length((MODELVIEW_MATRIX)[3].xyz); MODELVIEW_MATRIX[0] *= sc; MODELVIEW_MATRIX[1] *= sc; MODELVIEW_MATRIX[2] *= sc;