In shaders, when using SampleLevel intrinsic, if we pass 0.5 in the mip level parameter, and the sampler is a point sampler, what mip level is selected ?

According to this blog: https://blogs.msdn.microsoft.com/shawnhar/2009/09/14/texture-filtering-mipmaps/
It seems as if the coarser level of 1 is selected, so that would be a ceil operation going on internally.

I still ask because the wording in the blog:

rounds up to the next larger mip level

Is open to interpretation, that could mean the larger in dimensions, therefore finer.
And honestly it feels that using ceil is a very unfair convention for the mip 0, which can only be selected with exactly 0.0, poor thing.

  • 1
    $\begingroup$ The MIP map level is the (base 2) logarithm of the scaling of the texture and so the top level map will also get all the "negative" values, i.e., when magnification of the texture is occurring, so it's not that "unfair" :-) Further, the aim of MIP mapping is primarily to eliminate aliasing though at the risk of over filtering. Choosing ceil thus aims for "no aliasing" but, having said that, you should be able to set a LOD bias to shift this to suit your taste. $\endgroup$
    – Simon F
    Jan 17, 2017 at 12:00


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.