Jump to content

XML:ONLV: Difference between revisions

3,847 bytes removed ,  3 May 2014
moving CRSA talk
m (wish list: RePhysics file for direct reimports of onis)
(moving CRSA talk)
Line 1,222: Line 1,222:


Older onisplit versions (like 0.9.86.0) may generate ONLV files that are not re-packable with newer versions.
Older onisplit versions (like 0.9.86.0) may generate ONLV files that are not re-packable with newer versions.
----
'''Old talk:''' I simply put this section here because I hope Neo will soon integrate it. --[[User:Paradox-01|paradox-01]] ([[User talk:Paradox-01|talk]]) 17:28, 28 December 2013 (CET)
(You can try to edit the final ONLV*.oni on your own. See [[XML:ONLV#CRSA|HERE]].)
I only tried it once like an year ago, probably something was wrong with it.
Recently I tried to do similar with xml editing.
:Oni gets body parts by reading the referenced ONCC file and its links until it gets the 3D content
:So far the theory. In praxis the model will appear differently.
:While a folded (not ''animated'') corpse imports fine, a corpse with rotated bones becomes a mess.
:I tried rotations with [https://dl.dropboxusercontent.com/u/139715/OniGalore/local_correct_pelvis.png local] and [https://dl.dropboxusercontent.com/u/139715/OniGalore/global.png global] values, both ended up in a messed up state.
:With local values at least the pelvis looks correct.
:So what's the problem?
:: When we look at character animations (TRAM), for instance, the rotations of the right fist are just delta values of the right wrist, and right wrist holds only the delta values of the right arm, and so on.<br>So the final x y z rotation of the right fist is its own rotation plus all rotations down to the pelvis.
:: This method doesn't seem true for CRSA. With local rotations used, the pelvis was spawned correctly but not the other parts.
:: Due to this observations I think each body part is looked up separately which means for Oni to build the corpse with no hierarchal structure.
:: To test this I took a character, rotated the parts, and [[Mod_Tool#Exchange_meshes_in_hierarchies|destroyed]] the hierarchy revealing the true local rotation values of each part.
:: Those rotations and positions where entered into [https://dl.dropboxusercontent.com/u/139715/OniGalore/OniMatrix_src.zip Neo's matrix program.] I then put the matrix to into the CRSA instance of the extracted ONLV file, then reconverted to oni.
:: Ingame, the corpse was [https://dl.dropboxusercontent.com/u/139715/OniGalore/CRSA_manually_imported.png looking quite good.] There were some tiny difference which possibly come from the fact that the matrix program works with integers and not float values.
::: Here's an [https://dl.dropboxusercontent.com/u/139715/temp/snipers.dae example] of an intact and a destroyed hierarchy.
::: Note to self: [https://dl.dropboxusercontent.com/u/139715/OniGalore/ModToolScript/CRSA_wip.txt old code] meant for intact hierarchies. Needs to be changed later for proper local values.
::: Let's take intact character for a new experiment.
::: When we apply null objects to each body part and compare its local values with the parts of the destroyed hierarchy, the values are the same, just multiplied by -1.
::: Second experiment. When the parts in the intact hierarchy becomes rotated, the values will not fit. Not until we reset the null's global values to 0; 0; 0 and multiply by -1 again.
::: What does this mean?
:::: Still I've no clue how to ''calculate'' the required values but with the null objects it got a lot easier to ''farm'' them.
:::: So coding a workaround became a feasible option.
'''Edit // 8th Feb 2014 // getting rid of the null objects:'''
It's possible to calculate the local rotations in a hierarchy using matrix multiplication. The final matrix must be inverted and the xyz values multiplied by -1.
Before calculations are started the rotation order of all objects must be changed from ZYX to XYZ.
What makes the code bulky is the need to go through all involved body parts and that 19 times.
'''Edit // 9th Feb 2014 // getting not rid of the null objects:'''
The code seemed to work fine until different rotations were used for all objects in the hierarchy. So for now there will be no simplification.
----




Line 1,292: Line 1,229:


A workaround might be to save characters without animations, destroy their hierarchy, apply the local rotations / global translation and glue everything together again.
A workaround might be to save characters without animations, destroy their hierarchy, apply the local rotations / global translation and glue everything together again.


==Level reimport==
==Level reimport==
8,047

edits