Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with Legacy Mipmaps #2866

Open
Permdog99 opened this issue Nov 4, 2024 · 1 comment
Open

Compatibility with Legacy Mipmaps #2866

Permdog99 opened this issue Nov 4, 2024 · 1 comment
Labels
A-mods Area: Mod compatibility T-bug Type: Bug

Comments

@Permdog99
Copy link

Hello! I am the developer of the mod Legacy Mipmaps, which aims to bring old mipmapping types from Legacy Console Edition. It's a mod used in popular modpacks like Re-Console.

One of the biggest problems I have faced when trying to get mipmapping to look nice is a specific problem with Sodium. I have attached an image.

Sodium on the right, no Sodium on the left.
image

Clearly it seems like Sodium changes how textures work in some way that is causing this big black border.

As the developer, I am trying to find a way to fix this incompatibility with Sodium so I can rest easy at night. Could you point me into the right direction to fix this?

@jellysquid3
Copy link
Member

jellysquid3 commented Nov 4, 2024

Sodium makes some changes to mip-map generation:

  • When fully transparent pixels in the texture are found, they get replaced with an average color of all non-transparent pixels. This is because image editing software will discard the color values of all transparent pixels, and at the edges of cutout textures, the downsampling algorithm ends up blending discarded texels into the final result, which makes the overall texture appear too dark.
  • Color values are converted from sRGB to Linear RGB and then blended in this space, before getting converted back to sRGB. This is necessary since sRGB has non-linear brightness and therefore averaging such values will produce colors with the wrong brightness. But this is only correct for the RGB channels, and not the Alpha channel, which Minecraft incorrectly applies.
  • When down-sampling, the alpha values are also sampled, which means that if 50% of the sampled texels are transparent, the final result will be 50% transparent.

@jellysquid3 jellysquid3 changed the title [MOD SUPPORT] Legacy Mipmaps Compatibility with Legacy Mipmaps Nov 12, 2024
@jellysquid3 jellysquid3 added T-bug Type: Bug A-mods Area: Mod compatibility labels Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mods Area: Mod compatibility T-bug Type: Bug
Projects
None yet
Development

No branches or pull requests

2 participants