Mipmap selection in too much detail

In this post, I want to shed some light on something I’ve been wondering about for a while: How exactly are mipmap levels selected when sampling textures on the GPU? If you already know what mipmapping is, why we use it, and what pixel derivatives (ddx() / ddy()) are, you can skip to the section Derivatives to mipmap levels. The post does, however, assume some knowledge of graphics programming.

pema.dev
🌘 紋理採樣的mipmap選擇詳解
➤ 揭開GPU紋理採樣的神祕面紗
https://pema.dev/2025/05/09/mipmaps-too-much-detail/
本文深入探討了GPU在紋理採樣時如何選擇mipmap級別。文章首先簡要介紹了mipmap技術及其解決紋理異化問題的原理,並指出標準的紋理採樣函數`Texture2D.Sample()`會自動選擇適當的mipmap級別。然而,作者認為這解釋不夠深入,因此進一步探討了GPU具體如何做到這一點。文章接著解釋了片段著色器如何利用像素四邊形計算屏幕空間的偏導數`ddx()`和`ddy()`,並揭示了`Texture2D.Sample()`實際上是`Texture2D.SampleGrad()`的簡化形式。最終,作者根據GLES3.0規格,闡述了mipmap級別與偏導數之間的數學關係,即mipmap級別等於scale factor的以2為底的對數,其中scale factor基於u和v座標的偏導數的計算。
+ 這篇文章寫得非常棒,深入淺出地解釋了mipmap選擇的機制
#圖像處理 #圖形渲染 #GPU #mipmap
Mipmap selection in too much detail

In this post, I want to shed some light on something I’ve been wondering about for a while: How exactly are mipmap levels selected when sampling textures on the GPU? If you already know what mipmapping is, why we use it, and what pixel derivatives (ddx() / ddy()) are, you can skip to the section Derivatives to mipmap levels. The post does, however, assume some knowledge of graphics programming.

pema.dev

"Come lo feci" di @byloth Von Frankenstein

#TileMap & #Mipmap: non vanno d'accordo...
Online è una cosa risaputa; «Everyone knows it!» - mi han risposto, in un forum!

«#YesBut... Why?» - e cadeva il silenzio...

Qualcuno ha provato a darmi delle risposte che -sul momento- ho preso per buone... In seguito, rivelatesi errate!

Ci ho messo 2 settimane...
Ma potrò lasciare ai posteri il mio retaggio: come usare tilemap e mipmap insieme.

https://discourse.threejs.org/t/seams-artifacts-between-texture-tiles-when-using-mipmaps/72979/12

«Si può fare!» 🤯

#BDDGZProject

Seams / Artifacts between texture tiles when using Mipmaps

Got it! 🤯 I finally understand what the problem actually is and why this happens! Thanks again to everyone who took the time to help me with my question. Really appreciated! ❤ TL;DR So… If you’re interested -like me- in understanding what’s happening here and -more importantly- WHY it happens… You’re -of course- in the right place. 😉 It all started with this CodePen, which I’d already shared previously: At first, it wasn’t clear to me how the fwidth function ...

three.js forum

Ok, ma...
Di preciso, cos'è una #Mipmap?

Una Mipmap non è nient'altro che un insieme di immagini -progressivamente sempre più piccole e meno definite- che vengono calcolate a partire dalla #Texture principale.

La #GPU utilizza queste immagini per colorare i pixel in maniera differente. Semplificando molto: più il "pixel" si trova vicino al POV e più userà un'immagine grande e definita.
Più il "pixel" sarà distante e più userà quelle piccole e sfocate.

https://it.wikipedia.org/wiki/MIP_map

MIP map - Wikipedia

Ma perché -di preciso- reputo così tanto importante l'uso delle #Mipmap?
Non posso -semplicemente- sbattermene e non usarle?

Certo! Potrei farlo, ovviamente!

MA...
1) La resa grafica diventa NETTAMENTE migliore, se utilizzate.
2) Ho delle manie di perfezionismo; se so che una cosa può esser fatta meglio, DEVO farla meglio per forza. Ahime... 🥲

In allegato, #Minecraft a confronto con e senza l'uso delle Mipmap.
Sono sicuro sarà più chiaro perché insisto così tanto sul loro uso... 😉

Migrazione a #ThreeJS.

Il primo problema è che -la libreria- non dispone di un componente già pronto per la gestione delle #TileMap (a differenza di #BabylonJS).

Online non ho trovato nulla che facesse al caso mio...
Mi metto -quindi- di buona lena ad implementarlo.

Un banale piano, una texture da caricare e qualche riga di #TSL da scrivere... E le famose #Mipmap?

Le abilito ma -anche il mio #Shader, come quello di Babylon- non le gestisce correttamente.

Qui il risultato. 😞

#BDDGZProject

We’re excited to announce the release of #AMD Compressonator 4.4!

The latest version includes:

🗜️ AVX-512 support in Compressonator Core
🗜️ A new #mipmap generation option in Compressonator CLI

Head over to #GPUOpen to find out more: https://gpuopen.com/learn/compressonator-avx-512-bc1-encoding/?utm_source=mastodon&utm_medium=social&utm_campaign=compressonator

Introducing Compressonator v4.4 with AVX-512 support for BC1 Encoding

Compressonator v4.4 adds AVX-512, AVX2, and SSE4 variations of BC1 encoding in the Compressonator Core library, new CLI options, and more.

AMD GPUOpen

🗜️ Introducing #Compressonator v4.3! 🗜️

Our latest release features:

✨ Support for AMD's new Brotli-G #lossless #compression
✨ Multi-texture #mipmap generation
#BCn transcoding

Plus more - take a look at our new blog on #gpuopen:

https://gpuopen.com/learn/compressonator-v4-3-brotli-g/?utm_source=twitter&utm_medium=social&utm_campaign=compressonator

Introducing Compressonator v4.3

Compressonator v4.3 is out now! v4.3 features Brotli-G lossless compression, multi-texture mipmap generation, and much more.

GPUOpen