Add smoothBlend functionality to crispBlend for transparent texture mipmaps#1104
Open
TorutheRedFox wants to merge 1 commit intosmartcmd:mainfrom
Open
Add smoothBlend functionality to crispBlend for transparent texture mipmaps#1104TorutheRedFox wants to merge 1 commit intosmartcmd:mainfrom
TorutheRedFox wants to merge 1 commit intosmartcmd:mainfrom
Conversation
fixes water opacity in default texture pack
Author
|
Video of how water now looks 2026-03-10.10-37-59.mp4 |
Collaborator
|
That does look a lot better. Was this particular bug ever fixed in LCE in like a future TU? |
Author
|
i don't recall it ever getting fixed |
Collaborator
|
While this does look better to me, if this is a departure from how LCE has historically looked it should be a setting to enable the fix rather than having it default on. |
Author
|
i'd need some assistance with the swf modding then |
|
Could we get some before vs now photos? |
Author
|
when i get home :P |
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.
Description
Fixes water opacity in default texture pack, making it no longer fully opaque when mipmaps kick in.
Changes
Previous Behavior
Water was fading to opaque due to crispBlend destroying texture alpha in mipmaps.
Root Cause
This seems to be a long standing bug in LCE because they used Notch's crispBlend algorithm to blend texels when calculating mipmaps in realtime, which is intended for cutout textures, not transparent textures. Java edition scrapped the generation of mipmaps for a good while, but in its unused implementation it used smoothBlend to calculate the mips for textures that were supposed to be transparent, i.e. water. This PR just merges their functionality based on the detected alpha value of the pixels.
New Behavior
Transparent textures such as water keep their transparency in their mipmaps.
Fix Implementation
If both pixels involved in the blend operation have an alpha value less than 224, they'll be treated as transparent and the smoothBlend algorithm is used to blend the pixels instead, preserving the alpha in the process. If either pixel has an alpha value of 224 or more, crispBlend blends them as normal to avoid losing detail in cutout textures.
AI Use Disclosure
No AI was used in the making of this code.