fix(fast3d): don't clamp HD textures to an undefined tile region#1135
Open
bassdr wants to merge 1 commit into
Open
fix(fast3d): don't clamp HD textures to an undefined tile region#1135bassdr wants to merge 1 commit into
bassdr wants to merge 1 commit into
Conversation
Kenix3#1118 made HD replacement textures always clamp their sampled size to the rendered tile region (tex_width2/tex_height2). When a tile has no size set (lrs <= uls) that region collapses to ~1 texel, so the clamp shrinks the UV normalizer and the upscaled texture tiles across the primitive. This hit CI8 eye textures that load via segment with an unset tile size and wrap-sample (adult Zelda / Sheik), rendering the HD eye as a small repeated grid. Only force the HD tile-region clamp when the tile actually defines a region (lrs > uls / lrt > ult); pyramid-like and explicit G_TX_CLAMP paths are unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jun 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
With an HD texture pack, characters whose CI eye/face textures are loaded via segment with an unset tile size render those textures as a small repeated grid. Most visible on adult Zelda / Sheik in the Temple of Time. Vanilla textures are unaffected; it only appears with HD replacements enabled.
Root cause
Regression from #1118. That change made HD replacement textures always clamp their sampled width/height to the rendered tile region (
tex_width2/tex_height2) via theisHdflag inGfxSpTri1.These eye textures use a tile with no size set (
lrs == uls == 0), sotex_width2 = (lrs - uls + 4) / 4 = 1. TheisHdclause then clampstex_widthfrom its real 32 down to 1. Sincetex_widthis also the UV normalizer (u / tex_width), the vertex UVs (authored 0..32) now span 0..32, and with wrap addressing (cms == 0) the upscaled texture tiles ~32x across the primitive.Instrumentation at the clamp, one HD CI8 draw (broken eye
i=1vs. a face tilei=0with a real region):Before #1118 these textures rendered fine: they are wrap-mode and not pyramid-like, so the tile-region clamp never applied.
Fix
Only force the HD tile-region clamp when the tile actually defines a region (
lrs > uls/lrt > ult). The pyramid-like and explicitG_TX_CLAMPpaths are unchanged, and HD textures that genuinely define a smaller sub-region (the case #1118 targeted) still clamp as before.Scope and testing
Affects any HD pack drawing actors that segment-swap a CI eye/face texture with an unset tile size (adult Zelda, Sheik, likely others). Tested with an HD pack on the Temple of Time Sheik-reveal cutscene: the eye renders correctly after the change, with no regressions seen on other textures (HUD, world, faces with real tile regions).