1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Need help in understanding W paremeter for homogeneous coordinates

  1. Mar 25, 2014 #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?
  2. jcsd
  3. Mar 26, 2014 #2
    OH dear, I don't think this is general math is it? :(
  4. Mar 26, 2014 #3
    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: Mar 26, 2014
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook