Sodium

Sodium

49M Downloads

Compatibility with Legacy Mipmaps

Permdog99 opened this issue ยท 1 comments

commented

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?

commented

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.