Jump to content
  • Advertisement
Sign in to follow this  

Setting LOD Bias and Maximal Mip Level

This topic is 2972 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've got annoying problem with making DX to set just two values. I want to be able to do the following:
- set texture's (or sampler's, whatever) LOD bias so that texture would start using mipmaps not from the largest level 0, but from.. let's say.. 1st or 2nd
- set the maximal mip level used. Value, which set, for instance, to 2, would cause using only mip levels 0, 1 and 2
These two things can be set quite easily when I load mipmaps in software. I can create a texture with 3 mipmaps with D3DXCreateTextureFromFileEx and set it's LOD bias with SetLOD function from IDirect3DBaseTexture. And it works. The problem is when I generate the mipmaps in hardware (by using 1 mipmap during the just-mentioned function call and setting D3DUSAGE_AUTOGENMIPMAP). In that case SetLOD doesn't work and I am left with the whole chain of automatically generated mipmaps.
I've searched the DX SDK and found these samplers states:

Mipmap level-of-detail bias. The default value is zero.
level-of-detail index of largest map to use. Values range from 0 to (n - 1) where 0 is the largest. The default value is zero.

I noticed that I can use MAXMIPLEVEL as my LOD bias value. When I set it to 1, the biggest mip level used is the 1st one (instead of the 0th).
But I just can't find any way to control the number of mipmaps loaded. I've tried to use MIPMAPLODBIAS with negative values but the results are quite.. unpredictable.

I'd like to mention that although usually I find D3D much easier and neater in use, in this particlar case, OGL is incomparably better:

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, (mipmapsNum == 0 ? 1000 : mipmapsNum - 1));

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!