1 people viewing
Quick Reply
Search this Thread
Test Subject
Original Poster
#1 Old 17th May 2024 at 12:10 AM
Default Sims 2 Animations exported with baked inverse kinematics
Hey all, if you've ever tried to export animations from sims 2, you'll know that they do this weird thing where they don't quite look right. This is because the animations use inverse-kinematics, the animators say where the hands/feet/head/etc should go and then the 3d animation program figures out how to move the limbs to make it happen.



In most games these inverse kinematics get "baked" into the animation files so the movement of each individual bone and limb is recorded. But unlike most games, Sims 2 uses these inverse kinematics in the final animations shipped with the game and the game engine runs the inverse kinematics as you play.


With that background out of the way, I was looking at reverse-engineering the animation format for OpenTS2 and figured out how these inverse-kinematics are set up. I haven't documented my findings but you can find some more information on the cAnimResourceConst scenegraph blocks here. With the inverse-kinematics part of the animations decoded, we are now able to play some animations from the game successfully! (Note that some animations where the hands should be pinned to objects etc still don't work well)



Since this is all done in Unity, we can actually export these animations to a format that can be imported into blender. There isn't currently a way to directly export from blender back to a sims 2 animation file without milkshape (I might make a plugin for that if I'm feeling bored). But you try to customize these animations or try to port them to future games. I have exported 10 base game animations to a .glb file available here: https://blog.ammaraskar.com/assets/...es/bakedSim.glb

If you're just curious, there is also an online model viewer available here where you can view them straight from your web browser.


What's cool is this web editor can also display other game assets, such as the reclining chair here.



Unfortunately the process to export animations fully-baked yourself will be a bit involved and need some know-how on Unity but hopefully some of you can get through it and help others out.

1. Grab and setup the OpenTS2 bake_ik_animations branch code from here https://github.com/LazyDuchess/Open...ile#development
2. Open the SimAnimationTest scene and type in the name of the animation you want

3. Right click the bakedSim and select UnityGTLF and then Export Selected as GLB


Thank you to @AlexCroft for bringing this up on the OpenTS2 repo here! https://github.com/LazyDuchess/OpenTS2/issues/59
3 users say thanks for this. (Who?)
Lab Assistant
#2 Old 17th May 2024 at 11:11 PM
Thanks to @anmar2 's work we can now finally export ts2 animations to blender (using unity) ! I'm trying now to retarget the animation to a sims 4 rig in order to export animations in the sims 4 (like the car get in animation). But it's a difficult process. Maybe @omglo can help us in this project reversing the current 4to2 animation retargeting (https://modthesims.info/showthread.php?t=637212.

Screenshots

AlexCroft - Custom Content Creator
STAY TUNED!
YouTube
Patreon
Mad Poster
#3 Old 18th May 2024 at 1:48 AM
This is really great, guys.

I'd be willing to look into making a 2to4 rig when I have time.
Test Subject
#4 Old 19th May 2024 at 11:09 PM
woah this is incredible!! hopefully this is a big step forward to make a proper way to create animations for TS2 in Blender ♥ (wich I have been looking for years lol :_____) )
Mad Poster
#5 Old 21st May 2024 at 2:13 PM
@alexcroft - do you have a Sims 2 rig with the IK bones to work with, or are you usuing the old GMDC without those included?
Lab Assistant
#6 Old 21st May 2024 at 2:59 PM
The unity anmar2 script bakes the ik chain directly on the rig.
So the animation keys in the resulting exported rig are not on the ik bones.
Although you can export also the whole rig animation with the animation of the ik chain, you have to simply export the fbx using the unbaked animation.
I’ve tryed to reconnect the IK bones chain to the corresponding rig bones in blender, but it was difficult to me, so I prefer to use the ik baked version.

AlexCroft - Custom Content Creator
STAY TUNED!
YouTube
Patreon
Mad Poster
#7 Old 25th May 2024 at 4:23 PM
So, does anyone know what I'm doing wrong here? I filled out the config.json like this below and left it in the OpenTS2-bake_ik_animations folder. I installed the correct unity and VS.

"C:/Program Files/The Sims 2 Ultimate Collection",
"user_dir" : "C:/Users/myname/Documents/EA Games/The Sims™ 2 Ultimate Collection",
Screenshots
Lab Assistant
#8 Old 25th May 2024 at 11:30 PM
You have to press the play button in order to launch the script

AlexCroft - Custom Content Creator
STAY TUNED!
YouTube
Patreon
Mad Poster
#9 Old 26th May 2024 at 12:54 AM
Thanks, such a simple thing I missed. But I must've still done something wrong, because playing it says "object reference not set to an instance of an object" when I press play, and I don't get the baked Sim etc in the hierarchy like ammar2 has in their screenshot.
Test Subject
Original Poster
#10 Old 26th May 2024 at 1:08 AM Last edited by ammar2 : 26th May 2024 at 1:24 AM.
Make sure that in your config.json, the "dlc" array has the first element (the base game folder) set correctly. For example mine looks like this:

