throbber
4620/5620 Fall 2012
`Notes: Perspective correct texturing and quaternion interpolation
`Kavita Bala
`
`This is a short note explaining the math behind perspective correct texturing and spherical
`linear interpolation for quaternions.
`
`1 Perspective Correct Texturing
`
`We want to derive the correct equations for perspective correct texturing and z computation. We
`will stay in 2D, but 3D is an easy generalization.
`Consider a 2D line with end points (X0, Z0) and (X1, Z1). These 2 points project (under a
`perspective transformation) to screen space points S0 and S1 respectively. We want to find the
`texture coordinates U that are correct even with the perspective transform.
`
`it’s screen
`Now consider a point (X, Z) that lies on the line between (X0, Z0) and (X1, Z2):
`space projection on the image plane is S, and its texture coordinate is U . Let the screen space
`interpolation parameter by q, and t be the world space interpolation parameter. Our goal is to find
`the way we need to interpolate in screen space to produce the perspective-correct U value.
`Let d be the distance of the image plane from the eye. Using similar triangles for the points,
`we have:
`
`X0
`Z0
`X1
`Z1
`
`=
`
`=
`
`S0
`d
`S1
`d
`
`1
`
`(1)
`
`(2)
`
`MEDIATEK, Ex. 1027, Page 1
`IPR2018-00102
`
`

`

`(3)
`
`(4)
`
`(5)
`
`Given an arbitrary point (X, Z), we have the equation for its projection S to be:
`
`S d
`
`=
`
`X Z
`
`Z =
`
`dX
`S
`
`The point S is computed by screen space interpolation of S0 and S1.
`S = S0 + q(S1 − S0)
`
`X and Z are obtained by world space interpolation of X0 and X1, and Z0 and Z1, respectively.
`[X, Z] = [X0 + t(X1 − X0), Z0 + t(Z1 − Z0)]
`
`(6)
`
`Substituting Equation 5 in Equation 6 we get:
`
`Z =
`
`=
`
`dX
`S
`d(X0 + t(X1 − X0))
`S0 + q(S1 − S0)
`
`(7)
`
`(8)
`
`(9)
`
`(10)
`
`(11)
`
`(12)
`
`Z =
`
`=
`
`d
`
`d + t (S1Z1−S0Z0)
`d( S0Z0
`S0 + q(S1 − S0)
`S0Z0 + t(S1Z1 − S0Z0)
`S0 + q(S1 − S0)
`But Z is Z0 + t(Z1 − Z0) from Equation 6. Thus,
`S0Z0 + t(S1Z1 − S0Z0)
`S0 + q(S1 − S0)
`
`Z0 + t(Z1 − Z0) =
`
`which can be simplified to
`Z0S0 + Z0q(S1 − S0) + t(Z1 − Z0)S0 + tq(Z1 − Z0)(S1 − S0) = S0Z0 + t(S1Z1 − S0Z0)
`t[S0Z1 − S0Z0 + q(Z1 − Z0)(S1 − S0) − S1Z1 + S0Z0] = −Z0q(S1 − S0)
`t(S1 − S0)[Z1 − q(Z1 − Z0)] = Z0q(S1 − S0)
`t[qZ0 + (1 − q)Z1] = Z0q
`
`giving us the value of t in terms of q:
`
`t =
`
`Z0q
`qZ0 + (1 − q)Z1
`
`2
`
`MEDIATEK, Ex. 1027, Page 2
`IPR2018-00102
`
`

`

`Substituting t in Equation 6 we get:
`Z0q(Z1 − Z0)
`Z = Z0 + t(Z1 − Z0) = Z0 +
`qZ0 + (1 − q)Z1
`0 + (1 − q)Z0Z1 + qZ0Z1 − qZ 2
`qZ 2
`qZ0 + (1 − q)Z1
`Z0Z1
`qZ0 + (1 − q)Z1
`1
`− 1
`+ q( 1
`Z1
`
`1Z
`
`=
`
`=
`
`=
`
`0
`And finally, letting W = 1/Z we get,
`
`0
`
`)
`
`Z0
`
`(13)
`
`(14)
`
`(15)
`
`(16)
`
`(17)
`
`(18)
`
`(19)
`
`(20)
`
`− 1
`+ q(
`)
`=
`Z0
`W = W0 + q(W1 − W0)
`Our goal is to compute the perspective correct Z value. This equation tells us that we can achieve
`that using screen-space interpolation, as long as we linearly interpolate W (which is reciprocal Z)
`in screen space using q, and then compute Z as 1
`W .
`For computing texture coordinates, the same substitution can be done. Except here we are
`interpolating the texture coordinate U . Given
`U = U0 + t(U1 − U0)
`and substituting t from Equation 12 we get:
`U0W0 + q(U1W1 − U0W0)
`W0 + q(W1 − W0)
`Thus the texture coordinates U can be correctly dervived by linearly interpolating in screen
`space (using q) as follows: interpolate U W and W and then compute U as interpolatedU W
`interpolatedW .
`
`1 Z
`
`1
`
`1 Z
`
`0
`
`1 Z
`
`U =
`
`2 Spherical Linear Interpolation
`
`We derive the slerp equations here. We want to rotate from the start quaternion q1 to the end
`quaternion q2. Simple linear interpolation will not move at a constant rate. Instead we need to
`interpolate along the geodesic of the 4D sphere. The quaternions are two points on this 4D sphere.
`The 4D “angle” between the two quaternions is given by the 4D dot product between q1 and
`q2. For q1 = (w1, x1, y1, z1), and q2 = (w2, x2, y2, z2), the angle between the two quaternions α is
`given as cos(α) = w1w2 + x1x2 + y1y2 + z1z2.
`
`3
`
`MEDIATEK, Ex. 1027, Page 3
`IPR2018-00102
`
`

