2

How to change current renderer in maya by python commands. for example : "maya software" to "mental ray" or vice versa any python or pymel command.?

import pymel.core as pm
import maya.cmds as cmds
Rajiv Sharma
  • 6,746
  • 1
  • 52
  • 54

1 Answers1

6
import maya.cmds as cmds

Switch to mental ray

cmds.setAttr("defaultRenderGlobals.currentRenderer", "mentalRay", type="string")

Switch to maya software

cmds.setAttr("defaultRenderGlobals.currentRenderer", "mayaSoftware", type="string")
Rajiv Sharma
  • 6,746
  • 1
  • 52
  • 54
  • How do I save the rendered image to a jpeg format using python? – Lily Apr 30 '17 at 01:49
  • 1
    import pymel.core as pm rendernode = pm.PyNode('defaultRenderGlobals') rendernode.setAttr('imageFormat', 8) – Rajiv Sharma Apr 30 '17 at 05:02
  • if you want to convert image format through python than go with FFmpeg https://ffmpeg.org/ – Rajiv Sharma Apr 30 '17 at 05:04
  • What are the different numbers for the imageFormat? I noticed that people usually use 51 which is exr – Lily Apr 30 '17 at 08:02
  • I also noticed that when I save the image using python by pm.render() the resulted image is much darker than if I saved it using Maya GUI. Is there a way to get the same result as Maya GUI? – Lily Apr 30 '17 at 08:15