Mipmap selection in too much detail

luu | 74 points

Author here - I imagine this is a bit too niche to get much traction on HN. There's a bit of discussion on bsky https://bsky.app/profile/pema99.bsky.social/post/3lotdtgowf2...

pema99 | 3 days ago

Insane deep-dive! Framing texture sampling as "Ideally, we’d like to integrate over the projection of the screen pixel onto the texture" was enlightening for me. I particularly enjoyed the explanation of anisotropic filtering because it always seemed like magic to me, and in the context of aligning ellipses on textures it just makes sense :D

kajkojednojajko | 3 hours ago

Pretty cool seeing someone dig this deep - I always wish I understood these graphics tricks better

gitroom | 2 hours ago

This isn't my specialty, and ultimately it really doesn't matter to the core point of this good submission about how the GPU chooses mipmap level to use, however the article gives the impression that we pre-calculate mipmap levels to improve distant aliasing, though the problem they demonstrate is solved with trivial texture filtering.

Mipmaps are a performance optimization. You could just use a 4096x4096 brick texture across your entire game, and then use texture filtering to make it look good both close and far, but that means that rendering a distant wall polygon that might fill just a few pixels of the viewport needs to filter and apply a 16.7 million texel texture, redoing the filtering again and again and evicting everything else from caches just for that one texture. If instead it can apply a 32x32 pre-filtered texture to loads of distant objects, there are obviously massive performance ramifications. Which is why mipmaps are used, letting massive textures be used for those cases where the detail is valuable, without destroying performance when it's just some distant object.

llm_nerd | an hour ago

    "You couldn’t implement these functions yourself - they are magic intrinsics which are implemented in hardware"
But why?
aeonik | 2 days ago

Ap Kon he

lifelesson701 | 4 hours ago