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!
Alchemist
#26 Old 10th May 2010 at 9:13 PM
Quote: Originally posted by ChaosMageX
If you are looking manually at the hex for those CLIP files, then let me know what you find in terms of their actor/slot pairs and clip events. I still wish Wes's AnimTool would at least export the other sections of the clip as text based ASCII files like how his object mesh tool exports the Material data.


That would be a purpose better served by a separate editor, in that there is just no place to put the data in MilkShape, or Maya, or anything else I know where it can be handled properly.

The file converter carefully copies the original data blocks, and rearranges the file offset pointers to maintain the overall integrity of the CLIP format. It serves the design I had for it, which was to extract and insert the animation frames from some sort of standard file format.

If you are keen on delving further into the process, I would consider transferring the project to you. It is a C++ project and was build with Visual Studio 2008, although I doubt there is any reason it could not be redone in Visual Studio 2005. Most of the real work is done by two modules that can be recompiled as command-line tools, the GUI module just wraps them and maintains a few global variables.

If you like to say what you think, be sure you know which to do first.
Advertisement
Alchemist
#27 Old 10th May 2010 at 10:51 PM
I downloaded the one called GR2 Expotron Exporter (3dsMax) which is the last on the list in the "Latest" section right above the archive section. This is the right one isn't it? There is only one application in that zip...the granny2.dll. The others are a DLE and a DLO and I did not put those into the CAW folder.

Also, I've found two exe.s and have tried both with no luck. If I leave them where I got them I get the path error and if I move one to the general CAW folder where the granny2.dll is I get a different error. I'm trying to click the exe right from in the folder it came from or from the CAW folder. Should I be trying something different? I apologize for asking about this again...please disregard if you're too busy to answer.
Lab Assistant
Original Poster
#28 Old 11th May 2010 at 12:26 AM
orangemittens, could you be a bit more specific about describing the errors you're getting.

From the sounds of things, you were trying to run this tool in two different locations, and each gave you a different error.

First of all, the tool's exe file is S3RIGMaker.exe. That is the one you click on to use the tool.

The other exe, TransformDialog.exe, is just a wrapper for opening the transform editing dialog separately from the rest of the tool in order to debug its math and general functioning.

Secondly, if you want to my tool, you have to have the following files in the same directory as CAW.exe. This is the bare minimum and there are no exceptions:
S3RIGMaker.exe
ChaosMageX.Granny2.dll
granny2.dll

Unless all three of those files are in same directory as CAW.exe, the tool will not work. If you are still getting an error with all three of those files in the CAW.exe directory, then you need to tell me what that error is.

From the sounds of it, you downloaded the correct version of the granny2.dll, so you won't have to worry about that. What exactly is the error again?
Alchemist
#29 Old 11th May 2010 at 12:47 AM
Thank you for the reply CM ...I will look at where I have everything and place it as you have instructed. If it all works I'll post what I had wrong so that others aren't making the same mistakes I've made.

I'm absolutely positive this is an installation error on my part and have been convinced of that all along...so your help in this is greatly appreciated.
Alchemist
#30 Old 11th May 2010 at 2:04 AM
CM, I have two files both of which are named S3RIGMaker.exe. One is in S3RigMaker/bin/Debug and the other is in S3Rigmaker/obj/Debug. I have tried moving them both but get an error if I use them from the new place I am trying to use them from.

Are you saying I need to move ChaosMageX.Granny2.dll from C:\Program Files (x86)\Electronic Arts\The Sims 3 Create a World Tool\ChaosMageX.Granny2\bin\Debug out into the general CAW folder to get this to work?

And if so, which exe should I move there also...the one in the bin or the one in obj?

Thank you for any help with this
Lab Assistant
Original Poster
#31 Old 11th May 2010 at 5:39 AM
Oh, you downloaded the source. You need to just download the file S3RIGMaker.rar from this thread and extract all its contents to CAW's directory. Then it should work. The source is only there for people who want to modify it and try compiling their own versions.

I've fixed the download instructions in the first post to say that you need to download the file S3RIGMaker.rar and extract its contents to the same directory as CAW.exe

If you aren't a programmer, then why did you download the source in the first place?
Alchemist
#32 Old 11th May 2010 at 6:29 AM
Er...because I'm an idiot and didn't read the instructions clearly enough?..lol.

Now that you mention it I notice I downloaded two files...the source and the other one. I'll switch everything so I have the files from the right one in. Thank you again for the help and sorry to have taken space up with this stupid mistake
Lab Assistant
#33 Old 11th May 2010 at 1:45 PM
I'm sorry to ask,,,but what exactly is a RIG XD???
Lab Assistant
Original Poster
#34 Old 11th May 2010 at 3:25 PM
In layman's terms, a RIG is what stores an object's skeleton, which is used with CLIP files to animate the object (make it move), and with RSLT files slot other objects to it (attach other objects to it).

A RIG is the file inside a package with the type ID 0x8EAF13DE. See this page of the TS3 wiki for more info.

You can use a tool like S3PE to export these RIG resources from their packages, then use this tool make new RIGs from the old names, and then use S3PE again to import the new RIGs into the file.
˙uʍop ǝpᴉsdn ǝɹ,noʎ 'oN
#35 Old 11th May 2010 at 5:22 PM Last edited by cmomoney : 11th May 2010 at 5:35 PM.
I wanted to see more of the chair/table animations in action with the kid chair, so I made a kid table (retrofitted coffee table):



I found that once the sim pulls the chair up to the table (to eat for example), the sims snaps into the correct position in the chair. It's only when they pull the chair out and just sit that they're in the original position. I'm guessing that its an animation that is not bone/slot dependent (like getting in bed)?

Also the pedestal cube has code that deals with its slots and bones. It tells how many can be stacked indoor and out, among other things.

"Part of being a mesher is being persistent through your own confusedness" - HystericalParoxysm
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
Lab Assistant
#36 Old 12th May 2010 at 1:49 PM
Quote: Originally posted by ChaosMageX
In layman's terms, a RIG is what stores an object's skeleton, which is used with CLIP files to animate the object (make it move), and with RSLT files slot other objects to it (attach other objects to it).

A RIG is the file inside a package with the type ID 0x8EAF13DE. See this page of the TS3 wiki for more info.

You can use a tool like S3PE to export these RIG resources from their packages, then use this tool make new RIGs from the old names, and then use S3PE again to import the new RIGs into the file.



Wow.. thats sounds amazing!
Lab Assistant
#37 Old 13th May 2010 at 3:37 AM
I was wondering, if it's possible to alter an object's position ( translate it it a bit) using the root bone or transform bone's
transform matrix? not the slots contents, but the object itself.
Alchemist
#38 Old 13th May 2010 at 5:17 AM
The short answer is Yes, but...

The root joint (or the transform joint, which serves as the root for most objects) is usually at 0, 0, 0 and the slot sets an offset for the entire object. For ordinary things, this is 0, 0, 0 also and is the center of a tile, but a slot on top of a table might be at 0, 0, 0.5 (Z up) which would be 1/2 meter above the 'ground'.

If you put that translation on the root instead, and the slot is set to 0, 0, 0 you should see the same effect. However, you will probably have side effects during some animations, especially on Sims, because the animation software will be changing values on the root joint if the object is designed to move... one example is the Sims getting on a barstool, that animation has root joint translations and rotations. In that case, when the animation starts you should see the sim snap from where you put him back into the slot + the animation action positioning.

If you like to say what you think, be sure you know which to do first.
One horse disagreer of the Apocalypse
#39 Old 13th May 2010 at 12:05 PM
How do we identify that root joint, in the RSLT and RIG?

"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Lab Assistant
#40 Old 13th May 2010 at 12:33 PM
inge,
in the the _rig they are named b_ROOT_ and transformBone,
neither bone is listed in the RSLT or FTPT,
we were talking of the transformBone

ChaosMageX,
The tool doesn't appear to be saving changes to any matrix that are not position changes.
For example I made the following change in both entries for the transformBone and tried it in
the base matrix in the model tree,

from:
1 0 0 0
0 1 0 0
0 0 1 0
X Y Z 1

To:

1 0 0 0
0 1 0 1
0 0 1 0
X Y Z 1

But when the file is reloaded the matrix value I changed contained the original values.
I can change the XYZ value of the transformBone and it will be kept.

Also If I make and save the above change, save it and reopen the matrix in the editor,
the editor will not show the new value, even though the tree view contains the new value,
it is instead displaying the default values for everything except the XYZ entries, saving isn't req'd to get the bug.
Alchemist
#41 Old 13th May 2010 at 2:16 PM
The matrix order you are using is column oriented. The more commonly used version is by rows, and looks like this:

