Page 1 of 1

TRAN section in msh

Posted: Mon Dec 09, 2013 9:06 am
by Anakin
Hi,

i saw this tutorial here:
http://www.gametoast.com/forums/viewtop ... 27&t=12263

But i at my hex editor there is no float value. i only have IEEE for double but it's longer than 4 byte

==EDIT==

ok i got it to change the values. But now i have the problem, that the values don't behave like i think.

First i changed the size. worked fine. than i rotated around the y achse.but when the value became bigger than 0,75 (i changed the scale to 0,75) the object became bigger. -.- So is there maybe a trick how to move and scale the objects??

Re: TRAN section in msh

Posted: Mon Dec 09, 2013 12:04 pm
by tirpider
I've been goofing around with hex-editing these msh files for a couple of years. TRAN is one of the earliest chunks to be sorted out, but I have yet to see anyone use/manipulate it effectively via hex-editing. Like you have discovered, weird scaling shows up, especially when you try rotations.

My solution has been to actually move all the verts instead of messing with TRAN. And if I need a rotation, I import with ZETools or give up. Both "solutions" go beyond what I would call hex-editing and don't solve the troubles with TRAN.

I suspect there is some confusion about the order of the fields, but haven't experimented with them. (welp, I guess not.) I hope someone can illuminate this, cause I want(need) to know as well.

If it helps, here are my notes on MSH structure:
http://www.swbfgamers.com/index.php?topic=3905.0

And here are Ande's:
http://www.ande.pytalhost.eu/reorganized_msh_tables.htm

In the case where Ande and I have different information, his is most likely more accurate. (I haven't updated in a very long time.)

Re: TRAN section in msh

Posted: Mon Dec 09, 2013 2:39 pm
by AceMastermind
This is from the source code:

XSI2MSHExporter\XSI3\Libraries\MSHParser\MSHBlockModel.cpp

Code: Select all

	StartBlock(file, 'TRAN');
		WriteData(file,&m_fScaleX,sizeof(float));
		WriteData(file,&m_fScaleY,sizeof(float));
		WriteData(file,&m_fScaleZ,sizeof(float));
		WriteData(file,&m_fQuatRotX,sizeof(float));
		WriteData(file,&m_fQuatRotY,sizeof(float));
		WriteData(file,&m_fQuatRotZ,sizeof(float));
		WriteData(file,&m_fQuatRotW,sizeof(float));
		WriteData(file,&m_fTransX,sizeof(float));
		WriteData(file,&m_fTransY,sizeof(float));
		WriteData(file,&m_fTransZ,sizeof(float));
	EndBlock(file);
RepSharpshooter's order is not accurate in comparison to the source. We'll need to update his information if it is to remain an FAQ thread. *done*

Re: TRAN section in msh

Posted: Mon Dec 09, 2013 2:45 pm
by Anakin
mh ok thank you.

i gave up to rotate. it's really wired. But i wanted to scale a chunk up. That worked fine for me at the Msh Viewer, but ingame it's not scaled up. Someone an idea??

Re: TRAN section in msh

Posted: Tue Dec 10, 2013 1:22 am
by AQT
The only thing I have been able to get working properly with the TRAN chunk is translation, but I don't have a systematic way of doing it other than guessing and checking.

You have the 12 bytes in a row, where the first four refer to the x-axis, the second four refer to the y-axis, and the last four refer to the z-axis. But only the last two in each of the fours do the translating. So something like:
00 00 00 00 00 00 00 00 00 00 00 00
The first value in each of these twos translates the object in big intervals, while the second value does small intervals. From what I've seen, you can't use the second value properly until the first value is "right" (i.e. guess and check the first value until the object starts moving.) Once you find this value, also guess and check the second value until the object starts moving. Not very efficient, but it gets the job done.

Re: TRAN section in msh

Posted: Tue Dec 10, 2013 4:50 am
by Anakin
Thank you very much for this. What about the scaling?? Why does it work in mah viewer and not ingame?? Is there a special .option file i need?

Re: TRAN section in msh

Posted: Tue Dec 10, 2013 2:22 pm
by AceMastermind
No need to punish yourself, ANDEWEGET's MSH Suite can save you the time trying to figure this stuff out. He even wrote it to show Transform rotation in Euler angles so you can actually visualize your modifications.

forums/viewtopic.php?f=36&t=28451
https://github.com/Schlechtwetterfront/mshsuite

Re: TRAN section in msh

Posted: Wed Dec 11, 2013 6:13 am
by Anakin
NICE :D

I forget this topic. I think i'll have a closer look at it. It' written in python. I think i'll have to look at python, too. ;) Since now i only programed in assambler, c, c++, matlab and a little bit java.