X Tutup
Skip to content

Round values after renormalization when generating mipmaps.#111841

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
blueskythlikesclouds:mipmap-normalize-fix
Oct 20, 2025
Merged

Round values after renormalization when generating mipmaps.#111841
Repiteo merged 1 commit intogodotengine:masterfrom
blueskythlikesclouds:mipmap-normalize-fix

Conversation

@blueskythlikesclouds
Copy link
Contributor

@blueskythlikesclouds blueskythlikesclouds commented Oct 20, 2025

This prevents flat regions of normal maps from progressively getting darker, and causing the normal to distort by distance as a result.

For example, when the pixel value is [128, 128, 255], the renormalization makes it [127.999~, 127.999~, 254.999~], which gets floored to [127, 127, 254]. When that also gets normalized, the X and Y become 126.996~, and it progressively gets smaller with each mip level, which causes distortion. Rounding fixes this.

Upstream This PR
master pr

Test scene is from here.

@blueskythlikesclouds blueskythlikesclouds requested a review from a team as a code owner October 20, 2025 10:35
@Repiteo Repiteo merged commit 9cefa0d into godotengine:master Oct 20, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Oct 20, 2025

Thanks!

@akien-mga akien-mga added the cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release label Oct 22, 2025
@akien-mga
Copy link
Member

Cherry-picked for 4.5.2.

@akien-mga akien-mga removed the cherrypick:4.5 Considered for cherry-picking into a future 4.5.x release label Jan 8, 2026
@blueskythlikesclouds blueskythlikesclouds deleted the mipmap-normalize-fix branch January 15, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

X Tutup