# Maya to glTF exporter
If you believe this plugin is good enough to request Github Sponsoring, please say so here
Supports Maya 2017-2020, Windows 10 x64, macOS High Sierra+ and Linux
Windows 10 x64
zip
file to any location (e.g. your desktop)maya2glTF
folderdeploy
batch fileDocuments
foldermacOS High Sierra and Linux
maya2glTF_UI
to launch the UI.
maya2glTF_UI
script text and drag it using the middle-mouse-button to the Custom
shelf, or even better, make a glTF
shelf...select all polygon meshes
buttonexport selected meshes
button.
maya2glTF_UI
script or hit the refresh user interface
button_.assign PBR shader to selection
buttonDocuments\maya\maya2glTF\PBR\shaders\glTF_PBR.ogsfx
Default_normal.jpg
Default_albedo.jpg
Default_AO.jpg
Default_emissive.jpg
Default_metalRoughness.jpg
basecolor
or albedo
=> base color texturemetal
or _orm
=> metallic texturerough
or _orm
=> roughness textureoccl
or _orm
or _ao
=> occlusion texturenormal
=> tangent space normal texture-mts
flag for MikkTSpace information if your models come from Blenderemissive
=> emissive texturediffuse_env
=> Image-based-lighting (IBL) prefiltered diffuse environment map (PMREM)specular_env
=> Image-based-lightning (IBL) prefiltered specular environment map (PMREM)brdf
=> Bidirectional reflectance distribution function lookup table texturemaya2glTF_assignPbrShader.mel
_putenv "AW_JPEG_Q_FACTOR" "92";
putenv "AW_JPEG_Q_FACTOR" "100";
putenv "AW_JPEG_SUB_SAMPLING" "1x1,1x1,1x1";
At IIM, we are specialized in creating realtime interactive 3D animation, for web, education, events and broadcast television, since 1992. We have developed our own multi-machine real-time 3D puppeteering software called AnimationNow, and we are about to upgrade this to make use of up-to-date rendering techniques.
If something goes wrong in our production pipeline, it usually is exporting our complex rigged Maya characters. In the past, we contributed both donations and patches to the open source OGRE exporter, but now we want to dig deep into the Maya API ourselves, so we can help out our artists if something goes wrong during the export.
glTF 2.0 seems to contain most of the features we need, and is extensible. IMHO glTF must become the defacto standard for animated 3D content. At IIM, we plan to use glTF for all our 3D assets.
Maya interally uses a dataflow architecture (called the dependency graph). This means that power-users can connect the dependency nodes in the graph in any way they like. Unfortunately this awesome flexibility also makes it insanely difficult to develop an exporter that always works ;-)
-outputFolder (-of) STRING
(required)* * the output folder
-scaleFactor (-sf) FLOAT
(optional)
-copyright (-cpr) STRING
(optional)
-selectedNodesOnly (-sno)
(optional)
-sceneName (-sn) STRING
(optional)
-binary (-glb)
(optional)
glb
asset fileglTF
and binary bin
file containing the buffers-niceBufferURIs (-nbu)
(optional)
0
suffix from generated .bin
files if only a single one is generated./data
to the buffer names, just used the scene name.-hashBufferURIs (-hbu)
(optional)
-externalTextures (-ext)
(optional)
glb
files. -glb
-camera (-cam) STRING
(optional, multiple)
-initialValuesTime (-ivt) TIME
(optional)
-animationClipName (-acn) STRING
(optional, multiple)
-animationClipStartTime (-ast) TIME
(optional, multiple)
-animationClipEndTime (-aet) TIME
(optional, multiple)
-animationClipFrameRate (-afr) FLOAT
(optional, multiple)
-detectStepAnimations (-dsa) NUMBER
(optional)
-dsa 2
to detect STEP
"interpolations" in the sampled animations curves. shape.visiblity
to node.scale.x, y z
, to prevent interpolation.-meshPrimitiveAttributes (-mpa) STRING
(optional)
-mpa POSITION|NORMAL|TANGENT|TEXCOORD|COLOR|JOINTS|WEIGHTS
-blendPrimitiveAttributes (-bpa) STRING
(optional)
-mpa POSITION|NORMAL|TANGENT
-force32bitIndices (-i32)
(optional)
-disableNameAssignment (-dnn)
(optional)
-mikkelsenTangentSpace (-mts)
(optional)
-mikkelsenTangentAngularThreshold (-mta)
(optional)
-skipStandardMaterials (-ssm)
(optional)
-excludeUnusedTexcoord (-eut)
(optional)
-defaultMaterial (-dm)
(optional)
-colorizeMaterials (-cm)
(optional)
-dumpMaya (-dmy) STRING
(optional)
CONSOLE
to print to the Maya output window
-dumpGLTF (-dgl) STRING
(optional)
CONSOLE
to print to the Maya output window
-ignoreMeshDeformers (-imd) STRING
(optional, multiple)
Maya2glTF_ignored
(short name MGi
) to the deformer to ignore it.
maya2glTF_UI
has a button to add this attribute to the selected deformer(s)-skipSkinClusters (-ssc)
(optional)
-skipBlendShapes (-sbs)
(optional)
-redrawViewport (-rvp)
(optional)
I consider this plugin to be production quality now, but use it at your own risk :)
Supports Maya 2017-2020 (64-bit only)
Linux support hasn't been tested a lot.
Supports static and animated, skinned and morphed meshes
Supports multiple animation clips (node and joint transforms, blend shape weights)
Exports POSITION
, NORMAL
, COLOR
, NORMAL
, TANGENT
, TEXCOORD
, JOINTS
and WEIGHTS
attributes
Supports exporting to glTF + bin
, single glTF
or single glb
files.
Uses a modified fork of the glTF code from the COLLADA2GLTF project
Currently Phong, Lambert and Blinn shaders are converted to PBR, but only the color texture and transparency is taken into account (this is mainly done for testing with existing models).
Comes with GLSL code with a friendly UI ported from the official Khronos PBR WebGL code.
maya2glTF\maya\renderData\shaders\glTF_PBR.ogsfx
maya2glTF\maya\scripts\assign_glTF_PBR_material_and_textures.mel
script to assign multiple textures at once, based on filename patternsSupports exporting cameras
No lights yet
Currently out-of-the-box downloads are only provided for Windows x64
I assume you already installed a GIT client
Some versions of Maya require a Maya devkit
Clone this repository
git clone https://github.com/iimachines/Maya2glTF.git --branch master
Install Visual Studio 2019
Install the Win64-x64 version of CMAKE
Enter the maya2glTF
folder, and run
windows_create_vs_project -D MAYA_VERSION=2020
build
folder.Next build the maya2glTF
plugin itself
Launch Visual Studio 2019
Open the solution maya2glTF\build\maya2glTF.sln
Select the desired configuration target (e.g. release
)
Build
If all goes well, the plugin and all scripts will be copied to your %userprofile%\Documents\maya
folders
Finder
Utilities
Terminal
git clone https://github.com/iimachines/Maya2glTF.git ~/Documents/Maya2glTF
cd ~/Documents/Maya2glTF
./osx_create_project.sh 2020
build
folder, and make
the plugin
make
make install
- TODO
Start Maya
Load a scene
NOTE to load scenes from this project, first set the Maya project to the maya2glTF\maya
folder
to see if the plugin was built correctly, it's best to use a scene from this repository, for example maya2glTF\maya\scenes\damaged_helmet.ma
select the meshes and cameras you want to export
run the following MEL script
maya2glTF -outputFolder "<your output folder>"
I use the vscode glTF viewer
If you want to contribute to the development, you might want to use the MEL script maya2glTF\maya\scripts\test-iteration.mel
. This unloads and reloads the plugin everytime, unlocking the DLL.