Need help in understanding W paremeter for homogeneous coordinates

In summary, the conversation discusses the importance of the w component in homogeneous coordinates (x,y,z,w) and its role in perspective projection. The w component is used as a trick to make vertex transformation easier for the processor and is typically set to 1 for position and 0 for other elements. The conversation also mentions that while it is possible to learn homogeneous coordinates in a mathematical sense, it is not necessary for graphics programmers.
  • #1
null void
102
1
First I would like to apologize first if this is the wrong place for posting this problem.

I don't really understand what is the importance of w in the homogeneous coordinate (x,y,z, w).

One of the example i have read is about a parrallel line extended to infinity, and both line would meet at w=0. But what is the difference between (x,y,z, 0.5) and (x,y,z, 0) ? Isn't how the distance(in perspective) between 2 points on both lines is determined by z? I mean the farther the closer they get, why do we still need w?
 
Mathematics news on Phys.org
  • #2
OH dear, I don't think this is general math is it? :(
 
  • #3
null void said:
First I would like to apologize first if this is the wrong place for posting this problem.

I don't really understand what is the importance of w in the homogeneous coordinate (x,y,z, w).

One of the example i have read is about a parrallel line extended to infinity, and both line would meet at w=0. But what is the difference between (x,y,z, 0.5) and (x,y,z, 0) ? Isn't how the distance(in perspective) between 2 points on both lines is determined by z? I mean the farther the closer they get, why do we still need w?

So you're learning CG right? Rest assured that CG programmers don't learn this in a mathematical sense. It's just used as a little trick to make vertex transformation easier for the processor. If you write out your transformation matrix, you'll see what the w component does. You'll want it to be 1 for position and 0 for normals, binormals and tangents, but this is implicitly assumed by modern shader code anyway.

After applying a transformation that includes a perspective projection to a position vector, you'll end up with a w component that isn't 1. You'll just divide your new position through by it to get it back to 1 and give view space coordinates.

That's pretty much all you ever need to care about homogeneous coordinates in CG so I'd recommend that you learn this as CG rather than as maths. That said, if you really want to learn homogeneous coordinates properly then go ahead, but you'll be in a very small minority of graphics programmers.
 
Last edited:

FAQ: Need help in understanding W paremeter for homogeneous coordinates

1. What is the purpose of W parameter in homogeneous coordinates?

The W parameter, also known as the homogeneous coordinate, is used in computer graphics and computer vision to represent points in a higher dimensional space. It allows for the representation of points at infinity and simplifies geometric calculations.

2. How is the W parameter calculated in homogeneous coordinates?

The W parameter is calculated by dividing all coordinates of a point by its last coordinate. For example, a point (x,y,z) in 3D space would have a homogeneous representation of (x/w, y/w, z/w, 1), where w is the W parameter.

3. What is the difference between homogenous and Cartesian coordinates?

In homogenous coordinates, the W parameter is added as an extra dimension, while in Cartesian coordinates, the W parameter is not present. Furthermore, homogenous coordinates allow for representation of points at infinity, while Cartesian coordinates do not.

4. How does the W parameter affect the perspective projection of a 3D object?

The W parameter plays a crucial role in perspective projection. It allows for the projection of a 3D object onto a 2D plane by taking into account the distance of the object from the camera. This results in a more realistic and accurate representation of the 3D object.

5. Are there any disadvantages to using homogenous coordinates?

One disadvantage of using homogenous coordinates is that they can be more computationally expensive compared to Cartesian coordinates. Additionally, they may introduce numerical instability and can be challenging to interpret visually. However, the advantages of using homogenous coordinates often outweigh these disadvantages in computer graphics and computer vision applications.

Similar threads

Back
Top