-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
xmag and ymag should be clarified to be width/2 and heigth/2 #1663
Comments
This should absolutely be clarified. I just came to implementing orthographic cameras and wasted quite a bit of time due to the imprecise description and misleading tutorial. |
@UX3D-nopper based on recent discussions I believe we can now confirm here that indeed.
With respect to the orthographic view width as has been presented in the glTF Sampe Viewer. I imagine this can now be closed with this confirmed. |
I'm afraid we made the opposite assumption in both three.js and in Blender. I would agree that clearer language should be added to the specification. We do not write projection matrices from scratch when loading a model into an existing engine, which I suppose was the source of the mistake. Something to the effect of, |
You can compare the matrix in the spec against the matrix for glOrtho to get
(I'm not sure if this related to KhronosGroup/glTF-Blender-IO#944 though. The code in Blender only ever looks at a scaling factor, not a concrete width, so it couldn't mistake width for width/2.) |
Actually, it is already exactly defined:
https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#projection-matrices This means that xmag and ymag is width/2 and heigth/2. But agree, this should be better communicated. Actually, I opened this ticket :-) |
Sounds good, let's keep this open until the clearer wording is added to the spec. |
I'm trying to implement this feature in Maya2glTF, but every viewer I tried seems to scale the 3D scene non-uniformly when using orthographic cameras when resizing the viewport. Clearly that can't be the desired effect, as an exporter can't know the width and height of the final viewport... With perspective cameras, one can leave the So I really don't know what values for |
@ziriax I think that is the specified result: the exporter should give the xmag/ymag values of the camera it has, without knowing anything about the final viewport. The specification does not say what a client should do when xmag/ymag do not match the viewport's aspect ratio: (a) display non-uniform scaling Most viewers have chosen (a). In many cases (c) is impossible, e.g. a web page cannot resize the browser. Perhaps the spec should be clarified with a convention for how clients should resolve that conflict. |
@donmccurdy I am running into a similar issue with the Would it be reasonable to change the spec so that |
# Objective - Fixes the issue with orthographic camera imported from glTF not displaying anything (mentioned in #4005). ## Solution - This was due to wrong scaling mode being used. This PR simply changes WindowSize scaling mode to FixedHorizontal. ## Important Note Currently, othographic scale in Blender, three.js, and possibly other software does not translate to Bevy (via glTF) because their developers have [misinterpreted the spec](KhronosGroup/glTF#1663 (comment)). The camera parameters have been clarified in glTF 2.0, which was released on October of 2021. In Blender 3.0.1 this issue has **not** been fixed yet. If you are importing orthographic cameras from Blender, you have to divide the scale by 2.
# Objective - Fixes the issue with orthographic camera imported from glTF not displaying anything (mentioned in bevyengine#4005). ## Solution - This was due to wrong scaling mode being used. This PR simply changes WindowSize scaling mode to FixedHorizontal. ## Important Note Currently, othographic scale in Blender, three.js, and possibly other software does not translate to Bevy (via glTF) because their developers have [misinterpreted the spec](KhronosGroup/glTF#1663 (comment)). The camera parameters have been clarified in glTF 2.0, which was released on October of 2021. In Blender 3.0.1 this issue has **not** been fixed yet. If you are importing orthographic cameras from Blender, you have to divide the scale by 2.
# Objective - Fixes the issue with orthographic camera imported from glTF not displaying anything (mentioned in bevyengine#4005). ## Solution - This was due to wrong scaling mode being used. This PR simply changes WindowSize scaling mode to FixedHorizontal. ## Important Note Currently, othographic scale in Blender, three.js, and possibly other software does not translate to Bevy (via glTF) because their developers have [misinterpreted the spec](KhronosGroup/glTF#1663 (comment)). The camera parameters have been clarified in glTF 2.0, which was released on October of 2021. In Blender 3.0.1 this issue has **not** been fixed yet. If you are importing orthographic cameras from Blender, you have to divide the scale by 2.
# Objective - Fixes the issue with orthographic camera imported from glTF not displaying anything (mentioned in #4005). ## Solution - This was due to wrong scaling mode being used. This PR simply changes WindowSize scaling mode to FixedHorizontal. ## Important Note Currently, othographic scale in Blender, three.js, and possibly other software does not translate to Bevy (via glTF) because their developers have [misinterpreted the spec](KhronosGroup/glTF#1663 (comment)). The camera parameters have been clarified in glTF 2.0, which was released on October of 2021. In Blender 3.0.1 this issue has **not** been fixed yet. If you are importing orthographic cameras from Blender, you have to divide the scale by 2.
Also the tutorial is misleading:
https://github.com/KhronosGroup/glTF-Tutorials/blob/master/gltfTutorial/gltfTutorial_016_Cameras.md
The text was updated successfully, but these errors were encountered: