How can I specify an area to render based on mask image in Cycles? I'm currently working on an online configurator with 3D preview. The kind of tool you often see for cars.

I need to render hundreds materials for small portion of image which are not rectangular.

Is there a way to speed up render ?

Solutions I see so far :


give an image to be used as a mask, it would be usefull as a greyscale that define the number of samples we want, I fear this option does not exists and require to tweak the source code
mask areas that does not require rendering with a 3D object on front of camera that use some kind of "black hole" matter that will be blazing fast to render, but I don't know how to create this matter.


Do you see any other ways to achieve this ?
Yes, a Holdout shader is what you're looking for. I frequently use this technique when I want to re-render part of a scene and composite it into a previous version.

Your second idea of a mesh in front of the camera is exactly what I do. You can put a plane in front of the camera and make a hole in it whatever shape you need. Give the plane a Holdout shader, and everything behind it will be totally ignored. It'll only render what you can see though the hole. The hole can be any shape you want.