…please!
I've been really struggling to understand what that whole “w” thing means, and I could really use some guidance. I've done a fair amount of internet-investigating, and I'm still having a little bit of trouble actually piecing it all together. So, if anyone has any resources or examples that can help me understand what's happening, I'd really appreciate it.
Please forgive the scattered nature of this post… there's a lot I'm not quite understanding.
Specifically, my cousin is trying to write an OpenGL raytracer, and he's having trouble understanding how raytrace a cube; the example given to him in class involves negative ones as the fourth term in a vector4, and it's confusing him. I offered to help, since Houdini has time and time again proven to be an invaluable tool for understanding all sorts of stuff, but… I'm kind of stuck here.
Here's what I've discovered:
- In Houdini, you can of course use a vector4 to arbitrarily hold data (eg, RGBA values). So that's cool.
- When talking about homogeneous coordinates (which is its own mindf*ck for me), the fourth component denotes whether a vector4 represents a point (1? not-zero?) or a vector (0); and we like using 4x4 matrices for our transformations because they can represent rotation, scale, translation, and shear all at once, in some order, yes?
- So, it should be possible to represent a cartesian point with homogenous coordinates . If “w” is zero, the vector is said to exist at “infinity” - which, for all intents and purposes, just means it represents a direction. And if “w” is less than one, the distance from the projection origin elongates; and shortens if w is greater than 1. Is that right? Thusfar, I haven't seen any introductory examples that use a value other than 1 or 0, but it's possible I haven't ventured far enough to see that kind of stuff. I understand that the “w” value must be either zero or one for use with a matrix4, right?
- That said, it seems that using a vector4 is sometimes nothing more than a convenient way to integrate matrix4s.
- Okay. And then we have the Add SOP, which lets you specify a W component between 0 and 1000 by default. I don't… fully understand what that's about, or how it can be used. There are a lot of examples for the Add SOP, but I didn't really see much that seemed to address this “W” term.
- And can't the “w” term be used to denote orientation or angular velocity? I feel like I've definitely seen that coming out of POPs. Is that just another use of a vector4 type to represent a quaternion, or… something else?
- So, back to my cousin's problem - what the hell does it mean if the “w” term in a vector4 is negative one? Does that just flip the handedness of the world or something? It seems like it would refer to coordinates behind the camera.
Any elucidation would be appreciated!