Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

3ds Max to Unity ?

Discussion in 'External Tools' started by IPete, Aug 4, 2008.

  1. IPete

    IPete

    Joined:
    May 15, 2008
    Posts:
    414
    Hi all,

    There are some people who seem to be having issues getting animated models working correctly inside Unity. We've been asked to move the topic to external tools (from Wishlist).

    Anyone having issues with anmated models and exporting wth full animation please let us know here.

    It seems in some cases the bones are animating but the mesh does not. Is this a bone root issue? Do you have any tips or thoughts as to what may be going wrong?

    Best regards,

    IPete2.
     
  2. drag0nsphere

    drag0nsphere

    Joined:
    Nov 7, 2007
    Posts:
    285
  3. OXYGEN

    OXYGEN

    Guest

    Joined:
    Mar 16, 2008
    Posts:
    1,101
    Might not be much help bud but my advice is not to use 3dsmax 9

    Use a earlier version of max seems to be a lot less buggy and stable while exporting! tried exporting biped animation with 2009 major issues also problems picking up textures can of worms! Not happy ,however while using 3ds max 2008 everything seems to run sweetly Biped, imports correctly textures etcetera etcetera thats my experience anyway.. ...Im sure the guys at Unity will get a handle on it at some point
     
  4. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    @solvent: I deleted your duplicate post. And on the topic, are you sure it's a Unity issue? Restated, did the FBX exporter for Max 9 change at all compared to v8? If you have a file, or set of files, that reproduces the issues you described then please submit those as a bug report (include a v8 exported FBX and a v9 exported FBX if possible). From there we can try to ascertain if the issue is on our end or if the files that Max is writing out have changed or are different. From there we might find the solution...

    So please use Unity's bug reporting ability to get that issue into the dev team's hands for investigation.
     
  5. br0kenp0ly

    br0kenp0ly

    Joined:
    Jun 3, 2008
    Posts:
    481
    Hmm.. I haven`t had any problems converting models (with or without anims)from 3ds max to Unity. I tend to try to animate with as little "extra" stuff as possible though, mostly keeping everything on the base layer and with Forward Kinematics.
    Collapsing the animation shouldn`t be a problem though. Can`t you just select the biped, go to the motion panel, select trajectories chose "collapse transform" ?


    Also.. the fbx200611 format is the preferred one.. at least in this office :)
     
  6. OXYGEN

    OXYGEN

    Guest

    Joined:
    Mar 16, 2008
    Posts:
    1,101
    Broken poly
    Thats good to know
    will give it another bash when i start a new project as i do want to migrate over two 2009 for my future projects
     
  7. holmeren

    holmeren

    Joined:
    Dec 12, 2006
    Posts:
    300
    using max 2009 and the fbx from autodesk page...
    All smooth here (except the rotating xyz issue)
    But that is fixable.. in your own work flow.
    hehehe

    you just go with what you can get you have.


    Cheers
     
  8. dhogan

    dhogan

    Joined:
    Jun 2, 2008
    Posts:
    55
    Hrmmm.

    I've spent most of this afternoon trying to export placeholder animations into Unity and haven't had any luck. I strongly suspect it's the character rig, as I'm using an IK setup on the lower body that has shapes driving the IK solvers.

    Problem one is the shapes (splines) getting exported into Unity as meshes. I don't want them at all, but they do show the proper animated motion so that's handy at least.

    Problem two is in the lower body mesh not coming in animated properly. I've tried various combinations of collapsing the rig, but what happens is the bones are getting keyframes of the default orientation. I.e. if I set keys on every second frame with the collapse, every key has the same value (from the starting frame of the animation).

    If I'm understanding what's happening correctly, the problem lies in parts of the rig that indirectly drive the bones. The IK, the shapes linked to bones to make selecting and controlling easier, etc.

    My mindset is that there has to be a way around this, whether it's in Unity or the rig, that still allows the artist to make use of the tools in Max and still get the asset into Unity with a minimum of headache.

    If anyone would like to collaborate, I'm happy to share my rig or look at another so we can find a solution and get on with making the art! :D
     
  9. Lucas Meijer_old

    Lucas Meijer_old

    Joined:
    Apr 5, 2008
    Posts:
    436
    There has to be a way. Unfortunattely often the road to finding it can be very painful, as the max->fbx->unity pipeline is very unforgiving. It tooks us a long time to find the exact way to export our rigs so that it would export properly into fbx.

    The biggest problem isn't technically unity, but fbx.

    Then again, fbx is the only way to get stuff into unity, so in a way I'd say this is one of unity's greatest weaknesses.

    For starters, try exporting to a fbx2006 profile. The fbx2009 stuff for me reliably crashes every time. (even max->fbx->max crashes).

    If you have MotionBuilder, you could try exporting from motionbuilder. If you're already doing that, you could try exporting from max :).

    The problem indeed is very likely in the character rig. You probably already did this, but just delete everything else from the scene for the meantime, just to rule anything else out.

    We settled on a workflow where we export from motionbuilder (where our animations get made anyway). I think when we exported from max, we had to do the "collapse trajectories" collapse thing. You should probably also try to completely collapse any IK you have. once your rig is all FK, those driving shapes probably don't matter anymore. to the best of my knowledge there is no way to get an IK'd rig into unity, you always need to collapse (or have a part of the pipeline collapse it for you).

    When you find yourself in a position that you get something halfway reasonable into unity, what helped me greatly was to realize that any problem that comes after that is much easier solved in unity than in max.

    for instance, if your silly shapes get exported, it's much easier to write a unity postprocessor that deletes them, than it is to try to wrangle the max fbx exporter into not exporting them.

    AssetPostProcessor is your friend. You'd be surprised how much % of my code is actually in assetpostprocessors. You can do stuff like removing everything in an imported fbx, except the animationclip. rename the internal animationclip to the name of the fbx file, automatically assign materials to your meshes, automatically generate materials the way you want for your meshes.

    With 2.1 there are even nice hooks to implement your own version control system. (OnGenerateAssetGUID, OnGeneratePrefabGUID). quite a bit of work, but with the endresult of using svn for unity projects. (admiddetly in a bit of a painful way, it's easy to see why they decided to write a custom asset server, but I prefer painful svn over the assetserver anyway, svn just has too much going for it.)

    Good luck,

    Bye, Lucas
     
  10. dhogan

    dhogan

    Joined:
    Jun 2, 2008
    Posts:
    55
    Lucas, thanks very much for your reply, there are some really useful points in there. Being very new to Unity, it's nice to have some direction on where to start reading. I finished the tutorials with the confidence that I'll be able to do what I want in Unity and now it's just the matter of getting my workflow under control.

    Before I stopped for the night, I did experiment with a few more things that have promise for establishing some guidelines for an art pipeline. Some make sense, some don't.

    The last time I did animation for a game, it was in Maya and was exported with an in-house plugin. Since this is a personal project and I own Max, I just sat down and went through the rigging tutorials.

    Ok, issue one, the shapes. There are two things here, the first is the shapes exporting. The easiest way around that appears to be to use the Helper > Dummy objects instead. They export, but they aren't converted to meshes so you don't see them in Unity. It seems the tutorial used shapes simply because they're easy to make look unique. I do worry about the extra info being carried into the scene / game but I'm hoping it's trivial.

    The next issue with shapes is incredibly simple, I don't know why I overlooked it for so long. Again, the way the tutorial did it makes sense in its context, but for my purposes creates a problem.

    The way the shapes were set up to become controls actually involved linking them into the hierarchy. So, when the time came to collapse the keys into the bones for export, Max didn't see any change in transforms for the bones driving the skinned mesh - because it was seen as inherited motion from the hierarchy. When the FBX exporter gets it, it sees some animated shapes that it converts to separate animated objects, and a set of bones and skinned mesh with little or no animation.

    If that's a correct analysis of what's going on, it actually makes me feel better about the FBX exporter. I haven't had as difficult a time with exporting environments, other than some shader issues so I'm increasingly optimistic.

    I don't feel quite as confident in my thoughts from the next experiment I did, which was working with the other options for IK such as the Limb Solver. The last export I did was from my original 'broken' rig, and it actually came in correctly instead of proving the solution I thought I had found.

    I have a large-ish block of free time today, so I'm going to press on and try to come to a good solution.

    Thanks,
    Don
     
  11. Lucas Meijer_old

    Lucas Meijer_old

    Joined:
    Apr 5, 2008
    Posts:
    436
    cool. Again, preventing those shapes from exporting is not important at all. It's way easier to delete them in an AssetPostProcessor.

    Moving most of your "export logic" into unity's importer also gives the added benefit of not having to re-export everything to fbx if you at some point decide to change something about the import/export story.

    If you're looking at getting a nice art pipeline setup, defenitely look into OnAssignMaterial() as well, it's the beezkneez, as it allows you to completely mold the asset pipeline to how it works best for your game. The built in material assigning system rarely exactly matches what would be ideal for your specific situation.

    Bye, Lucas
     
  12. dhogan

    dhogan

    Joined:
    Jun 2, 2008
    Posts:
    55
    I got sidetracked today and spent entirely too much time weighting the character model before getting back to the IK exporting issues.

    I have no idea where it was going wrong last night, and all I can really offer is that perhaps it's a matter of the learning curve for a new process. I really don't like that as an answer since it isn't very helpful to other people. So, I'll try to offer a few things I did discover.

    The alternative I mentioned to shapes was Dummy objects. They work largely the same, but do have one drawback - they don't react well at all to being scaled, so you're stuck with a cube of whatever size you created originally. They do not come into Unity as meshes, but the nodes are there just as the shapes were.

    As a tangent here; Lucas, I was unable to find AssetPostProcessor in the help so I haven't looked into it yet. I do like the sound of it, I just wonder if it will be something I can manage. Dummy objects will do for now, since assets are largely placeholder.

    When using Trajectory > Collapse, I tried collapsing the IK controllers then the bones, and also just the bones. Both seemed to work the same, and in the end I decided that it made more sense to go with the minimal approach and just collapse the bones. I also think that by doing this, you have a better chance of preserving your animation work flow. You could easily select the collapsed bones and delete their keyframes, and since the IK controllers haven't been changed the original animation should be there as well. I have not tried that to verify it at this point.

    Animators may notice that there is also a collapse controller option in the Curve Editor and be tempted to use it as I was. It is not at all the same options, though it may seem to offer more control it had unusable results for me. If you should manage to make it work for you one important thing to note is how it works with the Undo queue. The Motion Panel collapse is a single undo entry, while the Curve Editor collapse is an undo entry for every item selected. Depending on your undo settings, you may be unable to undo to before the collapse.

    That's all I managed to sort out today, as I get further along and find some hard and fast rules I'l try to remember to share them here. (And the Wiki when I'm confident it's 'good' information.)
     
  13. Lucas Meijer_old

    Lucas Meijer_old

    Joined:
    Apr 5, 2008
    Posts:
    436
    Here is some sample code. It's my AnimationFBXCleaner.
    what it does is that for all .fbx files that have "/animations/" in their path, it kills all imported things, except the animation clip. So you end up with a prefab, containing only an AnimationClip, very nice and clean.

    The thing to realize when writing AssetPostprocessor code is that when you operate on GameObjects and components, you are not operating on things in the scene, you are operating on things stored in the assets folder. Unity imports an fbx, and from that generates a tree of game objects, and other assets. When it is done, it gives control to you, and you can do with it what you want. In this example I chose to destroy everything except the animationclip.

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using UnityEditor;
    4. using System.Collections;
    5. using System.Collections.Generic;
    6.  
    7. public class AnimationFBXCleaner : AssetPostprocessor
    8. {
    9.     void OnPostprocessModel(GameObject root)
    10.     {
    11.         // filter out only animations.
    12.         string lowerCaseAssetPath = assetPath.ToLower();
    13.         if (lowerCaseAssetPath.IndexOf("/animations/") == -1)
    14.             return;
    15.  
    16.         List<GameObject> l = new List<GameObject>();
    17.         foreach (Transform t in root.transform)
    18.             l.Add(t.gameObject);
    19.  
    20.         foreach (GameObject g in l)
    21.             Nuke(g);
    22.     }
    23.  
    24.  
    25.     void Nuke(GameObject g)
    26.     {
    27.         Object[] smr = g.GetComponentsInChildren(typeof(SkinnedMeshRenderer), false);
    28.         Object[] mfs = g.GetComponentsInChildren(typeof(MeshFilter), false);
    29.  
    30.         foreach (SkinnedMeshRenderer o in smr)
    31.         {
    32.             Object.DestroyImmediate(o.sharedMesh, true);
    33.         }
    34.         foreach (MeshFilter mf in mfs)
    35.         {
    36.             Object.DestroyImmediate(mf.sharedMesh, true);
    37.         }
    38.         foreach (Transform t in g.transform)
    39.         {
    40.             Nuke(t.gameObject);
    41.         }
    42.         Object.DestroyImmediate(g);
    43.     }
    44. }
    45.  
     
  14. drag0nsphere

    drag0nsphere

    Joined:
    Nov 7, 2007
    Posts:
    285
    I've never used max before..... im a maya guy :) But i have some models i need exported.

    Could someone tell me how to select my bones and then collapse them.
    Thanks
     
  15. dhogan

    dhogan

    Joined:
    Jun 2, 2008
    Posts:
    55
    Sure Jake, it's pretty straightforward.

    Once you have your model open, the easiest thing to do is press 'H' to bring up the select by name dialog. On the right side there's a set of check boxes to filter what's displayed. Set it to bones only, and then at the bottom, press the Select All button and the dialog box will close.

    Now that the entire skeleton is selected, look at the Command Panel on the right side of the interface, and from the tabs at the top, pick the one with a wheel - that's the Motion Panel. At the top of that tab you'll see two large buttons; select the one on the right labeled 'Trajectories' and the contents of the tab will change. The section at the bottom is where you 'collapse' your bones to have keys instead of being IK driven.

    One thing to note and experiment with is the top section of this tab, the Sample Range. First, you do want to set the proper start and end times, but you also want to pay attention to the samples. If you think of the relationship between the total frames and samples as a ratio, you'll find that you can control the amount of keys generated very easily. I like to see this visually, so I go ahead and open the Curve Editor. (From the Graph Editors menu on the top bar.) Since you have the bones selected, all the curves should be visible, and as you collapse you'll see the keys and whether or not they do anything undesired to your animation. Remember to save before you do all this, but the collapse command should be undo-able in Max.

    Let me know if you need any more help or any of this clarified.
     
  16. drag0nsphere

    drag0nsphere

    Joined:
    Nov 7, 2007
    Posts:
    285
    Thanks for getting back to me so fast!

    I think I did everything right... but when I try to click collapse, the button is grayed out. Is it locked or something?

    Thanks,
    Jake
     
  17. dhogan

    dhogan

    Joined:
    Jun 2, 2008
    Posts:
    55
    No worries, I've been beating my head against exporting normal maps correctly so it's nice to have a break to think of something else. :D

    Two things come to mind as possible things to try. Try selecting just a limb hierarchy that you know is IK driven and see if the option is available. Another thing to try is selecting the IK jack iself (look sthe same as Maya, just probably a different color) and try to collapse it, then if that works, try collapsing the bones.

    I'll be up for a while yet, so feel free to keep posting and we'll try to work it out.
     
  18. Sinnlos

    Sinnlos

    Joined:
    Mar 23, 2009
    Posts:
    29
    hi there
    after a long time of trial and error with exporting an animated object from max i decided to post here my question.
    i've searched the forum and read some threads and i just can't figure out what im missing.

    here is what i have done so far.

    -in max2009 i had a editable poly with a physique-modifier on.

    -so i changed the poly into a mesh and i converted the physique-modifier in a skin-modifier thanks to this thread here:
    http://forum.unity3d.com/viewtopic.php?t=40707

    -i have done the collapse-thingy in the trajectories
    (its called "Ausblenden" in the german version, which is quite confusing, 'cause its not the correct translation)

    -in this thread it is mentioned that bone weights per vertex should be 2... i have done that.
    http://forum.unity3d.com/viewtopic.php?t=51468&highlight=max+fbx+export

    -i exported the fbx (with the latest fbx-driver 2011)
    i tried with 2006 and 2009 aswell

    -in the export window i tried with and without: bake animation, convert deforming dummies to bones, deformation for skins...etc... nothing seems to work

    -when i take the fbx into unity and try to preview the animation: the model does not animate

    -in the hierarchy all the bones are there and i can rotate them... so the mesh and the bones are ok... but the animation is missing.

    -i did not try the AssetPostprocessor, since im a pure 3d-guy whith absolute no knowledge of scripting :?

    ahem... yeah... back to my question:
    can anybody help me plaese? :roll:
    im thankful for any hint.

    Cheers Sinnlos
     
  19. dhogan

    dhogan

    Joined:
    Jun 2, 2008
    Posts:
    55
    I'm currently at work, so I can't look at the Unity or Max settings, but it sounds a lot like in one or the other program the frame range of the animations aren't getting set.

    You might try looking at the asset window and checking if your mesh is importing as a single or multiple entries. It should have an entry for the base model and each animation. I believe that you can check the import properties and adjust how it reads the source files, so perhaps that will at least tell you if the problem is in exporting or importing.
     
  20. Sinnlos

    Sinnlos

    Joined:
    Mar 23, 2009
    Posts:
    29
    hi dhogan thanks for your reply.

    what i have discovered now is, when i place the model into the scene and press play the animations are there!!!
    So i am pretty happy that the animations came in...
    on the other hand i am stressed because i always looked at the preview window in the inspector, which doesnt show the animation.
    This leads me to this question:
    where can i setup the preview window, that it will show the animation?

    in reply to your post:
    you have mentioned the frame range... the model is animated from frame 0-165 and i also set the bake animation in the fbx to 0-165 (1 step).
    am i doing something wrong here?

    i dont know if i understand the second part.
    in the asset folder there is only the fbx. no other files. i couldn't find an asset window in unity.
    And where can i check the import settings?
    you say it should have a entry for every animation...
    my model does all the different animations in one go.
    i cant find any entry.

    is there a way where i can define the different animation (walk, shoot, die) already in max?
    like frame0-25 idle, frame25-50walk, and so on?

    thanks alot for your help
    cheers sinnlos
     
  21. dhogan

    dhogan

    Joined:
    Jun 2, 2008
    Posts:
    55
    It seems I'm a bit out of touch, I've been more focused on scripting that content since I originally posted to this topic. So, I looked at my project again today, and can hopefully offer a bit more help.

    I have separate entries for my character because I animated that way - a separate max file for each move in the set.

    If you select your animated model and then look at the Animation section of the Inspector panel, it appears that you can check the button 'Split Animations' and then set the names and frame ranges in the table below.

    My apologies for any confusion I may have caused.
     
  22. Sinnlos

    Sinnlos

    Joined:
    Mar 23, 2009
    Posts:
    29
    hi dhogan, sorry for my late reply, and thanks for you help.

    i've got it working now, splitted the animations since ive got only one max file with all the animations in it and it works very well.
    but the preview window is still not working, which makes it more difficult to set the range of the different animations.

    what i still can not find and i don't know if it is even possible:
    -where could i change preferences of the preview window?
    -where could i set the import options?

    cheers

    sinnlos
     
  23. dhogan

    dhogan

    Joined:
    Jun 2, 2008
    Posts:
    55
    I'm not sure about the preview window options, but I do see what you're talking about - I hadn't noticed that before.

    I've seen threads about the import asset script, it's a post-processing script, I believe. I never looked into it since it's easier for me to adjust my art pipeline than dig into code/script.
     
  24. Sinnlos

    Sinnlos

    Joined:
    Mar 23, 2009
    Posts:
    29
    ok, ill check this import asset script with my scripter-buddy, since i wouldn't get a gasp anyway, he he he.

    thanks for your help and patience.
    cheers to texas from switzerland!
     
  25. sbalbarbin

    sbalbarbin

    Joined:
    Feb 18, 2011
    Posts:
    7
    Hi,

    I'm a newbie regarding Unity. I have a 3DS Max Character Studio biped to create, and to be exported into Unity. I have been reading this thread but I unfortunately have to ask a question I think was discussed...sorry: If I understand well, shape driven animations (morph targets) will not be exported to Unity (through FBX)? If I still have to give the opportunity for facial expressions on the character, can I still rig a facial system to be animated through controllers, in the hope that this will export? In other words, can we "add" extras to the biped rig in the hope that it would export/import in Unity? Another example could be a woman's breast that giggle in Max? (or if those "dynamic" setup won't export, could at least added bones on the breast be animated in Max and exported in Unity?)

    Thanx a lot in advance!

    sb
     
unityunity