0
$\begingroup$

I am a beginner at blender. I have 5 cylinders present on the field in the shape of a plane, like this one:

enter image description here

I have 100 images in which the cylinder's shape and position are randomized. I want to create masked images for these 100 images. How can I do it?

I want to make the cylinders black and the field white. I need the script for this. I use Blender 3.6. I don't know which version is the most stable.

https://drive.google.com/drive/folders/119GOLnLHm-tOC8qaQGbqsMVIvXosclq4?usp=sharing

$\endgroup$
0

1 Answer 1

2
$\begingroup$

No scripting is required.

Cycles

First set pass index for plane and cylinders. Let say field will be 1, cylinders will be 2:

enter image description here

On view layer tab enable Object index:

enter image description here

In compositor window enable use nodes:

enter image description here

Use ID mask node to get right mask (note 0 is background, 1 and 2 the objects that we just assigned):

enter image description here

You can save mask from image editor, or use file output node to save file automatically then the scene is rendered

enter image description here

EEVEE (works with cycles also)

For EEVEE you can use cryptomatte pass instead. Enable cryptomatte pass in Layer tab:

enter image description here

Then in compositor window pass pick output of cryptomatte node in viewer (you have to enable backdrop feature to have picture at background):

enter image description here

Then click "+" icon and pick on plane (name of the object will be added)

enter image description here

Then you can use mate output to save as mask

enter image description here

$\endgroup$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .