Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Test Subject
Original Poster
#1 Old 7th Sep 2009 at 9:26 PM
Default [Question]mod object skeletons (granny 3d) ?
Greetings,

I have 2 questions regarding car modding :
Is it possible to assign new joints from a completely new _RIG (.grannyrig / .gr2) file ?
or, Is it even possible to mod the object's skeleton ??

I'm talking about granny 3d files.
I know every car modder must have encountered the same problem I'm currently facing :
Adjusting the wheelbase to match the cloned car to have a correctly working wheel animation, thus limiting the number of models to import.
It's frustrating..

So I tried to mod the .grannyrig file (or .gr2)
I managed to import the .gr2 file using tools from Neverwinter Nights community (NWN2 MDB utilities)
available here : http://nwvault.ign.com/View.php?vie...ns.Detail&id=27
I've edited the bones according to my car's wheels position : (it's a simple Z-axis movement)


and exported the modded rig using Obsidian's expotron granny3d exporter plugin (again, from NWN2)
available here : http://gr2decode.altervista.org/download.html (scroll down till you find GR2 Expotron Exporter)



previewed with granny viewer (comparing with the original car's skeleton)
granny viewer is available here : http://www.radgametools.com/granny/download.html


and replaced the _RIG file in the package with a new one,
only to find out that it's not working.. T_T

so I'm guessing, the joints assignment within the modl/mlods must be changed.. to what ??
How would I know the joints name from the new _RIG file ??
or even worse, is the new _RIG file even readable by the game's engine ?
Because there's no animation included with the _RIG file.
I'm afraid it might be somewhere else, referencing to the _RIG, making matters even worse.. >.<

here's the second question :
Does anyone know of a way to adjust the joints position by means of HexEditing..?
Not that I haven't tried, but I think it's compressed, making it hard to read..
either that or I'm just too dumb to fool around with hexes..

Somebody please help, Any kind of help is appreciated..
Thanks in advance..
Advertisement
Alchemist
#2 Old 7th Sep 2009 at 9:41 PM
There is a matrix for each joint in each MLOD/MODL file. You can see these in the mesh files, in the SKIN section, and the values there are reflected in the recompiled files.

As a matrix, it is a combination of a rotation and a translation, so you can't just edit only the X, Y or Z position values (4th, 8th and 12th of 12 values, respectively). But it is likely you can transfer the floats from the Granny Viewer, however, I haven't studied whether they are in the same order; Sims 3 .skcon (body meshes) and the joints in the MODL/MLOD files each use a different matrix layout.

<* Wes *>

If you like to say what you think, be sure you know which to do first.
Lab Assistant
#3 Old 7th Sep 2009 at 9:49 PM Last edited by ChaosMageX : 7th Sep 2009 at 10:00 PM.
Okay, there are indeed joints in the MODL and MLOD files.
This could confirm my hypothesis about the game being very strict about the transformation matrices of the joints in the MLOD and _RIG files matching up.

If that is the case, you need to write down the new positions of the joints.

Then you need to fnv32 hash the names of the joints you changed and find the corresponding joints in the meshes exported by Wes's tool. They'll be named 0x########, with the number being the hex hash of the joint's name.

Once you've changed the positions of the joints in the mesh to match those of the corresponding joints in the new grannyrig, recompile the meshes and re-import them.

Also, another problem could be that the object cloner is not changing the name of the grannyrig file, and it could be overwriting the old file.

Tell me, when you loaded your new car into the game, did none of the cars work or did only your car not work?

EDIT: And Wes is correct about the rotations needing to match as well.
If you only changed the positions, you don't have much to worry about, unless the grannyrig importers/exporters were anal enough to change the rotation matrices, in which case you'll have to use the granny viewer to get the transformation matrixes and then manually edit the ones of the corresponding bones to match by editing the SKIN chunks of the meshes with the hex editor.

Here's how the transformation matrices break down from hex to something understandable:

Here is the order in which the twelve floats appear in the file:

A B C D E F G H I J K L

You can turn them into an understandable transformation matrix:
A E I (relative vector for x axis)
B F J (relative vector for y axis)
C G K (relative vector for z axis)
D H L (position of joint; origin)

I hope that helps you understand them. I should really write a page in the wiki about transformation matrices and how the game files store them.

And please let me know how this works out. This may help me decide whether or not Autodesk 3DS Max is worth investing in.
Alchemist
#4 Old 7th Sep 2009 at 10:14 PM
I was wrong, the matrix values in the .s3asc files are not compiled into the SKIN chunks, the values in the SKIN chunks are copied from the input to the output when the recompilation happens. They just also appear in the mesh file, what is transferred from the mesh file is the assignments themselves.

The SKIN file layout is accurately documented on its wiki page, it is pretty simple, there are 13 values for each joint, one of which is the joint name hash and the other 12 are ordered like CMX says, but some of the signs are different than expected.

<* Wes *>

If you like to say what you think, be sure you know which to do first.
Test Subject
Original Poster
#5 Old 8th Sep 2009 at 2:15 PM
Hi, thanks for the quick response guys..

I've edited the mlod & modl files using hex editors and changed the last value for Z-axis relative vectors..

original
Code:
0 5CEF0450 1.000000 0.000000 0.000000 0.710591 0.000000 -0.951598 0.307347 -0.126960 0.000000 -0.307347 -0.951598 1.587040
1 3E70FD35 1.000000 0.000000 0.000000 0.690288 0.000000 -0.951598 0.307347 0.802448 0.000000 -0.307347 -0.951598 -1.290570
2 19CF9476 1.000000 0.000000 0.000000 -0.710591 0.000000 -0.951598 0.307347 -0.126959 0.000000 -0.307347 -0.951598 1.587030
3 CD68F001 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000
4 F8CF5C13 1.000000 0.000000 0.000000 -0.691782 0.000000 -0.951598 0.307347 0.802448 0.000000 -0.307347 -0.951598 -1.290570


Edited
Code:
0 5CEF0450 1.000000 0.000000 0.000000 0.710591 0.000000 -0.951598 0.307347 -0.126960 0.000000 -0.307347 -0.951598 1.521440
1 3E70FD35 1.000000 0.000000 0.000000 0.690288 0.000000 -0.951598 0.307347 0.802448 0.000000 -0.307347 -0.951598 -1.224970
2 19CF9476 1.000000 0.000000 0.000000 -0.710591 0.000000 -0.951598 0.307347 -0.126959 0.000000 -0.307347 -0.951598 1.521440
3 CD68F001 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000
4 F8CF5C13 1.000000 0.000000 0.000000 -0.691782 0.000000 -0.951598 0.307347 0.802448 0.000000 -0.307347 -0.951598 -1.224970


I simply add/deduct the last values with +/- 0.0656 (the value that I used when moving the joints as well as the wheel's mesh)

And IT WORKED like charm!! well, not really.. the wheels rotation is a bit shaky, but a whole lot better than before.. maybe because I'm using blender for mesh modeling and 3ds for joints adjustment and their units just don't match..
at least now I know the new _RIG works.. though I haven't tried changing the driver's seat..
I've always wanted a car with Right-steering wheel.. ^^

And I've also tried importing the package with the hex edited modl & mlod without replacing the old rig file. The animations (wheel rotation) is correct, but the wheels position itself is wrong.. so it does need a modded RIG to make it work..

one more thing, when I was trying to figure out the matrices from granny viewer, somehow it looks very different than the matrices in mlod & modl..

too bad I haven't been able to do some thorough testing, too busy with RL..

Anyways, Thanks Again for the help..
Alchemist
#6 Old 8th Sep 2009 at 4:58 PM
Thanks for sharing your findings. While solving the matrix math requires a little more than changing the Z value (an unwanted rotation is undoubtedly why the wheel was rotating off center), it was a good test.

<* Wes *>

If you like to say what you think, be sure you know which to do first.
Back to top