We have a top-down game with fixed camera position. We also use orthographic projection so every model in the game will always be viewed from the very same angle and from the very same distance. The question we want to answer is what size should our textures be for each model. I tried turning off mipmapping and clearly saw that the game does not use the highes mip level when drawing our stuff. I also know that tex2Dlod can be used to specify which mip texture level to use for sampling, so my plan is to gradually change this value to manually specify lower and lower mip levels until I see that decreasing it further reduces the quality of the picture. The problem is I cannot figure out how to set the mip level. The value passed to the tex2Dlod function is float4 and as I understood x and y hold te texture coordinates and w holds the mip level. But it should be set in fractional representation and I cannot know what the step size is. So basically I need to know what number I need to send into the function to gradually switch mip levels.
1 Answer
\$\begingroup\$
\$\endgroup\$
1
The w component is simply the index of the desired mipmap. A value of 0.0 will fetch the first mip level (the highest resolution), 1.0 will fetch the second level (half resolution), etc.
Fractional values are used for trilinear filtering. For example, w = 0.5 will fetch both the first and second levels and then blend 50% between them.
-
\$\begingroup\$ Thanks a lot! I searched the nets thoroughly but there were no answers! \$\endgroup\$– cubrmanCommented Nov 26, 2013 at 7:37