1 0 0 X
0 1 0 Y
0 0 1 Z
0 0 0 1

It is the same except it is ordered differently. This example is an identity (essentially zero) rotation with XYZ translation values.
The bottom row is always 0 0 0 1. Your changes would make the bottom row 0 1 0 1; that did nothing, the code is probably ignoring that row.

All rotations in a 3D matrix involve more than a single axis. For example, when you apply a rotation to the vertical axis (Z or Y, whichever), the other two horizontal ones now point somewhere other than exactly sideways and front/back, and that change will be seen in the values for those axes also. You can't just change one axis and leave the other two the same and still have a matrix that represents three unique axes, each perpendicular to the other two.

If you like to say what you think, be sure you know which to do first.
Lab Assistant
Original Poster
#42 Old 13th May 2010 at 6:02 PM
Yes, but it isn't ordered like that Wes. The position data is in the bottom row of the matrix, not the right-most column. I know this because that's the only way to get position data to "stick" when passing a matrix to the CSHostWrap.dll that writes the RIG files.

However, Wes is right in terms of what you need to change to get rotation to apply: it needs to be a valid rotation matrix, or at least one that can be interpolated as such. For those who are curious and haven't downloaded the source code...

Here is the EAxoid code for translating a 3x3 rotation matrix into a quaternion (which may or may not be the code hidden inside Sims3Common.dll that is used to turn the 4x4 matrix into a granny transform):

Code:
public static Quaternion MakeFromMatrix44(Matrix44 xf)
        {
            float num6;
            float qx = 0f;
            float qy = 0f;
            float qz = 0f;
            float qw = 0f;
            float trace = (xf.right.x + xf.up.y) + xf.at.z;
            if (trace >= 0f)
            {
                num6 = (float)Math.Sqrt((double)(trace + 1f));
                qw = 0.5f * num6;
                num6 = 0.5f / num6;
                qx = (xf.up.z - xf.at.y) * num6;
                qy = (xf.at.x - xf.right.z) * num6;
                qz = (xf.right.y - xf.up.x) * num6;
            }
            else
            {
                int maxDiagIndex = 0;
                if (xf.up.y > xf.right.x)
                {
                    maxDiagIndex = 1;
                    if (xf.at.z > xf.up.y)
                    {
                        maxDiagIndex = 2;
                    }
                }
                else if (xf.at.z > xf.right.x)
                {
                    maxDiagIndex = 2;
                }
                switch (maxDiagIndex)
                {
                    case 0:
                        num6 = (float)Math.Sqrt((double)((xf.right.x - (xf.up.y + xf.at.z)) + 1f));
                        qx = 0.5f * num6;
                        num6 = 0.5f / num6;
                        qy = (xf.up.x + xf.right.y) * num6;
                        qz = (xf.right.z + xf.at.x) * num6;
                        qw = (xf.up.z - xf.at.y) * num6;
                        break;

                    case 1:
                        num6 = (float)Math.Sqrt((double)((xf.up.y - (xf.at.z + xf.right.x)) + 1f));
                        qy = 0.5f * num6;
                        num6 = 0.5f / num6;
                        qz = (xf.at.y + xf.up.z) * num6;
                        qx = (xf.up.x + xf.right.y) * num6;
                        qw = (xf.at.x - xf.right.z) * num6;
                        break;

                    case 2:
                        num6 = (float)Math.Sqrt((double)((xf.at.z - (xf.right.x + xf.up.y)) + 1f));
                        qz = 0.5f * num6;
                        num6 = 0.5f / num6;
                        qx = (xf.right.z + xf.at.x) * num6;
                        qy = (xf.at.y + xf.up.z) * num6;
                        qw = (xf.right.y - xf.up.x) * num6;
                        break;
                }
            }
            return new Quaternion(qx, qy, qz, qw);
        }


And here is the "Default" code for turning a 3x3 matrix into a quaternion that I came up with based on stuff from Wikipedia, EuclideanMath.com, and MATLAB Documentation:

