Need help in understanding W paremeter for homogeneous coordinates

  • Context: Undergrad 
  • Thread starter Thread starter null void
  • Start date Start date
  • Tags Tags
    Coordinates Homogeneous
Click For Summary
SUMMARY

The discussion centers on the significance of the w parameter in homogeneous coordinates (x, y, z, w) within computer graphics (CG). It is established that w is crucial for transforming vertex positions and normals, with w=1 typically representing positions and w=0 for normals. The transformation matrix used in CG implicitly assumes these values, and after applying perspective projection, the w component may not equal 1, necessitating normalization. Understanding w is essential for effective vertex transformation and rendering in CG programming.

PREREQUISITES
  • Understanding of homogeneous coordinates in computer graphics
  • Familiarity with transformation matrices
  • Basic knowledge of perspective projection techniques
  • Experience with shader programming
NEXT STEPS
  • Study the role of transformation matrices in computer graphics
  • Learn about perspective projection and its effects on rendering
  • Explore the implementation of shaders and their handling of w components
  • Investigate the mathematical foundations of homogeneous coordinates
USEFUL FOR

Computer graphics programmers, shader developers, and anyone interested in understanding vertex transformations and rendering techniques in CG.

null void
Messages
102
Reaction score
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
OH dear, I don't think this is general math is it? :(
 
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:

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 10 ·
Replies
10
Views
1K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 40 ·
2
Replies
40
Views
6K
  • · Replies 7 ·
Replies
7
Views
3K