-
Notifications
You must be signed in to change notification settings - Fork 4
Update conventions #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
FirefoxMetzger
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions on how we could improve these conventions
|
So, here's where I think my personal confusion stems from. By default, these are the directions in three.js and also in pygfx:
However, when you have a random object, and you use it's |
|
@Korijn Could this simply be a bug/inconsistency in ThreeJS? |
|
I played with the editor too. Indeed, calling --> Looks like the implementation of |
No, I think it's intentional! There are similar differences when I try the Unity editor locally. |
Same for lights: https://github.com/mrdoob/three.js/blob/acb58df60448e75561c363f142f0df878705443d/src/core/Object3D.js#L284 |
|
I've updated the conventions document with your suggestions and included the Z-axis distinction for cameras and lights and other objects. |
|
I think I've found the reasoning for three.js exception for cameras and lights, it is based on the glTF conventions.
In the above links you can find the glTF conventions, including the exceptions to the Z-axis for cameras and lights. So I think perhaps one of three.js goals is to be compatible with glTF assets out of the box. I wonder if that means their positive X axis points left instead of right in accordance with the glTF convention... looks like it does: So in conclusion, three.js is by default completely aligned with the glTF spec. Some relevant quotes from the spec:
It might be very convenient for us to adopt the glTF specification as well. We'll be compatible by default and it is something we can refer to easily for the details. |
Co-authored-by: Almar Klein <[email protected]>
|
I'm still don't fully understand why the view direction of cameras and lights is the backward direction for normal objects. But I think we can assume that the ppl from glTF have thought about this well. So let's adopt this and also mention glTF instead of pygfx (and link to it too).
This confused me, until I realized that if you rotate around these axiii, so that you view down the -Z axis, then +X is to the right again. |
|
It also explains why the lookAt call in threejs can just flip the |
|
OK, I'm going to adjust the text to align with glTF spec (and call it out). |
|
@FirefoxMetzger would you mind taking over this PR? I think you are better at documenting the coordinate frames and conventions than I am, and also I fractured a rib yesterday so I won't be using my laptop a whole lot anytime soon (typing this on my phone). |
|
@Korijn Sure. I'll do a review and finish it up during the next sprint 👍
Ouch. Hope that things will heal back together smoothly. |
|
I've split up this PR so we can merge #47 more quickly, and so that @FirefoxMetzger can take over this PR which is now isolated to just the changes to CONVENTIONS.md. |
|
I've updated the conventions and added a section about the various coordinate systems that we use in pylinalg and how we define them. We have to decide on the convention to use for spherical coordinates. I left that definition a bit vague on purpose until we decide on its details. Otherwise, this should be ready to review (@almarklein ). |
almarklein
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good from my end! One minor comment.
|
If you both agree with the updates to the definition of spherical coordinates then I think we can merge. Looks good from my side otherwise :) |
|
I'm good! Since I opened the PR, it requires you or Almar's approval. |
|
Nice work! This exercise will prove very much worthwhile. |



This PR: