Use the following best practices to optimize Maya’s performance.
Interactive drawing
- Turn on to improve performance when moving the camera.
- Save the file in the simplest display mode to make load time faster. Avoid saving files in textured display mode.
- Use default display options for polygons.
- Turn off display of all non-essential UI that updates when the scene view updates, for example: , , , , .
- Turn off the display of all non-essential scene elements, ranging from the Grid to drawing skeletons.
- Work with a layout that only includes a single modeling panel.
- Divide your scene efficiently by doing the following:
- Segment your scene into areas that don’t overlap (for example, using a grid layout).
- Use display layers to turn on or off the areas as required.
Splitting your scene up into a non-overlapping rectangular grid is also helpful for setting up visibility layers because you
can then plan the scene sector by sector. However, note that Maya performs front, back, and side camera frustum culling per
object. So, if even one triangle shows up, Maya draws everything.
- Use the new hardware filtering options, which are in the section of the shader node, drop-down list.
- Use the new Use default material display mode if applicable.
- Don’t use extra Shading menu settings like Wireframe on Shaded if you don't need them.
- If possible, use to limit what is displayed and refreshed in the scene.
- Objects with less than a few hundred triangles, and especially those with only a few triangles will have a high performance
overhead. If possible, merge the objects together into one. Maya performs much better with less objects that each have thousands
of triangles versus many objects with only a few triangles.
- Use instancing when possible. This includes instancing geometry, materials and textures. If using file texture nodes, it is
better to have one file texture node that is instanced versus many copies of the node. This affects memory used when the file
is loaded as well as on disk.
- Make sure to set your video card settings to Maya settings and disable vertical sync (sync).
- The default material display option can be used to see the difference between using 1 shader for all objects versus n shaders.
- If surfaces are partitioned into many layers, this may slow down shaded mode display. Attempt to use fewer partitions if possible,
and if used for visibility to partition the surfaces into grid sections. This helps with visibility culling.
- Attempt to build surfaces that do not intersect each other in terms of their bounds (bounding boxes). Visibility testing performs
worse in these cases.
- Sorting of the DAG hierarchy by display attribute types may help. This can be done by reordering DAG objects in .
- Ordering your DAG hierarchy may help:
- all surfaces first, then all non-surfaces
- by visibility within a given region (perhaps by layer if layers are used for visibility partitioning)
- by depth to viewer (if feasible)
- material and lighting attributes: for example, all lamberts, then all blinns, then all shaders which don't use lighting, then
all those that do, and finally all shaders which don't have transparency, then all those that do
- Use a minimal shader for an object. For example use a surface shader when you don't require lighting, or you’ll be overriding
lighting elsewhere, for example, with color per vertex.
- Remove duplicate shading networks.
Hardware Shaders
These are coding tips for hardware shader plug-in writers.
- Do not push and pop all GL attributes if not required. This is more expensive than pushing specific attributes.
- If you’re only using hardware shaders in the scene view, we recommend that you use the older API: geometry(), bind() and unbind().
If you also want to batch render your hardware shader, we recommend you use the newer API: glGeometry, glBind and glUnbind.
- We recommend you cache all node attributes as internal. The example plug-ins hwColorPerVertex, hwPhongShader and the cgFxShader
all do this. Non-cached values are very expensive to evaluate and can double the draw time.
- Avoid using complex attributes (structures and arrays).
- If the output color on the shader is not important, do not make any attributes affect it. This causes additional computation
as marking one attribute dirty causes a recomputation to derive the dependent one.
- The compute() method can be left empty if not required. The simpler the method the better. You will not see swatches if you do not compute the output color.
- Do not post-normalize tangents in the plug-in. This is done for you.
- Data sent via the geometry calls are read-only and are cached internally. Do not modify the values.
- Use simple data structures (versus Maya API objects) for simple data. For example, use float3 versus MFloatVector. There is
a performance overhead due to the interfaces used in OpenMaya.
- Take advantage of methods available on M3dView. OpenGL state is cached internally and can give better performance than using
beginGL(), endGL() and direct calls to OpenGL.
- Use glDrawRangeElements to draw with. This is the API recommended by the card vendor for drawing with the geometry arrays
passed to the hardware shader.
- Make sure to set the hasTransparency() return value appropriately. Setting it to true causes Maya to draw an object twice
(once culling front faces, once culling back).
- Take into account the current display state in M3dView. For example, don't disable lighting if the display mode is .
- When transparency is enabled, framebuffer blending is already enabled. You do not need to enable it again.
- Take advantage of the new method: MPxHwShaderNode::currentPath() to send the appropriate information for attribute query methods
(for example, getTexCoordSetNames()).
- Test which parameters on color/alpha and depth mask are enabled for interactive and especially for hardware rendering. They
can give hints as to how to draw a simpler version of the geometry.
- For the Hardware renderer, the plug-in can be called multiple times. The general sequence is usually: depth pass, [lighting
pass[es]], color pass, [shadow map pass], [alpha pass], [depth pass]. Items marked with braces “[“ “]” are optional and dependent
upon the number of lights in the scene, whether shadows are enabled for those lights, and whether alpha and depth output images
are specified in the Render Settings.
- Use the new option which is available per object (NURBS or polygonal surfaces). This is available in the in the section and as a new option in the menu. Use to make the hardware shader not show up on the object, or use to restore the default state of showing the shader. This allows users of the plug-in to selectively disable shader display
for performance reasons.
Memory
- Unlimited undo queue takes more memory than a limited undo queue. The default queue is set to 50 in the window.
- Take advantage of large address awareness on Windows XP up to 3 GB.
- Use instancing when possible. This includes geometry, materials, textures, lights, and so on.
- Parallel memory copy may, in some cases, improve speed for Opterm or Nehalem systems. However, it can also potentially slow
down Xeon systems. Use MAYA_NO_PARALLEL_MEMCPY to disable parallel memory copy if you find that your speed has been impacted.
Note, however, that there are other factors that may affect speed in Maya, such as your scene complexity and workload.
IK, Dependency Loops, and Performance
- After loading a file, a wait cursor may come up and Maya will use all available CPU cycles for a long time (several minutes
at least). This problem seems to occur in files that have IK and dependency loops.
The ideal workaround is to find and remove the dependency loop. These loops may be difficult to find. For example, A may be
translated by a pointConstraint B that uses target C that has a parent D that is rotated by an expression E that has an input
from F that is constrained to G which is a child of A. One hint is to look for expressions that have outputs to attributes
on many different nodes.
That is, some complex scenes take a long time to evaluate, and you could encounter this when loading a file.
The Polygon Draw Cache
- In Maya, the use of a polygon draw cache usually improves speed and performance. However, when loading certain very large
files in Maya, the polygon draw cache may cause the memory usage of Maya to exceed the memory available to the application
on your system, resulting in instability.
(Note: The 64-bit version of Maya on Windows and Linux provides enough memory space that this issue should not arise.)
If you encounter this problem using Windows XP on a 32-bit system, we suggest you increase the application memory limit of
Maya; for instructions on how to do this, see Set Maya to use maximum memory (increase the Virtual Memory limit).
You can also disable the polygon draw cache so that you can more easily load very large files. There is an environment variable
called MAYA_DISABLE_POLYGON_DRAW_CACHE. Set it to 1 to disable the polygon draw cache.
If you disable the polygon draw cache, interactive draw performance will be slower. We recommend that you not leave this environment
variable set to 1, but instead set it only for working on files that show this problem.
Animation
- Use Edit Deformers > Prune Membership commands to remove components that aren’t affected by the deformer.
Audio
- When using imported audio files in Maya, it is inadvisable to have background applications running that use audio capabilities.
Running other applications that use audio may cause Maya to hang.
Fur
- Lowering the value for the hairs significantly increases interactive draw speed, but makes it less easy to preview , or .
- Since are expensive to render, don’t use more than you need. Autoshading is free and can provide an acceptable alternative for
some lights when using the renderer.
Miscellaneous
- On Windows, fragmented hard drives can cause serious performance issues. We suggest you defragment regularly and thoroughly
with a dedicated application. Standard tools offered by the operating system are often not sufficient to gain performance
benefits.
- Take advantage of file referencing. For more information, see About file referencing.
- Become very familiar with Window > Settings/Preferences > Performance Settings.
- Use File > Optimize Scene Size > to remove unused scene data.
- Returning to Maya after a screen saver has been activated can, with some old or low-end graphics cards, cause selection marquees
or panel contents to disappear.
Press the space bar or use the menu to change the current panel configuration. All panels should now be drawing normally. To return to your previous configuration,
either press the space bar again, or select the appropriate entry from the menu.
- The cycle checking that happens during attribute evaluation may miss a cycle in which incoming connections on a DAG node form
a cycle that includes any of the worldspace attributes on its child nodes. The MEL command cycleCheck NODE can be used to detect these cycles if you suspect this to be the case.
Modeling
- Use the attribute on polygons.
- Use to simplify complex geometry. Polygonal models that don't have the following will display faster: unshared normals, unshared
texture coordinates, unmapped faces, and faces that are not triangles (not triangulated).
Dynamics
- Use the attribute on rigid body geometry.
- When starting or setting up a simulation, start with less geometry on particles.
Classic Cloth
- Turn off collisions for the initial setup and testing of a simulation.
- Animate settings like and to improve solve time.
- Solve in batch mode.
Rendering
- Use for hints on improving performance. See Maya render diagnostics for more information.
- Remove duplicate shading networks.
Artisan
- Increase if possible ( section of settings editor).
- Use if possible ( section of settings editor).
Paint Effects
- Lower the in the settings editor.