Editing
Appendix/Ramblings/RiemannMeetsOculus
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Attempts to Resolve Rotation Problem=== Some restrictions imposed by glTF (presumably including the .glb binary version) are documented by the [https://opengex.org/comparison.html Open Game Engine Exchange (OpenGEX)]. For example, in the context of <b>Animation of rotation angles</b>, <ul> <li> glTF exhibits the following MINOR PROBLEM: "All rotations must be expressed as quaternions, and slerp is required to interpolate them linearly." Note that, according to a [https://www.researchgate.net/figure/Linear-interpolation-curves_fig5_323053651 researchgate.net discussion], "Slerp is … a shorthand for spherical linear interpolation 9". </li> <li> See also … [https://github.com/KhronosGroup/glTF/issues/144 a discussion of <b>Animation: quaternion vs. axis-angle</b>] </li> <li> Try: <COLLADA xmlns="http://www.collada.org/2008/03/COLLADASchema" version="1.5.0"> </li> </ul> Poking around on the web, we have found [https://community.khronos.org/t/storing-quaternion-animations/5780 the following example COLLADA code by developer "kuchumovn"] that uses a quaternion prescription to animate about the Z-axis. <div style="height: 300px; width: 100%; overflow: scroll;"> <pre> <library_animations> <animation id="animation"> <source id="timing"> <float-array id="timing_array" count="2"> 0.0 1.0 </float-array> <technique_common> <accessor source="#timing_array" count="2" stride="1"> <param name="TIME" type="float"/> </accessor> </technique_common> </source> <source id="transformations"> <float_array id="transformations_array" count="32"> 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 2 0 0 0 0 2 0 0 0 0 2 0 0 0 0 2 </float_array> <technique_common> <accessor source="#transformations_array" count="2" stride="16"> <param name="(0)(0)" type="float4x4"/> </accessor> </technique_common> </source> <source id="interpolations"> <Name_array id="interpolations_array" count="2">LINEAR LINEAR</Name_array> <technique_common> <accessor source="#interpolations_array" count="2" stride="1"> <param name="INTERPOLATION" type="Name"/> </accessor> </technique_common> </source> <sampler id="sampler"> <input semantic="INPUT" source="#timing"/> <input semantic="OUTPUT" source="#transformations"/> <input semantic="INTERPOLATION" source="#interpolations"/> </sampler> <channel source="#sampler" target="#3d-object-node/transformation"/> </animation> </library_animations> // scene <library_visual_scenes> <visual_scene id="scene" name="scene"> <node id="3d-object-node" name="3d-object-node" type="NODE"> <matrix sid="transformation">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</matrix> <instance_geometry> ... </instance_geometry> </node> </visual_scene> </library_visual_scenes> </pre> </div> From our [[Appendix/Ramblings/VirtualReality#Understanding_the_Positioning_Matrix|accompanying introductory discussion of the COLLADA ''Position Matrix'']], we recognize that if we allow for scaling and translation along with rotation ''only'' about the Z-axis, the relevant '''4×4''' matrix is, <table border="0" align="center" cellpadding="8"> <tr> <td align="left"> <table border="1" cellpadding="8"> <tr> <td align="center" colspan="3" rowspan="3">R<sub>z</sub>(γ) × M<sub>scale</sub></td> <td align="center">T<sub>x</sub></td> </tr> <tr> <td align="center">T<sub>y</sub></td> </tr> <tr> <td align="center">T<sub>z</sub></td> </tr> <tr> <td align="center">0</td> <td align="center">0</td> <td align="center">0</td> <td align="center">1</td> </tr> </table> </td> <td align="right" rowspan="1"> = </td> <td align="left"> <table border="1" cellpadding="8"> <tr> <td align="center">S<sub>x</sub> · cos(γ)</td> <td align="center">- S<sub>x</sub> · sin(γ)</td> <td align="center">0</td> <td align="center">T<sub>x</sub></td> </tr> <tr> <td align="center">S<sub>y</sub> · sin(γ)</td> <td align="center">S<sub>y</sub> · cos(γ)</td> <td align="center">0</td> <td align="center">T<sub>y</sub></td> </tr> <tr> <td align="center">0</td> <td align="center">0</td> <td align="center">S<sub>z</sub></td> <td align="center">T<sub>z</sub></td> </tr> <tr> <td align="center">0</td> <td align="center">0</td> <td align="center">0</td> <td align="center">1</td> </tr> </table> </td> </tr> </table> and the equivalent '''<matrix>''' instruction should be (ignore the square brackets around each term), <table border="0" align="center" cellpadding="8"><tr><td align="center"><matrix>[ S<sub>x</sub> · cos(γ) ] [ -S<sub>x</sub> · sin(γ) ] [ 0 ] [ T<sub>x</sub>] [ S<sub>y</sub> · sin(γ) ] [ S<sub>y</sub> · cos(γ) ] [ 0 ] [ T<sub>y</sub>] [ 0 ] [ 0 ] [ S<sub>z</sub>] [ T<sub>z</sub>] [ 0 ] [ 0 ] [ 0 ] [ 1 ]</matrix> .</td></tr></table> <ul> <li> <font color="darkgreen"><b>WorksClock22E.dae</b></font> (originally, "Clock22E.dae"): <br /><font color="red">This appears to work in both visualization venues</font>. Hooray! </li> <li> <font color="darkgreen"><b>WorksQuaternion30.dae</b></font> (originally, "quaternion30.dae"): <br /><font color="red">This appears to work in both visualization venues</font>. Hooray! </li> </ul> Building on the advice/suggestion drawn from the "kuchumovn" COLLADA-code segment, above, we have figured out how to assemble a quaternion-based representation of a Z-rotation that works both in the Mac's Preview app and in the environment of the Oculus Rift S. Here are some key lines of code that appear in our model file named, <font color="darkgreen"><b>WorksQuaternion30.dae</b></font> … <div style="height: 300px; width: 100%; overflow: scroll;"> <pre> <animation id="Cube_quaternion_Z"> <source id="Cube_quaternion_Z-input"> <float_array id="Cube_quaternion_Z-input-array" count=" 33"> 0.00 0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00 2.25 2.50 2.75 3.00 3.25 3.50 3.75 4.00 4.25 4.50 4.75 5.00 5.25 5.50 5.75 6.00 6.25 6.50 6.75 7.00 7.25 7.50 7.75 8.00 </float_array> <technique_common> <accessor source="#Cube_quaternion_Z-input-array" count=" 33" stride="1"> <param name="TIME" type="float"/> </accessor> </technique_common> </source> <source id="Cube_quaternion_Z-output"> <float_array id="Cube_quaternion_Z-output-array" count="528"> 0.000 1.000 0.000 7.500 -1.000 0.000 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 -0.383 0.924 0.000 7.500 -0.924 -0.383 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 -0.707 0.707 0.000 7.500 -0.707 -0.707 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 -0.924 0.383 0.000 7.500 -0.383 -0.924 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 -1.000 0.000 0.000 7.500 0.000 -1.000 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 -0.924 -0.383 0.000 7.500 0.383 -0.924 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 -0.707 -0.707 0.000 7.500 0.707 -0.707 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 -0.383 -0.924 0.000 7.500 0.924 -0.383 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 0.000 -1.000 0.000 7.500 1.000 0.000 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 0.383 -0.924 0.000 7.500 0.924 0.383 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 0.707 -0.707 0.000 7.500 0.707 0.707 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 0.924 -0.383 0.000 7.500 0.383 0.924 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 1.000 0.000 0.000 7.500 0.000 1.000 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 0.924 0.383 0.000 7.500 -0.383 0.924 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 0.707 0.707 0.000 7.500 -0.707 0.707 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 0.383 0.924 0.000 7.500 -0.924 0.383 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 0.000 1.000 0.000 7.500 -1.000 0.000 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 -0.383 0.924 0.000 7.500 -0.924 -0.383 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 -0.707 0.707 0.000 7.500 -0.707 -0.707 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 -0.924 0.383 0.000 7.500 -0.383 -0.924 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 -1.000 0.000 0.000 7.500 0.000 -1.000 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 -0.924 -0.383 0.000 7.500 0.383 -0.924 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 -0.707 -0.707 0.000 7.500 0.707 -0.707 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 -0.383 -0.924 0.000 7.500 0.924 -0.383 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 0.000 -1.000 0.000 7.500 1.000 0.000 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 0.383 -0.924 0.000 7.500 0.924 0.383 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 0.707 -0.707 0.000 7.500 0.707 0.707 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 0.924 -0.383 0.000 7.500 0.383 0.924 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 1.000 0.000 0.000 7.500 0.000 1.000 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 0.924 0.383 0.000 7.500 -0.383 0.924 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 0.707 0.707 0.000 7.500 -0.707 0.707 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 0.383 0.924 0.000 7.500 -0.924 0.383 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 0.000 1.000 0.000 7.500 -1.000 0.000 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000 </float_array> <technique_common> <accessor source="#Cube_quaternion_Z-output-array" count=" 33" stride="16"> <param name="TRANSFORM" type="float4x4"/> </accessor> </technique_common> </source> <sampler id="Cube_quaternion_Z-sampler"> <input semantic="INPUT" source="#Cube_quaternion_Z-input"/> <input semantic="OUTPUT" source="#Cube_quaternion_Z-output"/> </sampler> <channel source="#Cube_quaternion_Z-sampler" target="Jetman/transformation"/> </animation> .... <library_visual_scenes> <visual_scene id="ID1"> .... <!-- END LABELING HERE --> </node> </node> <!-- End Inertial Grouping of Objects --> <!-- BEGIN CLOCK --> <node id="firstclock" name="instance_1"> <!-- TWO --> <translate>7.5 0.0 2.0</translate> <rotate sid="rotationX">0.0 1.0 0.0 0.0</rotate> <rotate sid="rotationY">0.0 1.0 0.0 0.0</rotate> <rotate sid="rotationZ">0.0 0.0 1.0 0.0</rotate> <scale sid="scale">1.0 1.0 1.0</scale> <instance_node url="#ID3" /> </node> <!-- /TWO --> <node id="Jetman" name="instance_Arrow"> <!-- TWO --> <matrix sid="transformation"> 0.000 1.000 0.000 7.500 -1.000 0.000 0.000 0.000 0.000 0.000 1.000 2.000 0.000 0.000 0.000 1.000</matrix> <instance_node url="#ArrowID3" /> </node> <!-- /TWO --> <node id="HourHand" name="instance_Hour"> <!-- TWO --> <translate>7.5 0.0 2.0</translate> <rotate sid="rotationX">0.0 1.0 0.0 0.0</rotate> <rotate sid="rotationY">0.0 1.0 0.0 0.0</rotate> <rotate sid="rotationZ">0.0 0.0 1 270.0</rotate> <scale sid="scale">0.75 0.75 0.75</scale> <instance_node url="#HourID3" /> </node> <!-- /TWO --> <!-- END CLOCK --> </visual_scene> </library_visual_scenes> </pre> </div>
Summary:
Please note that all contributions to JETohlineWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
JETohlineWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Tiled Menu
Table of Contents
Old (VisTrails) Cover
Appendices
Variables & Parameters
Key Equations
Special Functions
Permissions
Formats
References
lsuPhys
Ramblings
Uploaded Images
Originals
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information