XML:OBAN: Difference between revisions

1,822 bytes removed ,  8 February 2014
m
removing notes not longer required
m (+ pic)
m (removing notes not longer required)
Line 2: Line 2:


===general information===
===general information===
* The xml code on this page was tested with onisplit '''v0.9.61.0''', '''v0.9.68.0''', '''v0.9.82.0'''
* The xml code on this page was tested with onisplit '''v0.9.61.0''', '''v0.9.68.0''', '''v0.9.82.0''', '''v0.9.96.0'''




Line 151: Line 151:


===data harvest from TRAM files===
===data harvest from TRAM files===
;(outdated)
It's possible to create animations in Mod Tool and making TRAM files out of them. Then you can extract the quaternions and rotations with onisplit [http://mods.oni2.net/node/38 v0.9.54.0] and use them for OBANs.
It's possible to create animations in Mod Tool and making TRAM files out of them. Then you can extract the quaternions and rotations with onisplit [http://mods.oni2.net/node/38 v0.9.54.0] and use them for OBANs.
: [http://oni.bungie.org/community/forum/viewtopic.php?id=2276 HERE's] an excel macro to harvest such data for camera animations.
: [http://oni.bungie.org/community/forum/viewtopic.php?id=2276 HERE's] an excel macro to harvest such data for camera animations.
===wish list===
* TRAM import: dae + xml
** the dae section in the xml file should have an option to create a pelvis OBAN along with the TRAM (see [[XML:TRAM]], RealWorld flag for details)
* dae to oni creation should also allow for OBANs (currently OBANs can only be imported via level master xml file)
** this would be very useful for editing/creating single OBAN files if the rest of the level don't need changes




Line 165: Line 160:
In some scenarios we need to build a new transform matrix, e.g. when making a new weapon particle emitter.
In some scenarios we need to build a new transform matrix, e.g. when making a new weapon particle emitter.


Those commands can be used to examine OniSplit's matrix calculation.
The first 9 values belong to a 3x3 rotation matrix.
onisplit -create:oban OBAN OBAN/file.dae
 
onisplit -extract:xml OBAN OBAN/OBANfile.oni
The last 3 values are the start positions.


Let's test some values.


xyz = 0
<InitialTransform>1 0 0 0 1 0 0 0 1 0 0 0</InitialTransform>
This doesn't tell us very much, at least we know that the last 3 value are positions.
{| class="wikitable" style="float:right; text-align:right"
{| class="wikitable" style="float:right; text-align:right"
| This formula is involved in building such matrix.
| This formula is involved in building such matrix.
Line 179: Line 170:
|}
|}


So the first 9 values have to contain the rotation.


x = 60
x = 60
Line 195: Line 185:




x = 60; y = 40
<InitialTransform>0.7660444 0.5566704      -0.321393818  0 0.5    0.8660254 0.6427877 -0.663413942  0.3830222    <font style="color:#AAAAAA">0 0 0</font></InitialTransform>
                  cos(y)    sin(x)*sin(y)  -cos(x)*sin(y) 0 cos(x)  sin(x)    sin(y)    -sin(x)*cos(y) cos(x)*cos(y)
                  cos(y)    -sin(x)*-sin(y) -cos(x)*sin(y) 0 cos(x)  sin(x)    sin(y)    -sin(x)*cos(y) cos(x)*cos(y)


x = 60; z = 40
<InitialTransform>0.7660444 0.321393818  0.5566704      -0.6427877 0.3830222        0.663413942  0 -0.8660254  0.5    <font style="color:#AAAAAA">0 0 0</font></InitialTransform>
                  cos(z)    cos(x)*sin(z) sin(x)*sin(z)  -sin(z)    cos(x)*cos(z)    sin(x)*cos(z) 0 -sin(x)    cos(x)
                  cos(z)    cos(x)*sin(z) -sin(x)*-sin(z) -sin(z)    cos(x)*cos(z)    sin(x)*cos(z) 0 -sin(x)    cos(x)


y = 60; z = 40
{| class="wikitable" style="float:right;"
<InitialTransform>0.3830222    0.6427877 -0.663413942  -0.321393818  0.7660444 0.5566704      0.8660254 0 0.5    <font style="color:#AAAAAA">0 0 0</font></InitialTransform>
| https://dl.dropboxusercontent.com/u/139715/OniGalore/Oni_Matrix_calculator.png
                  cos(y)*cos(z) sin(z)    -sin(y)*cos(z) cos(y)*-sin(z) cos(z)    sin(y)*sin(z)  sin(y)    0 cos(y)
                  cos(x)*cos(z) sin(z)    -sin(y)*cos(z) cos(y)*-sin(z) cos(z)    -sin(y)*-sin(z) sin(y)    0 cos(y)


x = 60; y = 40; z = 20
[[User:Neo|Neo]] provided a little '''[https://dl.dropboxusercontent.com/u/139715/OniGalore/OniMatrix.zip matrix program]'''. The source code is also available [https://dl.dropboxusercontent.com/u/139715/OniGalore/OniMatrix_src.zip over here].
<InitialTransform>0.719846249  0.6941092 -0.005813241 -0.262002677 0.279453874 0.9237208 0.642787635 -0.6634138 0.3830223    <font style="color:#AAAAAA">0 0 0</font></InitialTransform>
|}
                  cos(y)*cos(z)                                                                                  cos(x)*cos(y)


By now it gets clear that the other values are made of various operations and so far it worked only because not all rotations were used (2 values at most at a time).


All calculations ('''matrix multiplications''', etc.) needed for matrix creation were baked into a program by Neo, it can be downloaded '''[https://dl.dropboxusercontent.com/u/139715/OniGalore/OniMatrix.zip HERE]'''. Later OniSplit might be able to do this to, and/or display the values in a different way.
The final rotation matrix becomes calculated from multiplication of all single rotation matrices whereby the order must be Z, then Y, then X.


The source can be accessed over [https://dl.dropboxusercontent.com/u/139715/OniGalore/OniMatrix_src.zip HERE]; Mod Tool vbs adaption (rotations only) over [https://dl.dropboxusercontent.com/u/139715/OniGalore/Oni_rotation_matrix.vbs HERE].
: '''Rotation matrix Z * rotation matrix Y * Rotation matrix X'''
 
So the transform matrix is:
 
: '''final rotation matrix; position X; position Y; position Z'''
 
 
Mod Tool vbs code (rotations only):
* [[Mod_Tool/Scripting#convert_XYZ_rotation_to_matrix|euler rotation to matrix]]
* [[Mod_Tool/Scripting#convert_matrix_to_XYZ_rotation|matrix to euler rotation]]
 
 
===wish list===
* TRAM import: dae + xml
** the dae section in the xml file should have an option to create a pelvis OBAN along with the TRAM (see [[XML:TRAM]], RealWorld flag for details)
* dae to oni creation should also allow for OBANs (currently OBANs can only be imported via level master xml file)
** this would be very useful for editing/creating single OBAN files if the rest of the level don't need changes


https://dl.dropboxusercontent.com/u/139715/OniGalore/Oni_Matrix_calculator.png


{{XML}}
{{XML}}
8,018

edits