Using the material index pass in Blender

In this one minute video we take a look at an example of using the material ID feature in Blender. The material index allows us to generate a mask of a certain material in order to do post processing to that particular material later on.

Written tutorial:

The material index pass can give you post-render control of how different elements appear in your render. In this example we want to be able to tone the sesame seeds on top of this burger. Let’s begin by going to the material settings and assigning the material a pass index number other than zero. Next we’ll head over to our render layers and enable the material index pass. We’re now ready to render our image.

Now that the render has finished, let’s open up a nodes window and select the compositing nodes. Let’s enable them, and also activate the backdrop. Now we should add a viewer node and connect the render layer image output to it in order to see what’s happening with the image.

We can see the material ID socket here because we enabled that pass in the render layer settings. Now in order to get the mask for our sesame seeds, we simply need to add a material ID node and set it’s index to the same number we assigned for our material, in this case 1. We’ll connect the input of the ID mask to the material index socket of the render layer.

Now we can use this for the factor value, in order to mix a color corrected version of the seeds together with the original image.

Let’s begin by adding an alpha-over node, and connecting it to the composite and viewer nodes. Then we’ll take our original rendered image and plug it into the top socket. Now let’s take the ID mask nodes output and connect it to the factor of the alpha-over node. Finally we’ll add a curves node for the color correction, connect our original image to it and take the output to the bottom socket of the alpha-over node. As a result the curves will only affect the sesame seeds. Let’s give them a warmer tone by pulling down the blue curve.

That’s how easy it is to use the material ID pass for better post-render control of your image!

Thanks for watching and see you next time on One Minute Video

Leave a Reply

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