New blog post! The discussions about mipmapping alpha-tested textures made me wanna try all the methods I could find and post the results with a ton of textures to compare these methods: https://lisyarus.github.io/blog/posts/exploring-ways-to-mipmap-alpha-tested-textures.html
@lisyarus Since you’re doing alpha stencil, you may want to treat the alpha channel as a signed distance field. It will get you smoother edges on your cutouts and regular mipmapping might just work.
@jkaniarz How exactly would I do that? I mean, just leaving it as it is already kinda treats it as an SDF. Do you mean preprocessing the alpha channel to make sure it is an SDF or smth?
@lisyarus I don’t know how to convert raster images to SDF other than counting pixel distance. But what I’m getting at is if your alpha channel was close to 50% at the edge of the sprite and tapered with distance, normal resizing algorithms would preserve that edge. Right now you’ve got a 0%, 100% cliff and are hoping it smooths out to something useful.
You’d still need to use some of your tricks for getting the color channel to not blend with the transparent area.
@jkaniarz I don't have a 0%/100% cliff, I'm only showing it in the article because that's what we'll see on screen. The actual alpha channel is smooth.
I know of ways to convert the images to an SDF, I'm just not sure what to do next with it. Do you suggest just downsampling it with usual averaging?
Btw Tristam on bluesky suggested sampling this SDF to directly generate all mipmap levels (without hierarchical construction), and it looks promising: https://bsky.app/profile/trist.am/post/3lf5lgga5tc23
@lisyarus That’s exactly what I’m getting at and it looks like he has more experience with it than me. I’ve only used SDF for text.