From 10189f2cd40a1046315281543e748668d0f8a098 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo?= Date: Thu, 23 Jul 2026 20:46:33 -0300 Subject: [PATCH] Add small value to Orthographic projection's Z far. (#305) --- lib/rt64 | 2 +- patches/camera_transform_tagging.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/rt64 b/lib/rt64 index 064d80b..6f1c2d9 160000 --- a/lib/rt64 +++ b/lib/rt64 @@ -1 +1 @@ -Subproject commit 064d80b4ceaf0e9308cbbc5b83c0fedd38984ef1 +Subproject commit 6f1c2d99a4ea571c139f449c326fd176ba8f3496 diff --git a/patches/camera_transform_tagging.c b/patches/camera_transform_tagging.c index ee43a2f..af18adb 100644 --- a/patches/camera_transform_tagging.c +++ b/patches/camera_transform_tagging.c @@ -118,7 +118,9 @@ RECOMP_PATCH void viewport_setRenderViewportAndOrthoMatrix(Gfx **gfx, Mtx **mtx) gSPViewport((*gfx)++, &sViewportStack[sViewportStackIndex]); // @recomp Use a high precision version of the projection matrix instead of the fixed precision one. This fixes accuracy issues when rendering text using the orthographic projection. - guOrthoF(*mtx, -(2 * (f32)gFramebufferWidth), (2 * (f32)gFramebufferWidth), -(2 * (f32)gFramebufferHeight), (2 * (f32)gFramebufferHeight), 1.0f, 20.0f, 1.0f); + // A small Epsilon is required to give some room to the text to render, as it's placed on the very edge of the far plane. Higher precision causes the text to disappear otherwise. + const float Epsilon = 1e-2f; + guOrthoF(*mtx, -(2 * (f32)gFramebufferWidth), (2 * (f32)gFramebufferWidth), -(2 * (f32)gFramebufferHeight), (2 * (f32)gFramebufferHeight), 1.0f, 20.0f + Epsilon, 1.0f); gEXMatrixFloat((*gfx)++, OS_K0_TO_PHYSICAL((*mtx)++), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); #if 0