# Render Mask in Blender

**URL:** <https://forums.chaos.com/t/render-mask-in-blender/55062>\
**Category:** Tutorials, Tips & Tricks\
**Created:** [August 26, 2015, 11:10am UTC](https://forums.chaos.com/t/render-mask-in-blender/55062 "2015-08-26T11:10:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrys](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@mrys](https://forums.chaos.com/u/mrys)\
**Post date:** [August 26, 2015, 11:10am UTC](https://forums.chaos.com/t/render-mask-in-blender/55062/1 "2015-08-26T11:10:59Z")

</div>

In Max/vray exist cool feature Render Mask. Is it possible to use it in Blender vray?

---

<div class="post-metadata">

**Author:** ![bdancer](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/bdancer/32/52257_2.png) [@bdancer](https://forums.chaos.com/u/bdancer)\
**Post date:** [August 27, 2015, 12:15pm UTC](https://forums.chaos.com/t/render-mask-in-blender/55062/2 "2015-08-27T12:15:31Z")

</div>

\> Is it possible to use it in Blender vray?

Now yes: [https://github.com/bdancer/vb30/commit/475b9763073a788f83902defacc171965e49b4ff](https://github.com/bdancer/vb30/commit/475b9763073a788f83902defacc171965e49b4ff)

“[Update exporter](https://github.com/bdancer/vb30/wiki)” will help.

---

<div class="post-metadata">

**Author:** ![JuhaW](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/juhaw/32/39103_2.png) [@JuhaW](https://forums.chaos.com/u/JuhaW)\
**Post date:** [August 28, 2015, 4:11am UTC](https://forums.chaos.com/t/render-mask-in-blender/55062/3 "2015-08-28T04:11:40Z")

</div>

This is nice feature indeed, I tested it supports many object ID’s at the same time like “1,5,10”. Good thing is that you can mix masked/normal images inside Blender because VFB does not support that yet 🙂  
Thank you and remember 3dmax system also (selected objects) 🙂

---

<div class="post-metadata">

**Author:** ![mrys](https://avatars.discourse-cdn.com/v4/letter/m/51bf81/32.png) [@mrys](https://forums.chaos.com/u/mrys)\
**Post date:** [August 28, 2015, 6:04am UTC](https://forums.chaos.com/t/render-mask-in-blender/55062/4 "2015-08-28T06:04:30Z")

</div>

Thanks a lot bdancer! Working as a charm! Max’s “selected object” option would be also cool, but with object ID available it is not problem.

---

<div class="post-metadata">

**Author:** ![JuhaW](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/juhaw/32/39103_2.png) [@JuhaW](https://forums.chaos.com/u/JuhaW)\
**Post date:** [August 29, 2015, 1:46pm UTC](https://forums.chaos.com/t/render-mask-in-blender/55062/5 "2015-08-29T13:46:07Z")

</div>

Little script to render mask only selected objects. Just set render mask type to Object ID, select objects and run the script.

> import bpy  
> index = []  
> ID = 32767  
> for o in bpy.context.selected\_objects:  
> &nbsp;&nbsp;&nbsp;&nbsp;index.append(o.pass\_index)  
> &nbsp;&nbsp;&nbsp;&nbsp;o.pass\_index = ID
> 
> bpy.context.scene.vray.SettingsImageSampler.render\_mask\_object\_ids = str(ID)  
> bpy.ops.render.render()
> 
> c = 0  
> for o in bpy.context.selected\_objects:  
> &nbsp;&nbsp;&nbsp;&nbsp;o.pass\_index = index  
> &nbsp;&nbsp;&nbsp;&nbsp;c += 1

---

<div class="post-metadata">

**Author:** ![JuhaW](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/juhaw/32/39103_2.png) [@JuhaW](https://forums.chaos.com/u/JuhaW)\
**Post date:** [August 29, 2015, 1:47pm UTC](https://forums.chaos.com/t/render-mask-in-blender/55062/6 "2015-08-29T13:47:48Z")

</div>

Render mask script for selected objects: [http://www.pasteall.org/60832](http://www.pasteall.org/60832)
