Torchmodders
Modding => 3D Modelling & Animation => Topic started by: Vkoslak on September 07, 2015, 08:25:16 am
-
For you blender users, the newer version have an updated FBX file format importer. I've been playing around with it and having some success.
(http://www.vkoslak.net/torchlight/blender/blender_vanq_run.gif)
The playback speed being a little fast is from my gif creation, not from blender.
I loaded the original max tutorial files into 3ds max, then loaded the bip animation, then export as fbx.
Then I import the fbx into blender (remembering to scale it to.1)
It's even easier for the TL2 files as the animations are there own separate max files. They seem to import better as well.
(http://www.vkoslak.net/torchlight/blender/blender_fbx_tl2.gif)
I have not had any luck using to create an animation library.
One of my big pain points is not being able to see the animation until I load it into the game. So if clipping occurs, I won't know until I export, load the game, watch the various animations, then go tweak the weights, and repeat. Very tedious.
Hopefully I can figure out why applying an animation action is getting me weird results when all the bones should be the same.
If I get it to work, I will have to stop using Dusho's scripts and just use the regular Ogre export library. But then I would be able to customize the animations in Blender.
Naturally I will share any blend files once I figure this thing out.
-
For you blender users, the newer version have an updated FBX file format importer. I've been playing around with it and having some success.
Oh. ??? This is great news. 8)
I should try it!
-
Thanks for sharing this Vkoslak! It's exciting to see the progress you, Kva and Anarch keep making in the area of animations. Animations seem very powerful to me - even if it's the only thing you change, it's like playing a completely new game!
-
You know, the bug with the animation exported from blender seems to be related with the Axis, since they are in different position with the Axis in 3ds max, so when you export the animation, the skeleton is all rotated and useless...
Dusho's exporter/importer seems to translate the rotation on import, but doesn't do the same when exporting the skeleton... And I know nothing of scripting to try to fix it.
-
You can export animations, but you can't use Dusho's script.
There is a plugin called "Ogre 3D (.scene and .mesh)"
https://code.google.com/p/blender2ogre/
It has quite a few options:
(http://www.vkoslak.net/torchlight/blender/blender_ogre_exporter.gif)
I was able to change the animation on the "Good Zealot" in TL1, export it and get it to show up in game correctly.
I think I had to do a "ctrl-a" and apply rotation, scale, location on my armature, and then add a new animation. The problem I run into is that I can't just do one animation and add it. I would have to redo all the animations. But once I have them in blender and looking properly, I can export them to the game.
-
I think I have figured it out.
It is a pain in the ass, but it is possible.
(http://www.vkoslak.net/torchlight/blender/fbx_anim_lib.gif)
You can't use the imported animation directly. I had to do some cleanup on the a-pose fbx first. No root bone, location of the bip object was set in the animation and it wasn't 0,0,0. So that was a pain. Also most of the meshes imported 90 degrees off, and some didn't have the correct object origin point.
After the cleanup, I imported the fbx with the run animation. I deleted all the meshes attached to it. Then I had to duplicate the bip (armature) from my a-pose set. I used the mocap tools to copy the rotations from the imported run anim to my bip copy. Then I had to go to pose mode on my bip copy, and tell it to copy the location of the pelvis as well. Then I set the keyframes by "Visual LocRot" for each frame. I also had to adjust the z location of the pelvis bone using the graph editor. Name it in the action editor. And then I was finally able to go to my original bones, and select the new "run" animation.
Now I need a break!
I attached my test blend compressed with 7zip in case anyone wants to take a peek.
-
Really cool investigation, Vkoslak!
I'm glad that there is a way to do what is needed.
But I do not understand what it all means, it sounds complicated for me. :'(
-
I spent last night exporting all the bip animations from the Torch-Ed Tutorials download for the Vanquisher.
I made a couple of observations.
1: The fidget animation is missing. Which stinks, because this one tends to give me issues with clipping.
2: Many animations are just copies of other ones. So there are less animations than the number of files would lead you to believe.
3: You can load bip animations for other characters and they will play back on the Vanq. Then you can export those animations with the Vanq. I did this with a couple of Alch and Dest animations.
4: Nearly all of the Vanq's animations have the same starting position.
5: Maybe it's just me, maybe it's because I'm not used to seeing the Vanq animated from a front view, maybe it's the way 3ds Max displays the model, but is the Vanq more "well endowed" in the 3ds max file than in the game?
Now that I have all the animations in FBX, I can start the process of adding them to my blend file tonight.
Although I should probably be finishing my last two armor sets for my witch class.
-
Now that I have all the animations in FBX, I can start the process of adding them to my blend file tonight.
It is possible that someday you will make a small video tutorial about this? :)
-
Now that I have all the animations in FBX, I can start the process of adding them to my blend file tonight.
It is possible that someday you will make a small video tutorial about this? :)
I second that!
-
I suppose I can.
I'll need to find a way to make my microphone sound better. Like add reverb or something ;D
It might take me a few days to get to it.
-
I've been quiet as I have nothing to contribute to this topic ??? but i's got me really excited, so I wanted to ask some questions to validate what I think I'm hearing (sorry in advance if they're dumb questions)...
1. Sounds like your currently trying to get the TL1 animations to work with the TL2 models?
2. What are the "from/to" limitations? Can you "transfer" animations from any rigged model from any IP?
-
At this point I'm still playing with it to see what is possible.
I noticed the fishing animations are missing from the BIP files as well.
The first thing I was trying to do, was just to get TL1 animations working with TL1 Models in blender.
Then to use those animations to make a library of animations for the TL1 models. I know not many people are still trying to do things with TL1, but I have a witch mod to finish and having a library of in game animations would help me to test out my meshes and weight paints before I export them, instead of doing a lot of trial and error.
Then I want to try doing the same thing with TL meshes and animations. I will eventually create a new player mesh for TL2.
I haven't tried using a TL1 animation on a TL2 skeleton or a TL2 animation on a TL1 skeleton, yet. It is on my to-do list.
Ultimately, I would like to be able to have a class that isn't the standard size, without having to start from scratch with making animations. Or at least to be able to add a cape.
As far as importing animations from other IP, it really depends on how the skeleton is setup. I have had zero luck with BVH files.
If I got a whole new set of animations from somewhere like Mixamo, I could replace all the animations for a character as long as I setup my base armature to match the setup I get from Mixamo.
The animations I have converted from bip to fbx to blender work with the armature/mesh that I exported from the original. My witch class that I created initially from a Vanquisher imported via Dusho's script doesn't work with the newly exported animations. So it still doesn't solve my previewing animations issue. But it should let me get a better setup for when I go to do TL2 modding.
One thing I tried a while back with limited success was making an IK armature that uses the animation armature as a target. This could be used to get things close, and then do some cleanup after the fact.
I guess the short version is I want to see all kinds of new classes of different shapes and sizes, with crazy armors, and I feel the animation part is one of the biggest roadblocks to that happening. Unless you want to fork out the mad cash for 3ds.
-
I have an update ;D
I started with the file I created the other day with the FBX A pose and "oops" animation. Then I imported the fbx file of the Vanquisher run from the TL1 bip file.
Since Runic created both rigs, they are nearly identical. I just re-targeted the skirt to the "tassets". The only thing that gave me issues, was the head was rotated all kinds of crazy. I spent some time with the graph editor fixing the f curves for it and got it to look decent.
So yes, it is possible to put TL1 animations on TL2 models in Blender.
(http://vkoslak.net/torchlight/blender/tl2_with_vanq_run.gif)
A pose, to "oops", to vanq run.
Edit: I saw something funny in the animation. When I zoomed in, I noticed the pelvis bone was 90 degrees off and was making funny creases. I was able to correct this in pose mode by using the left view and for each frame rotating the pelvis -90 degrees, and then rotating the spine +90 degrees. Since the skirt bones followed the pelvis, they also needed rotated so I did them as well. The animation looks pretty good now even when zoomed in.
-
I have an update ;D
Excellent work Vkoslak. :)
But I feel that it is very difficult for me now.
-
After messing with these all week, I actually did figure out how to get the animations to work with meshes and rigs imported with Dusho's script.
It took a lot of hand rotating bones along their y normal axis. Like 4 hours worth.
But now I can fix all my clipping issues with my witch class and the run animation!
(http://vkoslak.net/torchlight/blender/witch_run_anim_clipping.jpg)
-
Great work Vkoslak! But it does sound like a LOT of work. Is this the sort of thing that could be scripted at some point in the future?
-
I think so. I'm starting to look at a couple of things.
http://www.blender.org/api/blender_python_api_2_59_0/info_quickstart.html
https://www.youtube.com/watch?v=ALfl4tebiQM
All the rotations seemed like something programmable. Usually 90 degrees around y, but the feet and pelvis had some extra rotations on x. Either 30 or 20. I can't remember.
I'm also looking into a way to convert the ogre animation files to something blender can use. The funny thing is, my google searching lead me back to here to this post: http://torchmodders.com/forums/tips-tools/dusho's-torchlight-mesh-viewer/
I've downloaded the source code, and its in C#. I program in C# for a living so that's a good start. My idea is to basically add export animation functionality to put it in bvh or some other format that blender can understand.
Otherwise, I could take Dusho's plugin for blender and copy bits of it to load skeleton files, and then add on to it to import the key frames with translations as well.
Having that run animation in blender helped a lot. I spent quite a bit of time yesterday just cleaning up meshes I had already done. They were worse than I had thought. Especially my heavy plate set. I think I spent more time on it than the rest of the armors combined, and its my least favorite. It just looks boring to me.
(http://vkoslak.net/torchlight/blender/hvy_plate_run.jpg)
Anyhow, I'll keep at it with trying to get all the animations working. I'll figure it out eventually. I just need to concentrate on it a bit.
-
Is that image your redo of the heavy plate set? That isnt boring at all, its extremely cool!
Im afraid we can only compensate your hard work (and time away from family) with our gratitude and being awe-stricken :D
can i ask u what u think about full capes? Would they be tough to implement in either TL? I know lots of ppl would be interested in that.
-
Capes shouldn't be bad at all if we can add the bones. I have an idea on how to animate it using some of blenders physics to make targets for the bones.
I actually managed to add one for an early mesh when I was just modding the vanquisher. I basically took the skirt mesh, and moved it up to the back, and then rotated it so it was sticking out at nearly parallel to the ground. I left it weighted to the skirt bones. It kinda worked.
So far I have worked out with python and the blender api how to loop over each bone in pose mode, rotate it 90 degrees on y, and then go to the next frame. I'm now working on actually having it insert the keyframe for visual rotation. Also, not all the bones should be rotated. Like root and Bip01. The blender api docs are as bad as MSDN. They are technically correct, but not all that useful.
-
The blender api docs are as bad as MSDN. They are technically correct, but not all that useful.
Haha! They probably didn't get any help from actual users (as in just users, not the app devs).
-
Ok, progress!
I have a python script that will copy the animations from the imported fbx file and apply it to the rigs created by Dusho's script fixing the rotations along the way.
I attached what I've done so far. It needs some cleanup. The developer in me says it's not good enough :) I just wanted to share in case someone else wanted to play with it. I tried to comment the different functions I use. I've only tested it with the idle animation at this point. The feet are doing some weird wiggle thing ??? in the idle animation, but they are doing that just with copy rotations turned on before I apply any rotation fixes. There is a decent amount of learning curve to this stuff. All the hidden structs that are just plain wrong in the documentation. Once I get the script to a better place, I'll probably put it on github. All the cool kids are doing it...
-
Thanks mucho for this Vkoslak! Any chance of getting a readme to go along with this, for the less script-savvy? :P
-
Heya, Vkoslak.
Can you explain how to export to the FBX-format from 3ds max? Is there any nuances?
-
It's been a while since I've looked at it. I'm finishing up some work, then I'll see what I can put together.
-
Ok, here you go.
(http://vkoslak.net/torchlight/MaxToFBX/PhaseOne_OpenFile.gif)
Open the file you want to convert.
(http://vkoslak.net/torchlight/MaxToFBX/PhaseTwo_Verify.gif)
Once it loads, it should look like the screenshot. Verify that its the animation/mesh you want.
I get a bunch of errors about missing textures. I ignore them.
(http://vkoslak.net/torchlight/MaxToFBX/PhaseThree_ExportMenu.gif)
Find the export menu.
(http://vkoslak.net/torchlight/MaxToFBX/PhaseFour_Fbx.gif)
Export as an FBX.
(http://vkoslak.net/torchlight/MaxToFBX/PhaseFive_AnimationCheckbox.gif)
Make sure the animation checkbox is selected. I think I left everything else alone.
Click OK.
It processes for a little bit, and then I get a warning about "By Object not supported". I ignore this too.
Now I have an fbx.
The importing is a little more "fun".
(http://vkoslak.net/torchlight/MaxToFBX/Blender_Fbx_ImportSettings.gif)
These are the settings I use for importing. I check the "Ignore Leaf Bones" and "Automatic Bone Orientation".
(http://vkoslak.net/torchlight/MaxToFBX/Blender_PhaseOne.gif)
There! Perfect!
Ok, it looks like a bad transporter accident. We need Mr. Scott to fix it.
(http://vkoslak.net/torchlight/MaxToFBX/Blender_PhaseTwo.gif)
Go to a side view and select one of the meshes. I picked "m_HumM_Nude" since it's the base mesh.
(http://vkoslak.net/torchlight/MaxToFBX/Blender_PhaseThree.gif)
Now isolate it by pressing the "/" key. Then be sure that you are in ortho mode not perspective.
Rotate the mesh -90 degrees.
(http://vkoslak.net/torchlight/MaxToFBX/Blender_PhaseFour.gif)
Bam!
Now do a "CTRL-A" and select "Rotation".
I set my "end frame" to "35" and hit play to watch the animation.
Now press "/" to unhide all the other meshes. Pick another one to rotate and repeat.
Hopefully that helps.
I should add, that If you want to build out an animation library, start with the base A-pose or T-Pose.
Then when you import the fbx files for the animations, delete the meshes attached to them. You only need one set of meshes right?
Then hide the bones from the animations. You should then be able to select your base bones, bring up the "dope sheet", switch it to "action editor" and select the animations from the other bones. That might be worth a video tutorial though.
-
Thanks Vkoslak. :) Your guide is very detailed.
I want to try import some monster with animation.(Import .mesh in 3ds max - Export in .fbx - Import in Blender)
-
Hey @Vkoslak may i have your permission to transcribe your tut to the Torchmodders wiki?
-
Sure.
-
And it's done (http://torchmodders.com/wiki/doku.php?id=exporting_from_3dsmax_to_.fbx_format) :P
May I ask; the reason for the interest in .FBX format is because it's easier to import/export .FBX to/from Blender?
-
And it's done (http://torchmodders.com/wiki/doku.php?id=exporting_from_3dsmax_to_.fbx_format) :P
May I ask; the reason for the interest in .FBX format is because it's easier to import/export .FBX to/from Blender?
Pretty much. I had been poking around with different tools to try and import animations. I have an account on Mixamo, and their recommended blender import only worked with version 2.49, and even then I wasn't happy with the results. I was basically looking for a way to get new animations in Torchlight, without having to do them all myself by hand. Ain't nobody got time for that! Once I saw that the FBX importer had been updated in Blender 2.7x (I forget which one) I started playing around with it. Now I can import animations in fbx format and have them look correct. The Mixamo stuff just seems to work, the TL fbx needs some of the meshes rotated -90 after import.
I also used FBX to export to sketchfab. :)
[sketchfab]cc1a38fff31d44e0abf0c650c4297ff5[/sketchfab]
-
I also used FBX to export to sketchfab. :)
It looks fine. I tried once, but my model looks upside down. :)
-
Pretty much...
...Now I can import animations in fbx format and have them look correct.
Does this mean you could apply a totally new animation (say, from a model in some other game) onto a TL2 mesh, and re-export it to be usable in TL2? That would be so awesome!
-
Theoretically, yes. However, the more different the bones the more tweaking will have to be done. I've poked around with stuff like that a bit. Even when the bones look like they match, there always seem to be some rotation or roll that is different. That's why there are tools like bvh hacker. Lots of people have issues with getting an animation from one thing to work on another.