Maya Tips & Tricks: Subdivision Levels
Staff Writer By: Kurt Foster (Modulok)
In Autodesk Maya, with a polygon object selected, users can press the hotkeys 1, 2, 3 to show the base mesh, a subdivided caged version or the fully smoothed version of a model. This is all newbie stuff. Prior to rendering most users press 3 on their meshes so the renderer sees a smooth version of a model. We can do better...
For every polygon object's shape node in the Attribute Editor, there is a section called SmoothMesh -> Subdivision Levels. If you turn off Use Preview Level For Rendering, you can enter a custom subdivision level for Render Division Levels. You now have independent control over how dense your mesh is in the interactive viewport vs. how dense it is when you render it.
Adjust the rendering subdivision level independent of the interactive viewport display subdivision level.
Using this for tweaking individual objects that need just a little extra subdivision is great! You can also do this scene-wide with the following bit of Python code. You could place this on the shelf or assign to a hotkey:
import pymel.core as pm meshes = pm.ls(type='mesh') for mesh in meshes: try: mesh.setAttr("useSmoothPreviewForRender", False) mesh.setAttr("smoothLevel", 1) mesh.setAttr("renderSmoothLevel", 4) pm.displaySmoothness(mesh, polygonObject=3) except RuntimeError: pm.warning("Couldn't set properties on '%s'. Skipping..." % mesh)
Of course, this script could be made to be more robust in the event of failure, locked attributes, incoming connections, etc by providing debugging data, trying one attribute at a time, etc. Such is the price we pay for easy online tips!
I hope this tip helps somebody out there somewhere! Good luck!