
The Ptex filter footprint is specified as two vectors in uv space:
W1 = [uw1, vw1]
W2 = [uw2, vw2]
The vectors form a parallelogram around the sample point, [u, v].
When the vectors are orthogonal, they form the major and minor axis of
the enclosed ellipse.
Determining the filter footprint
In general, the vectors represent the uv sampling interval along two
axes, a and b:
[uw1, vw1] = [du/da, dv/da]
[uw2, vw2] = [du/db, dv/db]
Two special cases are of interest:
A) Texture aligned grid (the classic Ptex case) - the vectors form two
sides of a rectangle, uw by vw:
[uw1, vw1] = [uw, 0]
[uw2, vw2] = [0, vw]
B) Projection from screen space (where a and b are screen coordinates
in pixels):
Given derivatives of the screen coordinates:
da/du = Du(a)
db/du = Du(b)
da/dv = Dv(a)
db/dv = Dv(b)
the vectors can be found by inverting
the Jacobian matrix [da/du, db/du ; da/dv, db/dv]:
det = (da/du * db/dv - db/du * da/dv)
du/da = (1/det) * db/dv
dv/da = -(1/det) * db/du
du/db = -(1/det) * da/dv
dv/db = (1/det) * da/du
[uw1, vw1] = [du/da, dv/da]
[uw2, vw2] = [du/db, dv/db]
Note: if the ptex u, v coordinates
aren't aligned with the renderer's uv coordinates, the chain rule can
be used.
Given texture coordinates s and t:
ds/du = Du(s)
dt/du = Du(t)
ds/dv = Dv(s)
dt/dv = Dv(t)
[uw1, vw1] = [ds/du*du/da + ds/dv*dv/da, dt/du*du/da + dt/dv*dv/da]
[uw2, vw2] = [ds/du*du/db + ds/dv*dv/db, dt/du*du/db + dt/dv*dv/db]