4
$\begingroup$

To continue with this my other question, here's the problem. So, I've a slide, which I'm trying to understand.

enter image description here

Here are my questions.

  1. What are the barycentric coordinates of? From my previous question, $(x_1, y_1)$ and $(x_2, y_2)$ are also screen coordinates. So, we're interpolating between screen coordinates. Why would we do that?

  2. Why is $\lambda = \frac{x - x_1}{x_2 - x_1}$?

  3. Are $p_1$ and $p_2$ points given in global coordinates? That is, are they $3D$ points or screen points?

  4. Why is $\mu$ defined as it is?

  5. Why do we want to know $p^z$? By the way, what is it? A vector, right?

$\endgroup$

1 Answer 1

2
$\begingroup$
  1. It sounds like you're rasterizing a line segment between two endpoints. The points on the line are obtained by linearly interpolating between the endpoints (whether in world space, screen space, or any other coordinate system). The barycentric coordinates identify points on the line segment.

  2. It's defined this way to make range of $\lambda$ be [0, 1]. (When $\lambda = 0$ you obtain $(x_1, y_1)$ and when $\lambda = 1$ you get $(x_2, y_2)$.) This is typical for barycentric coordinates for either lines or for triangles—they always range from 0 to 1, and sum to 1. These coordinates therefore also act as weights for interpolating other quantities, such as color or z-value, across the line or triangle.

  3. Probably the $p_i$ are the original 3D points before projection.

  4. This is about perspective-correct interpolation. It's stating the transformation between $\lambda$ (interpolation in screen space) and $\mu$ (interpolation in world space). The two parameters are not the same, due to perspective foreshortening—in screen space, perspective will compress parts of the line that are farther away from the camera. So, for example, the midpoint of the line in world space ($\mu = \tfrac{1}{2}$) will generally project to some place that is not at the midpoint in screen space ($\lambda \neq \tfrac{1}{2}$). The equation given shows how to convert between $\lambda$ and $\mu$ for a given point on the line. Note that if $p_1^z = p_2^z$, the equation reduces to $\mu = \lambda$, showing that both kinds of interpolation match if and only if the line is parallel to the screen, so the perspective effect is uniform along the whole line.

  5. $p_z$ is going to be the depth of the interpolated point. It's the $z$-component of the vector $p$, so $p_z$ itself is a single value, not a vector. Presumably the reason you want to know this is so you can store it in the z-buffer during rasterization. In other words, while rasterizing a line, you can easily calculate $\lambda$ for each pixel based on how far you are between the endpoints in screen space; then this equation tells you the $z$ for each pixel to put into the z-buffer.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.