`

`Now we derive the equation for the quaternion q that interpolates q1 and q2. We want q to
`interpolate the angle α, such that q = q1 when t = 0, and q = q2 when t = 1, and q subtends
`angle tα at t. Remember that since we have unit quaternions, the 4D sphere the quaternions lie
`on (shown) has radius 1.
`Consider the axis ˆw perpendicular to q1 as shown, and (cid:126)v, the projection of q parallel to ˆw.
`
`Also,
`
`(cid:126)v = sin(α) ˆw
`(cid:126)v
`sin(α)
`
`ˆw =
`
`(cid:126)v + q1cos(α) = q2
`q2 − q1cos(α)
`sin(α)
`
`ˆw =
`
`q is given as its projection along q1 plus (cid:126)v:
`
`(21)
`
`(22)
`
`(23)
`
`(24)
`
`(cid:126)q = cos(tα)q1 + sin(tα) ˆw
`q2 − q1cos(α)
`= cos(tα)q1 + sin(tα)
`sin(α)
`= cos(tα)q1 − sin(tα)q1cos(α)
`sin(α)
`= [cos(tα) − sin(tα)cos(α)
`]q1 +
`sin(α)
`cos(tα)sin(α) − sin(tα)cos(α)
`sin(α)
`sin(α − tα)
`sin(tα)
`q1 +
`sin(α)
`sin(α)
`sin(α(1 − t))
`sin(tα)
`sin(α)
`sin(α)
`where we use the identity sin(m − n) = sin(m)cos(n) − cos(m)sin(n).
`
`q2
`
`q2
`
`sin(tα)
`sin(α)
`sin(tα)
`sin(α)
`sin(tα)
`sin(α)
`
`q1 +
`
`q2
`
`=
`
`=
`
`(cid:126)q =
`
`q1 +
`
`+
`
`q2
`
`q2
`
`4
`
`MEDIATEK, Ex. 1027, Page 4
`IPR2018-00102
`
`

This document is available on Docket Alarm but you must sign up to view it.


Or .

Accessing this document will incur an additional charge of $.

After purchase, you can access this document again without charge.

Accept $ Charge
throbber

Still Working On It

This document is taking longer than usual to download. This can happen if we need to contact the court directly to obtain the document and their servers are running slowly.

Give it another minute or two to complete, and then try the refresh button.

throbber

A few More Minutes ... Still Working

It can take up to 5 minutes for us to download a document if the court servers are running slowly.

Thank you for your continued patience.

This document could not be displayed.

We could not find this document within its docket. Please go back to the docket page and check the link. If that does not work, go back to the docket and refresh it to pull the newest information.

Your account does not support viewing this document.

You need a Paid Account to view this document. Click here to change your account type.

Your account does not support viewing this document.

Set your membership status to view this document.

With a Docket Alarm membership, you'll get a whole lot more, including:

  • Up-to-date information for this case.
  • Email alerts whenever there is an update.
  • Full text search for other cases.
  • Get email alerts whenever a new case matches your search.

Become a Member

One Moment Please

The filing “” is large (MB) and is being downloaded.

Please refresh this page in a few minutes to see if the filing has been downloaded. The filing will also be emailed to you when the download completes.

Your document is on its way!

If you do not receive the document in five minutes, contact support at support@docketalarm.com.

Sealed Document

We are unable to display this document, it may be under a court ordered seal.

If you have proper credentials to access the file, you may proceed directly to the court's system using your government issued username and password.


Access Government Site

We are redirecting you
to a mobile optimized page.





Document Unreadable or Corrupt

Refresh this Document
Go to the Docket

We are unable to display this document.

Refresh this Document
Go to the Docket