# Setting LOD Bias and Maximal Mip Level

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

## 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:
D3DSAMP_MIPMAPLODBIAS Mipmap level-of-detail bias. The default value is zero. D3DSAMP_MAXMIPLEVEL 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_MIN_LOD, LODBias);glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, (mipmapsNum == 0 ? 1000 : mipmapsNum - 1));

##### Share on other sites

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