
110 IDiscovering
// st is a vec2 of texcoords , G2_st is a vec2 in texcoord space
mat2 Jacobian2 = mat2( dFdx (st), dFdy(st));
// G2_xy is G2_st transformed to fragment space
vec2 G2_xy = Jacobian2 * G2_st ;
// stp is a vec3 of texcoords , G3_stp is a vec3 in texcoord space
mat2x3 Jacobian3 = mat2x3 (dFdx (stp), dFdy (stp));
// G3_xy is G3_stp projected to fragment space
vec2 G3_xy = Jacobian3 * G3_stp ;
}
Listing 7.2. Transforming a vector in (s, t)or(s, t, p) texture space to fragment (x, y)space.
In some cases, the analytical derivative of a function is simple to compute, and
it may be inefficient or inaccurate to approximate it using finite differen