Code:
{
	"game_dir" : "C:/Program Files (x86)/EA Games/The Sims 2 Ultimate Collection",
	"user_dir" : "C:/Users/Ammar/Documents/EA Games/The Sims 2",
	"dlc" : [
		"The Sims 2",
                ...
         ]
}
Mad Poster
#11 Old 28th May 2024 at 4:15 PM
Thanks, I have it working and have been trying it out over the last couple days. Now I just have to see how these look after being filtered through milkshape.
Lab Assistant
#12 Old 17th Jul 2024 at 2:03 PM
Quote: Originally posted by omglo
Thanks, I have it working and have been trying it out over the last couple days. Now I just have to see how these look after being filtered through milkshape.


@omglo did you have successfully managed to create a Sims 2 to Sims 4 rig blender project?

AlexCroft - Custom Content Creator
STAY TUNED!
YouTube
Patreon
Mad Poster
#13 Old 17th Jul 2024 at 3:40 PM
I have not. I was working on it and hit a glitch and honestly forgot about it after that, since the process no longer works in new blender the way it did in the 2.7 version I used to make the other converters.
Test Subject
#14 Old 14th Aug 2024 at 4:31 PM Last edited by sim2fanyea : 14th Aug 2024 at 4:43 PM.
Hey !
I'm totally new to Unity, and after a while understanding how everything works, I was able to load the project. However, when I hit the play button, this is what I get. If I export the BakedSim as GLB, and import it in Blender, all I get is the skeleton, not even the animation or any mesh.
Did I do something wrong ?
May I also mention that to get to that point, I had to rename all my game files because my localization is FR and my game was called "Les Sims 2". Each time I was hitting "Play", I would get the "object reference not set to an instance of an object". When I renamed to "The Sims 2" it worked. Don't know if my issue has something to do with that... Also, I don't have the Ultimate Collection but the original games. When renaming my folders, I also changed the path to make it as if it was Ultimate Collection.
Screenshots
Mad Poster
#15 Old 16th Aug 2024 at 8:34 PM
I can't help you with Unity, but which version of blender are you using? because from what I can tell, this glb is incompatible with some of the older versions. Which brings up another issue - the newest version of blender that's compatible with Milkshape is 2.8, and the glb won't import into that. Appending the animation into blender over a skeleton compatible with milkshape's animation exporter didn't work either. So if you're creating for Sims 2 just be aware that there might not be a way to get anything into that game right now.
Test Subject
#16 Old 17th Aug 2024 at 10:40 AM
Quote: Originally posted by omglo
I can't help you with Unity, but which version of blender are you using? because from what I can tell, this glb is incompatible with some of the older versions. Which brings up another issue - the newest version of blender that's compatible with Milkshape is 2.8, and the glb won't import into that. Appending the animation into blender over a skeleton compatible with milkshape's animation exporter didn't work either. So if you're creating for Sims 2 just be aware that there might not be a way to get anything into that game right now.


I’m using Blender 4.0. I’m not creating for Sims 2 (not anymore at least for now 😔), I just want to get the animation data with the skeleton in blender and then retarget it to another rigged character of mine. But my glb doesn’t export any animation data, only the skeleton, not even the sim model… So I think something’s wrong in my Unity. Or with the fact that I don’t have Ultimate Collection, I don’t know.
And while we’re at it, I’ve seen we can also have objects animations and I’m really curious about how to get them as well.

Any idea about all that @ammar2 ?
Test Subject
Original Poster
#17 Old 20th Aug 2024 at 9:44 PM
Aah sorry, I don't think you'll be able to run OpenTS2 without the ultimate collection or with the french folder names. We rely on a certain layout of the folders and I'm not sure what it would be for non-ultimate collection sims 2.
Lab Assistant
#18 Old 20th Oct 2024 at 1:16 AM
Quote: Originally posted by omglo
I have not. I was working on it and hit a glitch and honestly forgot about it after that, since the process no longer works in new blender the way it did in the 2.7 version I used to make the other converters.


I don't think it's a problem related to a glitch. I also tried posting a question on the blender support forum , but it seems the issue is related to the empties connected to the rig, which have inverted scales and rotations. This causes inverted results in the 'child of' constraint. I'm trying to follow the suggestions from the forum, but I'm not having much success. Maybe you are more experienced with Blender and can manage? Or could we possibly obtain a rig already exported from Unity without inverted scales and rotations? @anmar2

