CaffeineMC / sodium

A Minecraft mod designed to improve frame rates and reduce micro-stutter
Other
4.77k stars 811 forks source link

Try to preserve mipmapping as much as possible. #2650

Open djmrFunnyMan opened 2 months ago

djmrFunnyMan commented 2 months ago

Request Description

I assume this would complicate the mipmapping code greatly but I think it'd be worth it since it'll greatly improve the visuals for end users and shield them from the errors of mod and texturepack devs.

I have some ideas on how this could be done. If they're bad ignore them (I have no idea what I'm talking about) but don't discard the feature request because of them, I'll just edit them out and leave only the short description.

  1. If there's a low power of 2 texture, make duplicate mipmaps for it instead of lowering the mip levels. So for example, if there's an 4x4 texture, instead of lowering all mipmaps to 2x just have it use the same resolution for levels 0,1,2 and then generate mips normally for 3 and 4

So it'd look like this, for 8x8, 4x4 and 2x2 textures (and16x16 for reference)

  1. For NPOT textures idk. Maybe force them into a separate "npot atlas" so while they won't have mipmapping they won't break it globally.
Permdog99 commented 1 month ago

As the creator of Legacy Mipmaps, I've had to study how Java and other versions of MC create their mipmapping. In reality, it is better to add more mipmapping levels for higher resolution textures rather than trying to add more atlases specifically for a singular texture that is smaller than the rest (or even bigger).

Every sprite is on an atlas and is mipmapped before being put on that atlas (iirc). If you try to make a singular sprite use a different mipmapping level than other sprites, then that sprite would be significantly bigger on the atlas than all others. trying to get this to work would require severely altering how mipmapping and atlases are made which would break a lot of things.

It's a cool suggestion, but it doesn't have much of a benefit for performance and could do more harm than good

Felix14-v2 commented 1 month ago

Better Mipmaps can offer texture upscaling and support for high resolution textures (up to 1024x).