Add small value to Orthographic projection's Z far. (#305)

This commit is contained in:
Darío
2026-07-23 20:46:33 -03:00
committed by GitHub
parent 815f497277
commit 10189f2cd4
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -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