2014-03-19

Hey there! So I recently found a need to be able to select objects in a Unity Scene and export them to Maya. The problem I ran into was that I needed vertex colors to come across as well as the lightmap UVs, but setup with the correct lightmap index and tilingoffset values (so I could bake my lightmaps easily in Vray). Unfortunately the OBJExporter script does not work as there is no way of specifying vertex colors in the OBJ format.

I was originally going to modify / create my own version of the OBJ format that supported vertex colors, but that would mean having to create the OBJ import plugin on the Maya side. (while not impossible, this was more work than I was willing to put into it, plus its more of a hassle to get setup).

Then I thought, why not write directly to the Maya file format? It's been a headache of an adventure, but it is almost complete!


So far it exports:
Vertices

Vertex Colors

Edges

Faces

Normals

Default UVs

Lightmap UVs (with correct tiling offset)
Lightmap Index (attribute added automatically to MeshShape. Also have a Maya MEL script for easily selecting objects that belong to different lightmap indexes inside Maya)

Things to do:

1) Unity can have multiple objects in your scene with the exact same name, but in Maya this is a big no-no. In this scenario it is impossible to load a Maya scene file with objects named the same (unless they are grouped under other objects), so I am implementing an object renamer that adheres to Maya's method of avoiding name clashing which is "objectName" + incremental number #. So the objects will be renamed on export to avoid name clashes.

2) Right now it works on meshes, but I would also like to implement the exporting of Lights as well. Not sure if anyone would find this useful, but what the heck. Might as well.

3) Optimize the memory use on large scene files.

Can't think of anything else off the top of my head. So yeah, I'll update this thread as I update the exporter.

Attached Images

 

Show more