Code:
double mag = this.Magnitude();
            double m00 = (double)this.right.x / mag;
            double m11 = (double)this.up.y / mag;
            double m22 = (double)this.at.z / mag;
            double qx = Math.Sqrt(0.25 * (1.0 - m00 - m11 + m22)) * mag;
            double qy = Math.Sqrt(0.25 * (1.0 - m00 + m11 - m22)) * mag;
            double qz = Math.Sqrt(0.25 * (1.0 + m00 - m11 - m22)) * mag;
            double[] qw = new double[6];
            double m01 = (double)this.right.y / mag;
            qw[0] = (0.5 * m01 - qx * qy) / qz * mag;
            double m02 = (double)this.right.z / mag;
            qw[1] = (qx * qz - 0.5 * m02) / qy * mag;
            double m10 = (double)this.up.x / mag;
            qw[2] = (qx * qy - 0.5 * m10) / qz * mag;
            double m12 = (double)this.up.z / mag;
            qw[3] = (0.5 * m12 - qy * qz) / qx * mag;
            double m20 = (double)this.at.x / mag;
            qw[4] = (0.5 * m20 - qx * qz) / qy * mag;
            double m21 = (double)this.at.y / mag;
            qw[5] = (qy * qz - 0.5 * m21) / qx * mag;
            return new Quaternion((float)qx, (float)qy, (float)qz, (float)qw[1]);


Again, the math for translating between 4x4 transformation matrices and position vector/rotation quaternion/scaling 3x3 matrix of a granny transform is the most flawed part of this program.
This is because of my inexperience with this math and the fact that the EAxoid's code is just generally weird sometimes when it comes to math in general.
It's one of the main reasons why I put the program's source code up in this thread. I was hoping someone more skilled in this area of math would come along and fix it for me. :P
˙uʍop ǝpᴉsdn ǝɹ,noʎ 'oN
#43 Old 13th May 2010 at 6:20 PM
So, what you all are saying is that if you rotate something on its up axis, you would also have to change the values of the other axes to their new position relative to the up axis's rotation?

"Part of being a mesher is being persistent through your own confusedness" - HystericalParoxysm
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
One horse disagreer of the Apocalypse
#44 Old 13th May 2010 at 6:40 PM
/me shudders - it was only a matter of time before someone had to post a load of mumbo-jumbo about quaternion equations

"You can do refraction by raymarching through the depth buffer" (c. Reddeyfish 2017)
Alchemist
#45 Old 13th May 2010 at 8:14 PM
The matrix math does the same job as, but differently from, a quaternion. But yeah, the math is tough.
The 16 floats that make up a 4x4 matrix can be arranged with either the row or the column as the major index. That is Matx[row][col] or Matx[col][row]. It's the same thing, but implemented differently. For either, one row or column is always 0, 0, 0, 1 and that intersects with a row or column that is X, Y, Z, 1. Many matrix math algorithms are built around an process that multiplies each row with a different column, so the extra row (or column) provides symmetry for that purpose. The real data is in the 3x3 matrix starting in the upper left corner and the three translation values.

Quote: Originally posted by cmomoney
So, what you all are saying is that if you rotate something on its up axis, you would also have to change the values of the other axes to their new position relative to the up axis's rotation?


Exactly. Take a small square of note paper, and put a big letter 'Z' on it. Draw an arrow pointing up and label that Y and an arrow pointing right and label that X. Look down at the paper from above, and turn the paper 90 degrees to the right so that the 'Z' now looks like and 'N'. Both the X and the Y arrows have moved, X is now pointed down and Y is now pointed to the right. [This example uses 3DS Max orientation and not MilkShape].

The difference is, if they were just three Euler angles, only the value for the Z would change, because it was the only one rotated. But the matrix describes three vectors, one for the way each ray points. They work like normals do, in fact a normal is a vector. But for a matrix, you have three of them, each has a value, and in order to keep them all at right angles, they all need to be adjusted. The matrix math routines do that, you can avoid understanding the math if you just learn enough to figure out which values get plugged in where.

Here is a handy-dandy online calculator for 4x4 matrix calculations, courtesy of Martin Baker. To rotate a matrix, you multiply it by another matrix to get a third matrix. Here is an online Euler to matrix calculator, again from Martin Bakers site.

Now, if you find this difficult to understand, well, you have plenty of company, including me.

If you like to say what you think, be sure you know which to do first.
Lab Assistant
#46 Old 13th May 2010 at 10:07 PM
Ok, my need got lost here