AlexCroft - Custom Content Creator
STAY TUNED!
YouTube
Patreon
Mad Poster
#19 Old 26th Oct 2024 at 5:14 PM
Quote: Originally posted by AlexCroft
I don't think it's a problem related to a glitch. I also tried posting a question on the blender support forum , but it seems the issue is related to the empties connected to the rig, which have inverted scales and rotations. This causes inverted results in the 'child of' constraint. I'm trying to follow the suggestions from the forum, but I'm not having much success. Maybe you are more experienced with Blender and can manage? Or could we possibly obtain a rig already exported from Unity without inverted scales and rotations? @anmar2

I'm not sure how much luck I'd have. I used a (now deleted) tutorial from ThePancake1 when making the 3t2 and 4t2 rigs and ran into the rotation problems when I tried to use the same technique to make one for 2t4 conversions, so retargeting rigs isn't really something I'm an expert at.
Test Subject
#20 Old 4th Feb 2025 at 10:57 AM
Hello everyone ! I'm sending a message here with not too much hope of an answer, but let's try it 🤗
First, thanks all for your amazing work. After rediscovering the Sims 2 a little bit, I would love to be able to convert some interactions to the Sims 4, therefore, I need to be able to convert some animations.
I managed to download everything required, and I have the Ultimate Collection on my PC in English, but I'm facing exactly the same issue as sim2fanyea. I can find animations, even if they are displayed weirdly like in their screenshot, and see them in blender after, but I only get is a skeleton (with the animation), but no mesh or bone structure. Is there something that could be the cause of that ?
Thanks in advance and have a nice day !
Mad Poster
#21 Old 4th Feb 2025 at 11:18 AM
Quote: Originally posted by DownInSimsLand
I can find animations, even if they are displayed weirdly like in their screenshot, and see them in blender after, but I only get is a skeleton (with the animation), but no mesh or bone structure. Is there something that could be the cause of that ?
Thanks in advance and have a nice day !


I'm guessing it's because animations are stored separately from the clothes/skeleton.

Not sure if it breaks anything, but try also exporting/importing a body, face and head (hair) that's the same age as the animation you're testing (the face might be easiest to extract as an OBJ and give it the bone assignments of the head, plus fix the two neck gaps).

(amhairbald, amface, ambodynaked - female is af, child is cu, toddler is pu)
Test Subject
#22 Old 5th Feb 2025 at 11:01 PM
Just stumbled upon this post the other day and was blown away, this opens up so many possibilities for filming machinima within blender! BTW, I managed to export the rig with the animation in the FBX format from unity (2021.3.45f1). The only thing I needed to do was change the type from ASCII to Binary.



The default mesh gets messed up this way, though:



But the rig and the animation are ok, which means you can apply it to any other mesh you already have there. I tested this on a tf model I ripped using NinjaRipper.



I am very much a noob in programming, unity, and blender, but this makes me wanna learn everything there is to be able to contribute, hehe

Thank you so much for all your work with opents2!
Screenshots
Lab Assistant
#23 Old 6th Feb 2025 at 8:19 PM Last edited by AlexCroft : 6th Feb 2025 at 9:18 PM.
I discussed this issue with Ammar in the post regarding issues on GitHub.

In summary, to obtain the model, it is not advisable to export in FBX but rather in GLB.
There is a point in the discussion (https://github.com/LazyDuchess/OpenTS2/issues/59) where Ammar explains how to export the model with animation using GLB, with IK chains baked.

It would be fantastic if someone experienced in scripting could create a script for Blender capable of directly reading the animation files and importing them. After all, the AnimResourceConstBlock.cs code in OpenSims2 explains the file structure:

https://github.com/LazyDuchess/Open...ceConstBlock.cs
Screenshots

AlexCroft - Custom Content Creator
STAY TUNED!
YouTube
Patreon
Test Subject
#24 Old 7th Feb 2025 at 12:36 PM
Quote: Originally posted by AlexCroft
I discussed this issue with Ammar in the post regarding issues on GitHub.
https://github.com/LazyDuchess/Open...ceConstBlock.cs


Hey AlexCroft, thanks! Yeah, I've seen that thread, but I'll have to experiment with exporting and rigging a lot more to fully understand all the terms there, ahah

And yeah, the import script directly in Blender would be so cool.
Test Subject
#25 Old 7th Feb 2025 at 12:49 PM
Quote: Originally posted by AlexCroft
In summary, to obtain the model, it is not advisable to export in FBX but rather in GLB.

Have I got it right, that if you don't need the model, just the rig with the animation, there isn't much of a difference? It's just that when I tried exporting it using the .glb format, I experienced some issues when applying that to a mesh I already had in Blender. That's probably 'cause of the lack of experience in rigging on my part, but it still it would be great to know if there are benefits to exporting in .glb other than keeping the original AM mesh.
Page 1 of 2
Back to top