Finding out which mipmap is being used

Q/ in the fragment shader is there way of finding out which texture level is being used? so the shader can adjust its calculations depending on that.

Currently I don’t think that this is possible except you write your own algroithm based on dFdx() and dFdy(). But AFAIK the textureXLoD functions are only available in vertex shader…

Couldn’t you just use a special texture with colored mip maps and use it as a lookup table?

Originally posted by Corrail:
But AFAIK the textureXLoD functions are only available in vertex shader…
We had a discussion about that not so long ago. The common belief is that the spec is ill-worded and you can actually use the Lod built-ins in a fragment shader (not being able to do so doesn’t make any sense and it would be a big mistake).

Originally posted by zed:
Q/ in the fragment shader is there way of finding out which texture level is being used? so the shader can adjust its calculations depending on that.
Easy. Pack mipmap number in alpha (if unused that is). Mipmap 0 gets alpha = 0, mipmap 1 => alpha = 0.1 (or any other suitable number) … etc.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.