I want to move, not rotate, an object to a specified Y-Coordinate,
and the matrix I posted was in the form used by CMX's tool.

I'm trying to find out which formulea would (for example) place an object at 0X, 1Y, 0Z ,
instead of at 0X, 0Y, 0Z.

+--------+ +--+ +-------+
|1 0 0 Tx | |Vx | | VXout |
|0 1 0 Ty | |VY|=|VYout |
|0 0 1 Tz | |Vz | | VZout |
+--------+ +---+ +------+
Where:
Tx, Ty, & Tz = amount to move by
Vx, Vy, & Vz = objects original XYZ coordinates

Tx+Vx=VXout
Ty+Vy=VYout New XYZ Coordinates
Tz+Vz=VZout

Or

+-------+ +-------------+ +---+
| VXout | |M00 M01 M02 | |Vx |
| VYout |=|M10 M11 M12 | |Vy |
| VZout | |M20 M21 M22 | |Vz |
+-------+ +-------------+ +--+

Where
(Vx*M00)+(Vx*M01)+(Vx*M02)=VXout
(Vy*M10)+(Vy*M11)+(Vy*M12)=VYout New XYZ Coordinates
(Vz*M20)+(Vz*M21)+(Vz*M22)=VYout

Now the Matrix I post should have bee labeled better

1 0 0 Tx
0 1 0 Ty
0 0 1 Tz
X Y Z 1

Where XYZ are the original coordinates
and
Tx, Ty, & Tz are how much I want the object to be moved BY.
so the final matrix I posted:

1 0 0 0
0 1 0 1
0 0 1 0
0 0 0 1

Would mean that I wanted the object to be placed at Ox 1 y 0z
instead of at 0x 0y 0z, But I don't think the editor is saving the values i'm entering
Lab Assistant
#47 Old 13th May 2010 at 11:45 PM
alright it's confirmed, If I edit a bone's position, the data is saved,
but editing other cells of a matrix doesn't save.

In the attachment's left side you can see that I edited the
base matrix of Model#0 and saved the file.
You can see the save as dialogue isn't listing the correct tree node either.
I didn't edit either of the 2 listed nodes.

I opened the edited file with a 2nd instance of the tool and
as you can see the data was not saved.

I also redid this experiment and edited the transform matrix of a specific bone, changing the exact same values, and they were not saved either.
Screenshots
Lab Assistant
#48 Old 16th May 2010 at 1:06 PM
so, how long before translate matrices are possible?
Lab Assistant
Original Poster
#49 Old 16th May 2010 at 10:20 PM
Quote: Originally posted by Raven Shadow
so, how long before translate matrices are possible?


Unfortunately, it may be a long time, considering that the CSHostWrap.dll methods only write the position and rotation data into the GrannyRig files, and never the translation.

I'm assuming the translation/scaling is stored in the 3x3 matrix in the granny transform, but unfortunately this is always written as
1 0 0
0 1 0
0 0 1
In all the already existing grannyrig files in the game data and in any new files written by the CSHostWrap.dll methods. Until I can figure out how to use the granny2.dll to write files directly, they will sadly always be off limits to us.

And also, a guy with the username rothn recently gave me some potential new code for translating a quaternion into a 4x4 rotation matrix, but I need to ask him about the ordering of the coordinates in the matrix and quaternion, and if he can provide me with code for going the other direction and turning a rotation matrix into a quaternion.

Also, Raven Shadow, if you just changed that one coordinate from 0 to 1, then that's not a valid rotation matrix and it will not get translated into a quaternion, so it's understandable that it is not saving to the new grannyrig file.
Lab Assistant
#50 Old 16th May 2010 at 11:40 PM Last edited by Raven Shadow : 17th May 2010 at 2:04 AM.
Thanks for the info CMX :0
It wasn't supposed to be recognised as a rotation matrix, I was hoping the format would be recognized as a translation matrix,
But if a 4x4 matrix can't be saved , yet, exactly as entered by the user, I'll have to play some more with the 2nd formulea I posted above.

Quote: Originally posted by ChaosMageX
In all the already existing grannyrig files in the game data and in any new files written by the CSHostWrap.dll methods. Until I can figure out how to use the granny2.dll to write files directly, they will sadly always be off limits to us.


So you can't use Triexporteres code for writing them?
Page 2 of 3
Back to top