Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Export2Maya - Export Unity Scene to Maya Scene File

Discussion in 'Assets and Asset Store' started by Fishypants, Apr 23, 2014.

  1. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    Woah, so sorry everyone for the lack of responses. Not sure what happened but I haven't been getting notifications that people were responding to this thread. I apologize about that.

    @primitiveType - I should know soon if this is possible. Work schedules have been kinda crazy lately but I have more free time to test this feature out.

    @mikkermik - That's very strange and once again sorry for the long time it took to reply. Could you do me a favor and export a Unity Package of any models that are not exporting correctly and PM me the package to test?

    @NO1467 - I'm not quite sure what the issue you are experiencing is. From what I can guess, there is a problem with exporting skinned meshes? Animation is not currently supported at the moment. If you are having issues could you export a Unity Package of your models that are not exporting correctly for me to test?
     
  2. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    @Fishypants In Unity 5, Export2Maya cannot locate lightmap textures for objects to that are rendered using precomputed GI, and thus the 'Setup Lightmap Baking' function inside Maya cannot generate a lightmap_layer_#_mesh for those objects. However, I have been able to successfully complete the lightmap workflow indicated in the Export2Maya docs using Baked GI.

    However, because Unity 5 does not expose lightmapping texture selection as it did in Unity 4, I really do not have a clue how to actually apply the new lightmap texture to corresponding objects in the scene (?) I understand that it may involve writing a plugin that tells renderers to access a lightmap index to update their lighting information, etc.

    Can you enlighten me (pun intended) on this aspect of the workflow, e.g. how to apply new lightmap textures to the objects in the scene that were used to generate that data in Maya?
     
  3. Marcurion

    Marcurion

    Joined:
    Jul 29, 2015
    Posts:
    13
    Unfortunately we are having some issues with this plugin, objects from Unity are crushed into each other and have wrong scale as well as no texture. (see attachment)

    Maya logs many file errors like this:
    The transform 'Thronos1' has no 'n' attribute. //
    and
    New name has no legal characters. //

    Tried 2 projects and 2 Maya Versions...
    Is this behaviour known?

    Regards,
    Marcurion
     

    Attached Files:

  4. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    @ buttmatrix - I'm trying to understand your workflow, and I don't quite get the point of trying to export scenes for lightmapping if you are using Realtime GI. In that case there would be nothing to export, since Unity is calculating everything in realtime. Granted it does some pre-computations but the final GI is realtime. Some more info might help to figure out a solution to your issue.

    As far as the baked lightmapping goes, using Baked GI, when you save your scene and bake the GI there will be a folder in your Project tab with the name of your scene file. That is where your lightmap textures are stored. If you run a Bake GI operation on your scene file, you'll see files called "Lightmap-0_comp_light", "Lightmap-1_comp_light", etc. Once you bake your textures inside Maya you need to rename them so the names match those files, then copy them to your project folder inside that lightmap folder and overwrite those textures. Ideally you will want to disable Auto Baking or else the textures will be overwritten automatically by Unity if anything in your scene triggers an Auto Rebuild of the GI.

    Also, doing a pre-bake inside Unity is nice since you know exactly what the names of the textures should be. If you do not then that folder might not exist and you will need to create it yourself. Much easier to let Unity do that setup part and then just overwrite it with your own textures.

    @ Marcurion - This sounds like a name clash issue that I am not accounting for. Should be simple to fix but ideally I will need you to export an example mesh that ins't exporting correctly as a Unity Package so I can test it on my end. It is important for it to be a Unity Package as this preserves any setup you currently have in your scene file and I can test it accurately on my end. If you cannot export the Unity Package due to NDA issues, PM me and we can discuss it in private what the issue could be. Let me know so we can get that fixed for you asap.
     
  5. Sadlercs

    Sadlercs

    Joined:
    Aug 2, 2015
    Posts:
    3
    Error occurs when using on the Blacksmith Demo:

    IndexOutOfRangeException: Array index is out of range.
    Export2Maya.WriteMesh (System.String filePath, System.String fileName, System.String MayaName, .MayaNode Parent, Boolean IntermediateObject, UnityEngine.Vector3[] verts, UnityEngine.Vector2[] uvs, UnityEngine.Vector2[] uvs2, UnityEngine.Color[] colors, UnityEngine.Vector3[] normals, System.Int32[] tris, System.String InstObjGroups, Vector4 tilingOffset, Boolean ExportLightmapUVs) (at Assets/Export2Maya/Editor/Export2Maya.cs:3393)
    Export2Maya.WriteNode (.MayaNode Node, System.String filePath, System.String fileName) (at Assets/Export2Maya/Editor/Export2Maya.cs:2301)
    Export2Maya.WriteDAGNodes (System.String filePath, System.String fileName) (at Assets/Export2Maya/Editor/Export2Maya.cs:1969)
    Export2Maya.ExportMaya () (at Assets/Export2Maya/Editor/Export2Maya.cs:238)
    Export2Maya.OnGUI () (at Assets/Export2Maya/Editor/Export2Maya.cs:95)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
     
  6. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    @Sadlercs - Do you know which object is causing this error off hand and which scene file it is happening in?
     
  7. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Right, you cannot export lightmaps when rendering with precomputed realtime GI, however, only precomputed realtime GI and Directional Specular Baked GI are capable of producing specular reflections - I had forgotten about the Directional Specular baking option when I wrote my original post.

    I see what you are saying about the lightmaps baked in Maya: You have to rename the newly created lightmap according to the file in the Unity project folder, and paste it into the project folder from Windows Explorer, replacing the file.

    I was able to get this to work, thank you!
     
  8. Pode

    Pode

    Joined:
    Nov 13, 2013
    Posts:
    145
    @Fishypants : We bought your assets to make some VR tests (rendering the baked light via Maya). Unfortunately, I'm not a Maya user myself, so it seems that I'm making something wrong.

    When I export an Unity scene, it doesn't seem to save the Lightmap layers information (and names). Without them, the Export2Maya MEL script seems to fail.

    Here's my workflow, can you spot something I'm doing wrong ?
    - select gameobjects in the unity hierarchy (some static ones and some non-static others).
    - Export via the window/Export2Maya script
    - Load the scene in Maya 2016 (VRay)
    - I can't seem to find the Lighmap_layers
    ...

    Thanks in advance !
     
  9. buttmatrix

    buttmatrix

    Joined:
    Mar 23, 2015
    Posts:
    609
    Just to be sure, check the Lighting Window and make sure you are using Baked GI and not Precomputed GI, otherwise Export2Maya will not be able to fetch the lightmaps from Unity and therefore create the lightmap layers in Maya.
     
  10. Pode

    Pode

    Joined:
    Nov 13, 2013
    Posts:
    145
    @buttmatrix : thanks, that was the cause of the problem (I was pretty sure I hit the 'bake' button, but must have forgottent it).

    The problem I have now is that I can't force the UV set to 'lightmap' in Maya, only 'map1'.
    In Unity, when exporting the scene I went through all the models, and checked 'Generate Lightmap UV', but it doesn't seem to do anything...
     
  11. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    Apologies for not getting back to you sooner Pode. Work schedules have been intense lately. To be sure:

    1) In Maya, in the UV Editor window, when you click UV Sets, all that it shows is map1?

    If so, then it seems that Unity is not generating the lightmap uvs for your objects.

    2) Have you set your objects in Unity to be Lightmap Static? I can't recall offhand WHEN Unity generates the lightmaps exactly, as you need to Enable "Generate Lightmap UV's" in the inspector for your model, as well as setting it to static. Both need to be done to ensure that lightmap uvs are generated, I just cant recall exactly when Unity generates them. Try enabling both and let me know if it works ok for you.
     
  12. Pode

    Pode

    Joined:
    Nov 13, 2013
    Posts:
    145
    @Fishypants : in fact it works for the 'AngryBot' scene, but not the other scene (with models grabbed from the net).
    Since I wanted to a good feel of the workflow, I went with the AngryBot scene, and everything went ok.

    Do you have some screenshots comparing Unity-rendering/Maya-rendering ?

    That would for the sales I think (I would help me explain the process to my coworkers ;))
     
  13. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    @Pode - Not sure what you mean by comparing Unity-rendering / Maya -rendering? All of the screenshots on the Export2Maya page are rendered in Maya, the Angry Bots scene plus the Blacksmith Character.
     
  14. Pode

    Pode

    Joined:
    Nov 13, 2013
    Posts:
    145
    @Fishypants : yes, I understand that. What I mean is more like 2 screenshots side-by-side, with the 'traditional' light baking on the left and 'maya' light baking on the right.
    That would help make a better picture (!) of the difference in rendering between the two (for the sale viewpoint, of course).
     
  15. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    @Fishypants can you Please make a video tutorial for baking a lightmap in vray for unity ?
     
  16. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    @Farhex-Ahmed - Hey! I already have a tutorial included with Export2Maya that goes over the process of baking lightmaps in Vray. Is there something that isn't clear? If so I would be happy to help you with the workflow. Let me know.
     
  17. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    Hi, Thanks for replying. I am not very pro at Vray and Maya, so if you could put a video tutorial about light baking with vray in maya that will be super great.
     
  18. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    can you do that ?
     
  19. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    hmm, followed your documented tutorial but lightmap is not working . unity import it but the quality like vray is not present in the unity version.
     
  20. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
  21. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    Hey @Farhez-Ahmed - what settings are you using in Vray to render the light maps?
     
    lolclol likes this.
  22. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    The default settings for vray as you described on your documentation. Can you please share what vray settings should i use ? May be some Screenshot of vray settings will be very helpful.

    Thanks
     
  23. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    somehow the "lightmap" option doesnot come up when add vraybake texture option, only in the drop down list is map1 nothing else, also it would be wise enough for what vray version you worked with and also include the vray rendering option to select in your documention.
     
  24. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    pls update this addon for latest version of maya
     
  25. Fishypants

    Fishypants

    Joined:
    Jan 25, 2009
    Posts:
    444
    Just wanted to give everyone a heads up, work schedules have slowed and I am in the process of doing a huge overhaul on the exporter. Will be updated soon.
     
  26. lolclol

    lolclol

    Joined:
    Jan 24, 2013
    Posts:
    212
    waiting for updates and more features. <3