<p>When you are making an SDF, you commonly have infinitely detailed data (like, bezier curves making up a letter) that you are making into an SDF image of a specific size.</p>

<p>If you make one that is 64x64, the first mip will be 32x32. The right way to make that mip is to do the original process of creating the SDF texture from the source data, but do it at 32x32 instead of 64x64. Repeat for the other mips.</p>

<p>It will break down at lower resolutions though, but that is just the nature of how SDFs work. The more correct, but slower way is to do super sampling. Take multiple samples at different places in the pixel and average the result.</p>

CC BY-SA 4.0
2019-11-14T02:29:41.417Z
2019-11-14T02:59:30.000Z
2019-11-14T02:59:30.000Z
Alan Wolfe
<p>From what I've found, signed distance fields are not suited for minification (drawing the text on fewer pixels on screen than it covers in the texture), no matter how you mip-map them. Their main use case is magnification, and they shine here, because you don't need to increase the size of the distance field texture when the renderered object increases in size on screen.</p>

<p>To render (e.g. text) with signed distance fields:</p>

<ul>
<li>the texture should be large enough so that it represents the full geometric detail of the object you're trying to render. A good rule of thumb is that each line/stroke of your glyphs in the texture should be at least 2 pixels wide.</li>
<li>the object that you draw on screen with a distance field-based texture should be larger on screen that in the texture (e.g. a glyph that covers 64x64 pixels in the distance field texture should cover at least 64 pixels in each direction on screen)</li>
</ul>

<p>If those properties don't hold for your use case then better use a directly rasterized texture - not a distance field - , as those mip-map much better.</p>

CC BY-SA 4.0
2019-11-12T08:21:55.943Z
2019-11-12T08:21:55.943Z
Dreamer
<p>Is there some algorithm that keeps details when creating mipMaps for SDF?
For example group of 4 pixels when only one is above threshold will lose this pixel with bilinear and creating mipMaps with 'max' of those values will add noise. 
When purpose of SDF is keeping the same image in lower resolution what is the best way to downsample this image?</p>

<p>For generating SDF i use <a href="http://www.codersnotes.com/notes/signed-distance-fields/" rel="noreferrer">8SSEDT</a></p>

<texture><signed-distance-field><mipmap>
MipMaps for Signed Distance Field
Derag
# MipMaps for Signed Distance Field

(Asked by: username_0 on 2018-07-03)

Is there some algorithm that keeps details when creating mipMaps for SDF?
For example group of 4 pixels when only one is above threshold will lose this pixel with bilinear and creating mipMaps with 'max' of those values will add noise.
When purpose of SDF is keeping the same image in lower resolution what is the best way to downsample this image?

For generating SDF i use [8SSEDT](http://www.codersnotes.com/notes/signed-distance-fields/)

**Tags:** texture, signed-distance-field, mipmap


---

## 2 answers

### Answer by username_1 on 2019-11-14. Score: 3 | Accepted answer

When you are making an SDF, you commonly have infinitely detailed data (like, bezier curves making up a letter) that you are making into an SDF image of a specific size.

If you make one that is 64x64, the first mip will be 32x32. The right way to make that mip is to do the original process of creating the SDF texture from the source data, but do it at 32x32 instead of 64x64. Repeat for the other mips.

It will break down at lower resolutions though, but that is just the nature of how SDFs work. The more correct, but slower way is to do super sampling. Take multiple samples at different places in the pixel and average the result.


---

### Answer by username_2 on 2019-11-12. Score: 3

From what I've found, signed distance fields are not suited for minification (drawing the text on fewer pixels on screen than it covers in the texture), no matter how you mip-map them. Their main use case is magnification, and they shine here, because you don't need to increase the size of the distance field texture when the renderered object increases in size on screen.

To render (e.g. text) with signed distance fields:

* the texture should be large enough so that it represents the full geometric detail of the object you're trying to render. A good rule of thumb is that each line/stroke of your glyphs in the texture should be at least 2 pixels wide.
* the object that you draw on screen with a distance field-based texture should be larger on screen that in the texture (e.g. a glyph that covers 64x64 pixels in the distance field texture should cover at least 64 pixels in each direction on screen)

If those properties don't hold for your use case then better use a directly rasterized texture - not a distance field - , as those mip-map much better.


---

