Unity Community

Register or Sign In:

+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 20 of 31

  1. Location
    Burlington, Vermont USA
    Posts
    134

    Maya MEL grid script for building Unity assets

    Greetings all! I build one of these simple MEL scripts for each engine I work with (Unreal3, Torque, Source, Unity) so all artists on the project work with consistent grid setting and we don't end up with assets that don't match in scale. My team and students swear by these scripts so I thought I'd share it here.



    I'm a game artist who makes no claim at being a programmer so let me know if you have any problems with the script.

    I've struggled with scaling during the FBX import process into Unity since I started using Unity a few weeks ago but I have a system that now works for me. I'll post it here because I know some people are still having some issues with scaling between Unity and Maya:

    The FBX exporter checks to see what our settings are in Maya and changes the settings scale Factor to equal 1.0 based on what your settings are. Unity 2.5 likes to set the FBX scale factor to 0.01 (why?) and will change the transform scale to compensate (this can be bad). The goal is to set the FBX exporter/importer settings to properly scale the units as opposed to setting the transform scale which can affect performance.

    If you work in Meters in Maya and want them to equal Meters in Unity (I RECOMMEND THIS ONE):
    1. Set Maya's Linear Working units to be meters.
    2. Work in Maya as if 1 Unit = 1 Meter
    3. On export set FBX Exporter -> Units -> Scale Factor: 100.0 (Centimeters)
    4. Leave the Unity Inspector at FBX Importer -> Meshes -> Scale Factor 0.01
    5. A 1x1x1 cube should drop into a Unity scene as 1x1x1 meter with a clean 1x1x1 scale transform


    If you work in Centimeters as "generic units" in Maya and want them to equal meters in Unity:
    1. Set Maya's Linear Working units to be centimeters.
    2. Work in Maya as if 1 Unit = 1 Meter
    3. On export set FBX Exporter -> Units -> Scale Factor: 1.0 (Centimeters)
    4. In Unity Inspector set FBX Importer -> Meshes -> Scale Factor in Unity to be 1.0.
    5. A 1x1x1 cube should load into Unity as 1x1x1 meter with a clean 1x1x1 scale transform


    If you work in Centimeters in Maya and want them to equal centimeters in Unity:
    1. Set Maya's Linear Working units to be centimeters.
    2. Work in Maya as if 1 Unit = 1 Centimeter (1m = 100cm)
    3. On export set FBX Exporter -> Units -> Scale Factor: 1.0 (Centimeter)
    4. Leave the Unity Inspector at FBX Importer -> Meshes -> Scale Factor 0.01
    5. A 1x1x1 cube should load into Unity as 1x1x1 centimeters with a clean 1x1x1 scale transform


    I've been super impressed with the level of support and help available on this forum. I hope this helps someone. Please let me know of any inaccuracies in this post, thanks!

    Edit: 6/26/09. Just updated with a fix for the clipping planes in default ortho cams. Whoops! I just accidentally deleted the attachment! It had been downloaded 35 times. ops:

    Edit: 7/13/2010.
    Updated to work in Maya 2011:
    Changed color scheme a bit for the new UI
    Fixed a few bugs with m/cm switch
    Removed the MacOS version (had been downloaded 212 times)-- this one should work for all Maya platforms.
    Please get back to me with any bugs.

    Edit: 7/14/2010
    * Fixed a bug that wouldn't allow it to work in previous versions of Maya. Now tested in Maya 2009 up to 2011.
    * Changed some of the buttons to radio buttons for better feedback.

    !! Removed the DL link from the Unity forums (had been downloaded 329 times) -- it's too hard to keep updated with my other sites.

    This script (jbUnityGrid), along with others should now be downloaded directly from my website:

    http://cgartistry.com/experimentation/melScripting.html

    FINAL EDIT: This script is no longer available. A new version can be found here: http://forum.unity3d.com/threads/116...983#post774983
    Last edited by jbuck; 12-20-2011 at 09:42 AM.

  2. Administrator
    Location
    Unity HQ, Copenhagen
    Posts
    4,567

    Re: Maya MEL grid script for building Unity assets

    Thanks for sharing that

    Quote Originally Posted by jbuck
    If you work in Meters in Maya and want them to equal Meters in Unity (I RECOMMEND THIS ONE):
    1. Set Maya's Linear Working units to be meters.
    2. Work in Maya as if 1 Unit = 1 Meter
    3. On export set FBX Exporter -> Units -> Scale Factor: 0.01 (Centimeter)
    4. Leave the Unity Inspector at FBX Importer -> Meshes -> Scale Factor 0.01
    5. A 1x1x1 cube should drop into a Unity scene as 1x1x1 meter with a clean 1x1x1 scale transform
    The easiest way is to just save your MB or MA files directly into your Unity Project folder. The FBX process is then done automatically in the background.
    Ethan Vosburgh - Artist at Unity Technologies
    http://www.antennatree.net


  3. Location
    Burlington, Vermont USA
    Posts
    134
    You're welcome! To be honest I was excited about being able to use Maya files directly in Unity but I have a couple of problems with that workflow:

    1. The background FBX conversion takes approx 20 seconds every time I jump back into Unity with a new .mb or .ma file (quad core 64-bit system with 8 gigs of RAM). In comparison, exporting a 2000 frame animated static mesh directly through FBX takes only 6 seconds or so. A 5000K poly mesh with no anim exports in less than one second and shows up in Unity instantly.

    2. By default the exported object drops down in Unity 100x larger than it should be. This means I have to edit the FBX import settings in the inspector back down from 1 to 0.01.

    3. IMO, keeping exported files separate from actual .ma or .mb source files makes for a more logical and artist friendly workflow especially when dealing with animations, multiple meshes, etc.

    I admire the source-file approach Unity has taken and I love the flexibility of being able to do either but I've seen my Unity projects explode in size because of keeping source files (PSD, Maya, etc) in the Unity project itself. This also makes for sluggish remote version/source control.


  4. Location
    Frankfurt Main / Germany
    Posts
    47
    Thank you. It's really useful….
    Heinz

    Unity 2.5 Pro, iMac, OSX 10.5.7, Maya 2009, Modo 401, ZBruch 3.1


  5. Location
    Burlington, Vermont USA
    Posts
    134
    You're welcome! Please let me know if anything is broken or if there are any features that you'd like to see added.


  6. Location
    Frankfurt Main / Germany
    Posts
    47
    I changed only the GUI a little (I'm on a Mac). Would you like to have this version?

    By the way, nice Sketchbook :shock: 8)
    Heinz

    Unity 2.5 Pro, iMac, OSX 10.5.7, Maya 2009, Modo 401, ZBruch 3.1


  7. Location
    japan
    Posts
    825
    Hey josh , thank for taking time sharing that little handy tool

    and I will also say , Nice sketchbook , your Orc is really awesome !


  8. Location
    Los Angeles, CA
    Posts
    437
    Wow, Josh, your ZBrush work is amazing!


  9. Location
    Burlington, Vermont USA
    Posts
    134
    Thanks, guys, I really appreciate it! I actually teach Zbrush (among many other things) and have a lot of game industry experience but my work is a humble beginning compared to some of the work up on the Zbrush forums.

    Glad some of you are liking the MEL script. HJPuhlmann -- I don't work in MacOS (sometimes I DO work on a Mac), were there problems with the UI? Funny... I didn't even think to test in Mac-Maya.


  10. Location
    Frankfurt Main / Germany
    Posts
    47
    Nice job, enviable. I'm a professional programmer, who try to make art in the spare time . You could teach me/us ...
    Heinz

    Unity 2.5 Pro, iMac, OSX 10.5.7, Maya 2009, Modo 401, ZBruch 3.1


  11. Posts
    39
    Quote Originally Posted by HJPuhlmann
    I changed only the GUI a little (I'm on a Mac). Would you like to have this version?

    By the way, nice Sketchbook :shock: 8)
    I'd like that version You can post the code here if that's easier than posting a file.

    I WILL get my ... -> Unity pipe working today, I bloody well will.


  12. Location
    Burlington, Vermont USA
    Posts
    134
    HJPuhlmann, can you pm me the file with the MacUI? I'd like to see the script too as I'm curious what changes needed to be made. I'll add it to the main post.

    emptythetill, I posted some info in your thread on getting anim into Unity. I hope it helps.


  13. Posts
    39
    Ye Josh, your post was incredibly helpful. Sadly though, I'm still having crazy issues which I can't work out. Random stuff occurs with no real reasons or clues as to why. But, I'm getting there, slowly.


  14. Location
    Frankfurt Main / Germany
    Posts
    47
    Josh, you got a PM.
    Heinz

    Unity 2.5 Pro, iMac, OSX 10.5.7, Maya 2009, Modo 401, ZBruch 3.1


  15. Location
    Burlington, Vermont USA
    Posts
    134
    Thanks. I added the script to the original post. I can't open the file on my PC to see what changes were made. Any chance you can send me a PC friendly version?


  16. Location
    Frankfurt Main / Germany
    Posts
    47
    :lol: Unbelievably.:lol: I send you the mel script ...
    Heinz

    Unity 2.5 Pro, iMac, OSX 10.5.7, Maya 2009, Modo 401, ZBruch 3.1


  17. Location
    us
    Posts
    188
    If I do meters in maya, and export as centimeters (fbx 2009 version, maya2009), my object comes in small.
    If I change the import setting to 0.1 in Unity, its correct.
    But, if I export from maya in Millimeters its correct... whats wrong with this picture?

    I'd rather not mess with the Unity import scale if I don't have to.


  18. Location
    Burlington, Vermont USA
    Posts
    134
    I can't reproduce this.

    If I export a 1m cube from Maya (working in Meters) and set the FBX exporter scale to centimeters it comes in to Unity with an FBX importer scale factor of 0.01 which is correct as the transform scale is 1, 1, 1 and the cube is 1m in Unity.

    If I export a 1m cube from Maya (working in Meters) and set the FBX exporter scale to millimeters the cube comes in to Unity with an FBX importer scale factor of 0.01 but the transform scale for the object is 10,10,10 and the cube is 10m in Unity.

    I just tested this in Maya 2009 with both FBX 2009 and 2010. Try downloading a newer version of FBX 2009 or 2010 and see what happens?


  19. Location
    Sao Paulo
    Posts
    12

    jbUnityGrid Icon

    Just great dude, thanks!

    I made an BMP icon for your script.

    Here's a preview:



    []'s

    Mateus
    Attached Files


  20. Location
    Burlington, Vermont USA
    Posts
    134
    An icon! Awesome, thanks!