Region Render (Part 1)

So I oftentimes have to render at ridiculously large sizes for print, which is time and resource consuming. And sometimes, I make little mistakes (I admit it!). Little mistakes… not enough to require me to render the entire huge image again, but enough that I need to render out just a small section. Of course when you’re doing test renders in Maya in the Render View window, there’s a built in render region tool where you can draw a red rectangle directly on the image and Maya will render only what’s within its bounds. But if you want to render that small region of the full size image– well Maya doesn’t actually make that very easy!

If you dig around in the Maya user manual, you’ll (eventually) find this page: http://download.autodesk.com/global/docs/maya2014/en_us/index.html?url=files/Vari_Render_a_region_of_your_scene.htm,topicNumber=d30e689212

Helpful, but not what we need!

Ah, here we go:

http://download.autodesk.com/global/docs/maya2014/en_us/index.html?url=files/Vari_Command_line_rendering.htm,topicNumber=d30e686677

I don’t use command line rendering, so I’ll develop with the second ‘mental ray render globals attributes’ methodology. Note that regionRectX refers to the left-most pixel of your render rectangle, and regionRectY refers to the bottom-most pixel. (Remember your Cartesian coordinates, children! We’re in Quadrant 1, hehe.) Now here, regionRectWidth refers to the WIDTH of the region rectangle, and regionRectHeight to the HEIGHT of the rectangle. It’s a bit odd in that you’d expect them to be the right-most and top-most pixels, respectively. But that’s not what’s happening here.

So we need to create the attributes. This is pretty easy; select the mentalrayGlobals node, then add the attributes. You can do this the hard way:  go to Modify –> Add Attributes –> blah blah, type type, that’s not what we’re here for! We’re here to script, so here it is:

//adds render region attributes
addAttr -ln "regionRectX"  -at long  mentalrayGlobals;
setAttr -e-keyable true mentalrayGlobals.regionRectX;

addAttr -ln "regionRectY"  -at long  mentalrayGlobals;
setAttr -e-keyable true mentalrayGlobals.regionRectY;

addAttr -ln "regionRectWidth"  -at long  mentalrayGlobals;
setAttr -e-keyable true mentalrayGlobals.regionRectWidth;

addAttr -ln "regionRectHeight"  -at long  mentalrayGlobals;
setAttr -e-keyable true mentalrayGlobals.regionRectHeight;

Leave a Reply

Your email address will not be published. Required fields are marked *