Nadine

10-03-2004, 08:08 PM

In my program, I need to compute the mipmap level for each vertex or each fragment manually. Is there any feasible way to compute it in vertex or pixel shader?

The sample codes from NVidia give the following method,

HPosition = mul(matModelViewProj, Obj.Position);

LOD = (HPosition.z/HPosition.w)*MaxMipmapLevel.

The resulting LOD ranges from 2.7~4.3, though I define mipmaps from Level 0 to level 6, given a 256 base texture. I think LOD should have values from 0~6 rather than 2.7~4.3.

Do I miss something in this process? Does anyone know another better approximation method to compute LOD? And I wonder where such computation takes place, in vertex shader or in pixel shader?

Thanks a lot!

Nadine

The sample codes from NVidia give the following method,

HPosition = mul(matModelViewProj, Obj.Position);

LOD = (HPosition.z/HPosition.w)*MaxMipmapLevel.

The resulting LOD ranges from 2.7~4.3, though I define mipmaps from Level 0 to level 6, given a 256 base texture. I think LOD should have values from 0~6 rather than 2.7~4.3.

Do I miss something in this process? Does anyone know another better approximation method to compute LOD? And I wonder where such computation takes place, in vertex shader or in pixel shader?

Thanks a lot!

Nadine