When I take the texture in the pixel shader, the texture unit needs to select mipmap based on the texture gradient around the shaded pixel.
There is a tex2Dgrad() function tex2Dgrad() that allows me to provide gradient information manually and tex2Dlod() , which allows me to select mipmap manually, but if I just call tex2D() , where will the additional information about the gradient be?
tex2D() is the most common case for texture matching used in most shaders, but I don’t know where this gradient tex2D() from. Obviously, Mipmapping works, so it must come from somewhere.
I want to use the texture as a lookup table in the pixel shader using the calculated U and V coordinates, but I don’t want tex2D() have no unexpected “magic” .
Do I need to use tex2Dlod() to avoid this? I read that tex2Dlod() slower than tex2D() .
source share