Search Unity

How to get the XYZ axis right (3DS MAX/Unity)

Discussion in 'Formats & External Tools' started by holmeren, Apr 23, 2008.

  1. holmeren

    holmeren

    Joined:
    Dec 12, 2006
    Posts:
    300
    Hi
    This is a way to get your geometry axis right when exporting from 3DS Max to Unity using FBX.

    If you make ex. a tube in your FRONT window and export with Y as up axis in the FBX exporter, you get the right axis conversion in Unity= Forward/depth is Z, up is Y, right is x, and still having the rotation in Unity as 0,0,0

    Making your objects in front view give you X 90,Y 0,Z 0
    in rotation.
    So just as long as you in Max have X 90,Y 0,Z 0 in rotation and export with Y as up in FBX, you should be fine.

    Cheers
     
  2. minevr

    minevr

    Joined:
    Mar 4, 2008
    Posts:
    1,018
    Bump!!
     
  3. Irix

    Irix

    Joined:
    Aug 6, 2008
    Posts:
    28
    GOLDEN PHRASE: "So just as long as you in Max have X 90,Y 0,Z 0 in rotation and export with Y us up in FBX, you should be fine. "


    Thanks a lot dude!
     
    Krull likes this.
  4. holmeren

    holmeren

    Joined:
    Dec 12, 2006
    Posts:
    300
    Im happy that it helps :)
     
  5. pesseba

    pesseba

    Joined:
    Aug 14, 2008
    Posts:
    13
    For me, this way works just with a rigged model. I put a dummy and linked it with the root bone (Bip01). So I rotated the dummy X 90,Y 0,Z 0. With normal models, I just changed the pivot orientation in X 90,Y 0,Z 0, (not the 3d model just its pivot). It works fine! Both ways I exported in Y-up.
     
    BrandyStarbrite likes this.
  6. madwilson

    madwilson

    Joined:
    Jun 4, 2008
    Posts:
    106
    what? that didn't work.. aghhhhhhhhhhhhhh
     
  7. holmeren

    holmeren

    Joined:
    Dec 12, 2006
    Posts:
    300
    MAKE IT A STICKY ;)
    OR PUT 90,0,0 EXPORT PIVOT (before animations is done) IN THE DOCs
    :p
     
  8. minevr

    minevr

    Joined:
    Mar 4, 2008
    Posts:
    1,018
    Expect V2.5
    :p
     
  9. km

    km

    Joined:
    Mar 20, 2009
    Posts:
    16
    :) oh yeah,thanks
     
  10. holmeren

    holmeren

    Joined:
    Dec 12, 2006
    Posts:
    300
    Expect V2.5?
     
  11. Dom

    Dom

    Joined:
    Jul 10, 2007
    Posts:
    91
    Can you please improve this - or add a import-asset settings for this?

    I don't have this issue with another middleware (also y-up) and 3d max. And those things quickly sums up - forgetting one thing like this under production pressure will create delays.
    (sorry for repeating myself over several places)
     
  12. holmeren

    holmeren

    Joined:
    Dec 12, 2006
    Posts:
    300
    Hi Dom What do mean ?
     
  13. Dom

    Dom

    Joined:
    Jul 10, 2007
    Posts:
    91
  14. holmeren

    holmeren

    Joined:
    Dec 12, 2006
    Posts:
    300
    But why dont you just rotate your pivot(only) 90 degrees in x before export or save?
     
  15. BananaRaffle

    BananaRaffle

    Joined:
    Feb 24, 2009
    Posts:
    85
    :evil:
    If all the textures were imported upside-down, would you then ask us, "Well why don't you just flip all your images before you save them?"

    If all the sound effects were imported reversed, would you suggest that we reverse all our sounds before saving them?

    We shouldn't have to, it's a stupid way to work, error-prone, a waste of time, and it still wouldn't fix the fact that the GameObject requires an extra -90 rotation. Seriously: if the Unity code is reasonably organized, this should be like a few hours of work on your end to fix it to work right, and without hacks, and it would reduce frustration and headaches on our end. I don't understand what the holdup is. You've got nothing to lose by fixing this (as far as I can see), and you'd gain more fans.

    Edit: I'm sorry, I didn't mean to hijack this thread to a different topic. Also, to be clear, I'm using Blender, not Max.
     
  16. holmeren

    holmeren

    Joined:
    Dec 12, 2006
    Posts:
    300
    Hey
    Im only trying to help ;)
    Im not the one that made left or right hand coordinates.
    I rotate my pivots in Max 90 in x before I export export. I dont see it as a big thing, just a change in the pipeline/work flow.


    -last thing: Im not working for Unity Technologies ;)



    I hope you get you Blender problem solved.
     
  17. BananaRaffle

    BananaRaffle

    Joined:
    Feb 24, 2009
    Posts:
    85
    Oh, sorry. I confused the "Unity Studios" and "Unity Technology" tag :)
     
  18. Samalander

    Samalander

    Joined:
    May 28, 2009
    Posts:
    5
    So, thats great if you have the object in 3dsmax.

    How do you solve the problem if you just have the fbx file, and importing it into unity leaves you with the screwed up animations. Basically, how do you solve the problem once you are *in* unity, instead of before you get there.
     
  19. Joe-Robins

    Joe-Robins

    Unity Technologies

    Joined:
    Apr 21, 2008
    Posts:
    430
    A solution if you don't have access to the original 3d assets is to create an empty game object, and add your model as a child to that object with the orientation correct.

    Not an ideal solution but if you can't access the 3d models to modify them that is your best bet!
     
    creay likes this.
  20. jcarpay

    jcarpay

    Joined:
    Aug 15, 2008
    Posts:
    561
    Nice analogy :)
    Would indeed be nice to have it work as expected.
     
  21. Dom

    Dom

    Joined:
    Jul 10, 2007
    Posts:
    91
    Didn't notice the other posts. I just want to answer to the "why not rotate the object in 3ds max":

    Any additional required step calls for troubles. You need to train the 3d Gfx ppl to consider it and they still might forget. Then we might write a script to detect stuff like that or automate and loose some more time. So the answer to "why" is: the smoother the pipeline the better - that's what the tool is aiming for anyways, not?

    From my experience: any complication might costs additional time. So if it's possible to improve this by hiding that step, that would be cool! :)
    Of course, in meanwhile we rotate manually.
     
  22. holmeren

    holmeren

    Joined:
    Dec 12, 2006
    Posts:
    300
    Dom..I totally agree ;)

    But we also have to think about backwards compatibility.
    Its a tricky area ;)

    I point my gun the direction of those who made a software using Y and another Z axis.... why the hell ;)

    PS Join the FBX Beta Team list if you want to work inside with FBX.

    Cheers
    T
     
  23. jmcclure

    jmcclure

    Joined:
    May 5, 2009
    Posts:
    48
    I'm with Dom here - it should not be hard for devs at Unity to implement an option in the Mesh view to "switch right-handed to left-handed coordinates" and save its users the hassle. There are already plenty of other mesh loading options there.

    I'm in a situation where I have a bunch of Max art assets in right-handed coordinate system (from a game I'm porting to Unity). I contracted these some time ago and no longer have access to the artist or the software to convert them manually. I could go try to figure out blender and hope there is an appropriate importer for my files and then an appropriate exporter to convert the coordinates, or I can manually tweak all my assets in unity. Either way, its a one-at-a-time manual hassle that could (and should!) be easily addressed in Unity at load time.

    Please don't misunderstand - I'm not fishing for a work around here, and I'm not asking for help. I know I can get around this issue if I want to jump through some hoops or write my own conversion tool.

    I'm hoping a Unity dev will read this and recognize the need.

    (edit) After some searching, I added a feedback item requesting this feature (http://feedback.unity3d.com/pages/1...t-handed-to-left-handed-coordinate-conversion). Please vote for it up if it is something you'd like to see.
     
  24. Tysoe

    Tysoe

    Joined:
    Jul 6, 2009
    Posts:
    577
    I'd really like to see support for this too. In part because if your creating a scene made of many seperate objects that are positioned throughout the world. It becomes a real pain if you have to keep doing the coords for every one of them in 3dsmax before export.

    It's one of the few things that I miss coming from Ogre to Unity, the no fuss loading of levels from 3ds max without having to do much messing about except for laying out the gameplay in the unity editor in the final stages.
     
  25. holmeren

    holmeren

    Joined:
    Dec 12, 2006
    Posts:
    300
    Hi
    You could:
    Select all assets in Max
    Pivot only
    Reset all pivots to 90,0,0
    Now export.....

    It would take you 2 secs ;)
     
    Afassolas likes this.
  26. jmcclure

    jmcclure

    Joined:
    May 5, 2009
    Posts:
    48
    I think something closer to 30 seconds is a more realistic average per asset considering that you need to browse to an asset, load it, open the import dialog and then choose where to save it.

    30 seconds * 1000+ assets = a real pain in the rear. But arguing the duration of the inconvenience isn't the point. The point is that the inconvenience exists in the first place.

    We know the work around, we're simple requesting a feature in Unity so we don't have to worry about it.
     
  27. holmeren

    holmeren

    Joined:
    Dec 12, 2006
    Posts:
    300
    Hey

    Eww sorry I thought you had a main scene in Max with all your assets....

    I would love if this got fixed! dont get me wrong ;)
    But, some applications use y other Z... I dont see it to be UTs problem at first hand, but it will sure make it a lot smoother if they came up with a solution AND kept the backward compatibility.

    Have a great weekend ;
     
  28. jmcclure

    jmcclure

    Joined:
    May 5, 2009
    Posts:
    48
    I'm not concerned by which axis is considered up. That is a developer preference across the board that has to be communicated to the artist(s). Questions like "is a world space unit 1 foot or 1 meter?" and "which axis is up?" are going to be different between every team no matter what product they're using. I agree with you that Unity shouldn't tamper with those.

    My concern is with left-handed coordinate systems vs. right-handed systems. This is a very well defined problem. We know which one the engine (Unity) uses and we know which one Max, Maya, etc. use, and they're not the same.

    An option to switch the "handedness" of a mesh in the "mesh view" of Unity would resolve the issue without backward compatibility issues or the need to manually export all the assets.

    You too!
     
  29. Ingenu

    Ingenu

    Joined:
    Sep 11, 2009
    Posts:
    49
    Another rhing to note, if you create your object in Max (say using the L-side view instead of top) oftentimes rotating it in Max makes no change if you export it as an FBX. The FBX exporter for Max 09 gives you the "X-up" or "Y-up" question, but that also does not always have an effect.

    If you're working with a biped skeletal structure, it takes a bit of fiddling (adding the dummy object for example) to get it to export correctly, and I've found it simpler to just export the object into Unity and rotate it after the fact.
     
  30. funshark

    funshark

    Joined:
    Mar 24, 2009
    Posts:
    225
    The problem comes from FBX export plug-in and Unity's way of translate it.

    The thing is, when FBX tries to rotate the mesh according to the UP-axis we choose, it does it, but doesn't freeze the values.
    You can verify it when importing a file in Maya that has been exported in Max ( Y vs Z up ) : the object has a 90 or -90 value in the X rotation axe.

    Unity simply ignore this value ( and the other ones maybe ) in the "mesh" object ( the one with the FBX importer ) and applie it to the "transform" object ( the one you manipulate with a cube icon ).

    You can check this simply with the two different Preview windows.

    Normally, you will have no problem of using such object in Unity since the transform is correct ( is it something that has been corrected in 2.6? I was not aware of this before )

    But when you have to use things like Tree painting tool on terrain for instance, Unity uses the "mesh" object and not the "transform" one.
    And your objects will be rotated down.


    We need to have the possibility to adjust the import preferences concerning this.. but I'm not sure it's the right path.
     
  31. Tysoe

    Tysoe

    Joined:
    Jul 6, 2009
    Posts:
    577
    Looks like the left/right handed importing of models is still messed up when importing to unity 2.6 :(
     
  32. Whatee

    Whatee

    Joined:
    Feb 22, 2010
    Posts:
    10
    I've looked al over the internet and read this over and over and istill do not understand.

    I put my model back into 3Ds
    it has 3 parts to it so i manually changed the pivot on all 3 parts
    i rotated the pivot only (90 degrees on X) for all 3 objects
    When i export i chose y is UP

    when i re-import the file, there is no difference

    What em i doing wrong????
    Does anyone have a video of themselves doing it for a quick reference?
     
  33. Ingenu

    Ingenu

    Joined:
    Sep 11, 2009
    Posts:
    49
    Rotating the pivot only won't do it.

    In 3dsMax, for example, you need to have a character mesh facing along the Z axis and the vertical position of the character along the Y axis. (so a character mesh in Max would be laying on their back, feet pointed at the sky).

    I've attached a piccy here for you to check out...
     

    Attached Files:

  34. Whatee

    Whatee

    Joined:
    Feb 22, 2010
    Posts:
    10
    Thx for the speedy reply!!!

    But do i need to change the pivot on all 3 segments????
    should i center the pivot to the object??

    Just making sure that my previous steps, were correct.

    Thx again
     
  35. Ingenu

    Ingenu

    Joined:
    Sep 11, 2009
    Posts:
    49
    You shouldn't need to mess with the pivots themselves, you just need to rotate your object to aling with the world axis properly.

    I presume, because it's multipart, that its an animated object?
     
  36. Whatee

    Whatee

    Joined:
    Feb 22, 2010
    Posts:
    10
    Wait wait wait.

    I'm even more confused.
    I thought i HAD to adjust the pivot in Max????well now that i'm even more confused.

    Can u give me a point form list of the steps

    1-?
    2-?
    3-?

    Are you saying all i need to do is rotate my model and not the pivot?
     
  37. Whatee

    Whatee

    Joined:
    Feb 22, 2010
    Posts:
    10
    EVERY single time i import an object and make a camera follow it the camera is offset 90 or 270 degrees.

    I'm soo lost on this now, i have no idea what i'm doing wrong.
     
  38. Ingenu

    Ingenu

    Joined:
    Sep 11, 2009
    Posts:
    49
    Tell you what, are you using 3dsMax? Post your file here and I'll take a look this evening.
     
  39. Tysoe

    Tysoe

    Joined:
    Jul 6, 2009
    Posts:
    577
    Anyone that wants this coordinates thing fixed really should vote on the feedback page on the issue here.

    http://feedback.unity3d.com/forums/...orrect-orientation-and-without-game?ref=title

    The coordinates thing gets mentioned at least once a week and on occasion the feedback page gets mentioned. The feedback/wishlist page tallies peoples votes and lists them priority. Unfortunately there are currently 3 seperate subjects and the one I pasted above has the most votes. It's currently at 34 votes which leaves it quite far down the list at 41st from the top.

    It's a bit of a pain, but please take the time to sign up and cast your vote so we can hopefully get it fixed.
     
  40. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    Hey, i recently came across this problem too!
    I am trying to create a Turret in Max, in a similar way to the Sentry Gun in the FPS Tutorial.
    The issue I am having is:
    1) I am no Artist/Modeler :) I am a programmer trying to model, and so there are issue to begin with haha.
    2) There are two objects/meshes in Max. The TurretGun and the TurretBase.

    When i export in Max, and import to unity, the whole object(as in both combined) is shown correctly. The issue is that its sub-meshes are not, their rotations are messed up.

    Will rotating the X for each individual model help out? And then export with Y-Up

    Thanks, Adam
     
  41. Checksum

    Checksum

    Joined:
    Apr 18, 2010
    Posts:
    19
    What is the best way to handle biped pivot rotation, etc?

    I want a pro solution and not a hack, please help.
     
  42. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    2,476

    it doesn't work.

    I changed 90,0,0 in max and model imported in status of laying..
     
  43. hajasal_sk

    hajasal_sk

    Joined:
    Jan 5, 2010
    Posts:
    37
    I have a biped-rigged character in 3DS Max that is importing into Unity with the following rotation:

    X: 270
    Y: 90
    Z: 0

    I've tried to figure out how to rotate the figure/pivot prior to export to get this right, but can't seem to. I'm also finding that if I try to rotate the pivot in 3DS Max that it's distorting the mesh.

    Am I missing something obvious? I'm not a 3D artist, but can follow instruction. :D

    Thanks!
     
  44. MaxRoetzler

    MaxRoetzler

    Joined:
    Jan 3, 2010
    Posts:
    136
    I just started taking a look into Unity and the first thing I stumbled across is the orientation issue. Rotating the pivot about [90,0,0] does align the axis properly, but the mesh is still flipped on (unity) X and Z axis.

    To get the same orientation (geometry and pivot) in Unity as in 3dsMax it takes:
    1. Mirror geometry on X/Y axis
    2. Reset pivot to world space coordinates (as its mirrored as well)
    3. Rotate pivot about 90° on X-Axis

    However this can only be applied to geometry, it pobably F***s up all characters. I searched the forums and the unity answers page but as there doesn't seem to be a solution...I assume all UnityDevs got used to this? I'm not nagging I just want to know about possible pitfalls. :)

    thanks in advance.
     
    Last edited: Oct 17, 2010
  45. Tysoe

    Tysoe

    Joined:
    Jul 6, 2009
    Posts:
    577
    This issue was supposed to be looked at and hopefully fixed after GDC according to the Unity staff. So far no joy but it is one of the biggest requests on the wishlist/Feedback page. It's not just 3dsmax either but most 3D apps that have the incorrect orientation because unity uses a different handedness with their coordinate system.

    http://feedback.unity3d.com/forums/...orrect-orientation-and-without-game?ref=title

    Currently 21st place with 149 votes.
     
    Last edited: Oct 17, 2010
  46. Paulius-Liekis

    Paulius-Liekis

    Joined:
    Aug 31, 2009
    Posts:
    672
    zortech, you can't really get the same orientation of pivot and geometry, because handedness of Unity and 3dsMax do not match (i.e. left-hand vs right-hand coordinate systems), so I don't really see how you would make it exactly the same. Anyway, is it really a problem? I think the only actual issue is the unwanted rotations on imported objects, i.e. object have (0,0,0) rotations in external tool, but when imported they get (270,0,0) in Unity. As Tysoe said it's on the wish list: http://feedback.unity3d.com/forums/...orrect-orientation-and-without-game?ref=title

    Now just to make things clear: it's not something that Unity does, this conversion is done by FBX SDK during import time. It doesn't work exactly as we want it to, so I started implemented my own conversion, but it's not done yet: it's not easy as I would like it to be - it's easy to convert rigid objects, but it's much harder to do for skinned and animated ones.

    There are several ways to solve that issue:
    1) Parent your object to empty game object which has (0,0,0) rotations.
    2) Write an asset importer which removes these transforms (as I said it's easy to do for rigid geometry)
    3) Wait for Unity to fix this. I know from personal experience how annoying these (270,0,0) rotations can be, so I want to see it fixed just as much as you do.

    Paulius
     
  47. MaxRoetzler

    MaxRoetzler

    Joined:
    Jan 3, 2010
    Posts:
    136
    Thanks Tysoe and Paulius for your quick answers.

    Yes, I figured it's actually not a real problem. I just want the exported objects in Unity to be aligned properly without any predefined rotation values. Rotating the pivots in 3dsMax does the trick, as others posted already as well. I was only hoping that an object which is moved along the positive X-Axis (via Unity script) wouldnt go backwads because of the flipped axis. (if that even makes sense :confused:)

    I resolved the rotation issue via maxScript for now as I'm not that familiar with Unity yet and continually clicking the "exportSelected" button in 3dsMax is annoying as well.

    Max
     
  48. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    2,476
    I don't know how to rotate in 3ds max. Please let me know more specifically.

    How to make 90,0,0 in 3ds?

     
  49. sirdavid23

    sirdavid23

    Joined:
    Jan 26, 2011
    Posts:
    22
    I have been troubled for full 4hours and I still don´t know how to solve this. Allow me to explain: I got my character fully rigged the way simple bones are to be attached to one another, 1 chain for legs, another one for torso, etc.. all these parented together. They´ve been created using the RIGHT viewport. I´m using softimage. When I export to FBX I have no options to twist x by 90º. So when I get my fbx over to unity, my bones twist the mesh horribly. and the pivot point...well...simply put: doesn´t match anything I view in softimage nor if I twist it. If I have a single bone chain, all the mesh appears good. As soon as I parent another bone chain, then it twists like crazy.

    Please tell me this is just a timely nightmare...
     
  50. holmeren

    holmeren

    Joined:
    Dec 12, 2006
    Posts:
    300
    It still works for me ;)
    In Max: "Select rotate pivot only" make your rotation so X= 90 and the rest is 0 0
    Export with Y as up.

    Bingo.

    If you have a Biped: ad a root note that has 90 0 0 in rotation and then link the biped to the root so the root becomes parent (Root)

    Bingo he stands.
    Hope it helps.........