Mip distance

Started by
3 comments, last by hplus0603 18 years, 1 month ago
Is it possible to adjust the distance DirectX uses to find the mip level to render? Or would this always have negative results? It seems to me that the camera currently needs to be smashed against the triangles to even view the actual resolution of the textures. At moderate distance, everything looks very blurry. I appreciate any help with this, thanks. edit: I'm using D3DX_FILTER_BOX as the mip filter and D3DX_FILTER_TRIANGLE as the scaling filter when calling D3DXCreateTexture* functions.
Advertisement
Yep, the D3DSAMP_MIPMAPLODBIAS and D3DSAMP_MAXMIPLEVEL sampler states (IDirect3DDevice9::SetSamplerState) let you control exactly that [smile].

Caveat: mip mapping improves the likelihood of texture cache hits (performance win), fiddling with the mip distances can lose a small bit of that benefit - but it shouldn't be too significant unless your application is heavily texture bound.

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

Is it unusual to adjust the LOD value? Any advice on what works best, considering the most frequent camera distance?

The documentation doesn't seem to give any hints as to what values do what, or what the value even represents. I'll look around on Google. But any other info will be helpful.

Thanks much for your time.

edit:

Ah, I wasn't casting from a float value. Now I can see results. This looks like it might work for me. Thanks for the help!

[Edited by - Kest on March 11, 2006 5:30:20 PM]
Quote:Original post by Kest
Is it unusual to adjust the LOD value?


Not that unusual, but it's usually done as a last minute tweak after an artist says something is too blurry or sharp.

If it's necessary early on, it can indicate an inadequacy with your mip chain creation method or inconsistent texel density with your texture mapping.

Generally, a simple box or triangle filter is going to be fast (so suited to load time), but isn't going to produce results that look as good as more sophisticated offline methods.

Additionally, you'll get better looking scenes if all objects are textured at a consistent density ("n texels per metre").

Jonathan Blow's Inner Product column in Game Developer Magazine had a good two part discussion regarding mip chain generation methods:

http://number-none.com/product/Mipmapping,%20Part%201/index.html
http://number-none.com/product/Mipmapping,%20Part%202/index.html


Quote:Any advice on what works best, considering the most frequent camera distance?


TBH it really does depend on your particular application - how consistent your texel density is; whether textures are seen side-on or front-on; chance of minification vs magnification; how detailed/high frequency the texture is; the MIP filter type in use (bilinear vs trilinear vs anisotropic); how much blurriness has been introduced by the mip chain generation; etc.


Quote:edit:

Ah, I wasn't casting from a float value. Now I can see results. This looks like it might work for me. Thanks for the help!


Glad you got it working [smile].

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

The MIP level that the card chooses is mathematically chosen to attempt to map one screen pixel to one texture texel, more or less. When the texture is highly anisotropic (say, ground, or a sky plane, or house walls going past on the side), then this is hard for the card, because one direction says "use a high LOD" and another says "use a low LOD".

The solution to that problem is to turn on anisotropic texture filtering. At least level 8 should be on for decent results with typical road-with-lines textures. Anisotropic filtering may be slower than trilinear for highly slanted textures, but it's still likely faster than the equivalent MIP LOD bias would be.
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement