3DS Max, some questions

Discussion in 'Unity Support' started by AkilaeTribe, Aug 29, 2010.

  1. AkilaeTribe

    AkilaeTribe

    Member

    Joined:
    Jul 4, 2010
    Messages:
    1,149
    Greetings,

    There is a strange thing about 3DS Max. When I import a file in Unity, the Y axis is kept, but X and Z axis are inverted (the X axis in Max is the inverse of the X axis in Unity, same case for Z). How is it possible ?

    Plus, could someone tells me how to make it so that one unit in 3DS Max equals one unit in Unity ? (so, the borders of a sphere of radius 1, located at (0, 0, 0) goes from X : -1 to X : 1 ? :?
  2. Vimalakirti

    Vimalakirti

    Member

    Joined:
    Oct 12, 2009
    Messages:
    752
    Make sure to mess around with your .fbx exporter settings to tweak things so they work the best for you. IDK if 1 unit in max per 1 unit in Unity is possible, but you might get it close enough? Definitely try both Yards and Meters. Let me know how that works out by replying here, if you could.

    As far as my work goes, that Z is Up seems to work for me just fine when exporting to Unity (I know Y is Up in Unity... I can't explain, but it seems to work out).

    See picture of FBX exporter settings.

    By the way, you'll get more responses for 3dsMax questions in the External Tools Forum (cause max is a tool external to Unity I guess.)

    Attached Files:

  3. urgrund

    urgrund

    New Member

    Joined:
    Jul 14, 2009
    Messages:
    195
    I found the up axis setting on the FBX exporter does not change anything. What may be needed are more settings with the importer in Unity Editor? Such as which up axis to construct around?

    What you'll find is that GameObjects are rotated 270 on X to emulate a Y up axis. This of course means all of your Vector.Up and Vector.Right are not really "up" or "right".

    To get around this, I've had to write a maxscript to export my FBX for me, it will do the rotate in 3dsMax, bake that transform then send it to Unity.

    Now it doesn't need the added 270deg rotation and all scripts operating on directions make sense.

    Maybe this is a different problem to what you have? But it's all axis related :)
  4. AkilaeTribe

    AkilaeTribe

    Member

    Joined:
    Jul 4, 2010
    Messages:
    1,149
    I imported a sphere of radius 1 meter, it was twice the size of the unity default game object sphere (which is radius 0.5). I guess 1 meter in max = 1 unit in Unity. :)

    I will remember it in the future ;)

    I remade the test : I made three cylinder, each called X, Y, Z, starting from the origin in max, and pointing towards their direction.

    I export it, and import it in Unity.

    - Cylinder X is pointing -X
    - Cylinder Y is pointing -Z
    - Cylinder Z is pointing Y

    [​IMG]

    Is there a "normal", integrated way to solve that ? Learning MaxScript is among the things I would do in last ... :(
  5. oblivionfeet

    oblivionfeet

    New Member

    Joined:
    Jul 24, 2010
    Messages:
    482
    From the few tests I've done with Max (I'm a LW user, but using Max due to circumstances). The scale should be meters and the unit 1.

    But to be sure, simply make a 1 meter cube in all the packages you are using and move them around from package to package, noting any differences in scaling and adjust settings accordingly.
  6. urgrund

    urgrund

    New Member

    Joined:
    Jul 14, 2009
    Messages:
    195
    Yep - well when you try importing an FBX into max, notice how the importer also asks which 'handedness' the mesh is? Perhaps this is needed with the Unity FBX importer too... because my maxscript is just 'hacking' the result based on the unity process of rotating the objects 270 in the X.

    Has anyone else come into these problems? For the most part it's not noticeable if you're just moving Prefabs around... it's once your scripts start expecting transform.forward to really mean forward as after the importer rotates by 270, forward is now "up" :) ...perhaps I'm just doing it all wrong! hehe
  7. Theformand

    Theformand

    Member

    Joined:
    Jan 2, 2010
    Messages:
    238
    And nothing changes if you simply just adjust the pivot of the model inside 3DSMAX?

    Like, if inside unity, the positive Z of the model actually points in negative Z, try rotating the pivot 180 on the Z before exporting from MAX.(This is just an example, translate it to your needs :))
  8. urgrund

    urgrund

    New Member

    Joined:
    Jul 14, 2009
    Messages:
    195
    yes - if you 'hack' the model in max to represent how unity is wanting to import it then all is good.

    so the problem still persists and I think if Unity just opened one little flag such as as "Y Up" in their FBX importer then all will be good.

    Until then, I'm using MaxScript to export the FBX file 'prepared' for how the Unity importer wants it... as it appears to 'solve' the Max Z Up to Unity Y Up... they just rotate on the X 270, rather than actually reconstructing the mesh on import so that the model "up" is really "up" as far as the Unity co-ordinate system is concerned.

    Take a spaceship for example... The model gets into Unity and Unity applies a 270 rotation in the X for you. Great... it appears to be correct when you drag the prefab into the scene to inspect, that is, "visually up" is still "up" on the spaceship.

    But to get the true look of the model, you'll need to set rotation back to [0,0,0]... now look a the space ship, it's on its side! That's how Unity really imported it... and that's how any scripts controlling movement will think is "normal".

    Basically, they just need to reconstruct the mesh differently if our DCCT's are Y up or Z up not add a soft rotation.


    of course - maybe I've totally missed something very simple here and it all works perfectly already! :D
  9. TwiiK

    TwiiK

    Member

    Joined:
    Oct 23, 2007
    Messages:
    928
    Isn't all you have to do just select the object, go to hierachy settings, adjust pivot only and rotate the pivot so Y is up inside of Max?

    That works for me at least.
  10. Paulius Liekis

    Paulius Liekis

    Member

    Joined:
    Aug 31, 2009
    Messages:
    665
    Let's get things clear :)

    Units

    Unity 2.6 imports: 1cm in 3dsMax = 1unit in Unity.
    Unity 3.0 has the same behaviour by default too, but it has an option for "1unit in 3dsMax = 1unit in Unity".

    Axis

    1) All axis problems are caused by different handedness and different up-axis. All game engines have to deal with these problems.

    2) "Y up" checkbox in fbx exporter doesn't do anything for Unity, because Unity performs that conversion anyway (if it's not done yet), so no matter what your mesh is always converted to y-up coordinate system.

    3) Q: So if conversion is performed, why do I get these 270 rotations on my object?. A: Unity axis conversion is based on FBX SDK - that's the way it performs the conversion - it adds extra rotation.

    4) Q: Sounds like FBX SDK conversion is not exactly what we want, why don't you implement conversion in Unity? A: That's the plan. I tried to implement it for Unity 3.0, but ran out of time. I know, for meshes it's simple - you just flip coordinates and add negative signs to one of them, but you have to deal with rotations and animations too, and then it gets more interesting... It's easier said than done. You can always vote on feedback.unity3d.com - I believe there is "axis conversion" item there.


    I probably missed some issues, but I hope this helps.
  11. PatHightree

    PatHightree

    Member

    Joined:
    Aug 18, 2009
    Messages:
    174
    Regarding the axis problem :
    Indeed, animations are more 'interesting' (as in frustrating), I didn't succeed in writing an asset postprocessor for it.
    For anybody else having this problem, here is the link to the feedback item.
    Please upvote !
  12. schwertfisch

    schwertfisch

    Member

    Joined:
    Sep 7, 2010
    Messages:
    109
    I had a similar problem, with a spaceship that I imported from Max.
    Rotating my mesh in max before exporting did not change anything, although I was sure it would.
    Rotating the Rivot in max by 270 degrees on the X axis, solved my problem - thanks Theformand!