Changing the render setting in Maya is straight forward, you can change the Hardware renderer very easily using Maya Render settings Window as you could see in the below image.
But, how do you achieve the same thing using script code?
If you execute the following code, you will see that Maya renders using "Maya Software".
mel.eval('render -x 600 -y 800 "Render_Cam"')
or the same code as just MEL, Maya still renders using "Maya Software". In addition to the above code, the below python code is an attempt to change the renderer.
cmds.setAttr('defaultRenderGlobals.ren', 'mayaHardware2', type='string')
mel.eval('loadPreferredRenderGlobalsPreset("mayaHardware2")')
But Maya still renders using "Maya software". The problem is, we have to set the current renderer. The following MEL commands will change the current renderer to Hardware Renderer 2.
setCurrentRenderer "mayaHardware2";
setAttr hardwareRenderingGlobals.renderMode 2 ;
Comments
You can follow this conversation by subscribing to the comment feed for this post.