[Book 1, Chapter 4.2] Z axis orientation #1386
Replies: 6 comments 1 reply
-
The coordinates here just act as a reference. Typically we associate axis illustrations (pointing arrows) with positive direction, but that's not the case here. Not wrong, but potentially confusing. I personally think we should always label the axes. @hollasch do you have any thoughts? p.s, linking to Right hand rule might be helpful. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
This is slightly OT, but why did you chose right-handed coordinates? From what I understand both OpenGL and DirectX both use left-handed one. |
Beta Was this translation helpful? Give feedback.
-
I agree that the diagram is confusing. I understand the arrows as demonstrating the camera's basis vectors (up, right, look) and not the coordinate axes but this distinction could be illustrated better. Somewhat relatedly, I'm currently working on a similar diagram for the ray generation chapter of the GPU book where I intend to illustrate this clearly.
I can't speak for the authors' original choice but I think this is a matter of preference. The convention varies between graphics APIs (IIRC OpenGL defines a It's ultimately a matter of convention. An application that targets more than one of these APIs will typically pick its own convention and reconcile any mismatch when computing the transformations. FWIW, I picked a right-handed ( |
Beta Was this translation helpful? Give feedback.
-
Arrows indicate vector direction, always positive. But these are not axes; they are three independent vectors used to construct scene rays. They are not orthonormal, and they are not even orthogonal. In practice, the scene ray will move from target pixel to target pixel (and around target pixels for sampling). These are not the |
Beta Was this translation helpful? Give feedback.
-
I was also confused by the z-axis orientation: the code seems to directly disagree with the diagram. The following in 1.4.2 indicates that the viewport is in the negative direction: auto viewport_upper_left = camera_center
- vec3(0, 0, focal_length) - viewport_u/2 - viewport_v/2; But if right-handed coordinates were actually being followed, then applying the right-hand rule suggests that the viewport is in the positive z-direction. The above code listing should be modified to the following throughout the code: auto viewport_upper_left = camera_center
+ vec3(0, 0, focal_length) - viewport_u/2 - viewport_v/2; |
Beta Was this translation helpful? Give feedback.
-
From chapter 4.2 of book 1:
It is my understanding that arrows on axes indicate positive direction. So, the above paragraph states that negative Z points towards the viewport, but the image shows the opposite -- the arrow (aka positive Z) is pointing towards the viewport.
Did I miss something?
Beta Was this translation helpful? Give feedback.
All reactions