Given a texture object (Tex), mapping coordinates (UV) and non-frac coordinates (UV1) this is the HLSL code:
return Tex.SampleGrad(TexSampler,UV,ddx(UV1),ddy(UV1));
Using SampleGrad is 10 instructions cheaper than the 'ComputeMipLevel' material function and also preserves anisotropic filtering, so that's a double win.
just tested this on UE3 and it also works
ReplyDeletethanks for the tip ;)