mastodon.gamedev.place is one of the many independent Mastodon servers you can use to participate in the fediverse.
Mastodon server focused on game development and related topics.

Server stats:

5.4K
active users

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: lisyarus.github.io/blog/posts/

lisyarus blogExploring ways to mipmap alpha-tested textures

@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.

Nikita Lisitsa

@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: bsky.app/profile/trist.am/post

Bluesky Social · Tristam (@trist.am)There was a bug in my sampling code, I think this is probably about as good a result as the single SDF method will produce (there may be some errors in the final mipmap during to the 4 sprites bleeding together)

@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.