The texture input coordinates (s,t) are on a [0,1] scale, independent of the resolution of the texture (that's all that makes sense, considering that the whole point of MIP-mapping is that you aren't using a single fixed resolution). So if you are computing derivatives of the texture function, you also want the derivatives to also be with respect to changes in s and t.
OK, so consider the image gradient you compute by just comparing a texel value with the immediately adjacent texel. That tells you how much the texture is changing *per unit of x or y pixel at the resolution of that MIP level*. So to convert this to a derivative with respect to units of s and t (remember, 0-1 across the whole image), you need to multiply the horizontal gradient by the width, and the vertical gradient by the height, at that MIP level. > On Apr 23, 2016, at 7:49 AM, Ales Sela <[email protected]> wrote: > > I am trying to understand derivative computation in TextureSystem. > > Why I derivatives scald by the image width and height? > > For example: > simd::float4 scalex = weight_simd * float(spec.width); > simd::float4 scaley = weight_simd * float(spec.height); > > Why is there this scaling factor? > -- Larry Gritz [email protected] _______________________________________________ Oiio-dev mailing list [email protected] http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
