Skip to content

Manual mipmapping + Texture padding

BlueStaggo requested to merge BlueStaggo/SRB2:mipmapfix into next

Currently, mipmapping and linear texture filtering results in ugly black outlines on transparent edges. In this commit, I fixed this by making the game generate mipmaps through a C function instead of relying on whatever OpenGL does as well as adding color padding to the transparent borders of textures when necessary. Here is what it looks like with trilinear filtering:

Before
no-pad

After
pad

The only drawback to this method I used is that it makes texture loading slower when using a texture filtering option other than nearest which does not trigger any of the new code (the majority of players will probably continue sticking with nearest anyways). I'm not entirely sure what I can do to make it faster but if anyone can give me any improvements that would be great. After all, I'm just experimenting here. Mid-textures and transparent flats are unaffected as even though I have made a quick and dirty private adaptation to my padding algorithm to support wrapped textures, they seem to work in their own ways.

Merge request reports

Loading