RGB Object&Material ID Node

  • May 23, 2016
  • 92 Downloads
  • 1 Like
  • Blender 2.7x
  • Render: Cycles
  • Creator: CreativeHacker
  • License: CC-BY
You must be logged in to download.

Description:

I made a Node tree for exporting Material and Object ID passes as a flattened RGB image for compositing in After Effects, because i could not figure out an easier way to do this using open EXR which i thought would work but does not seem to.

Hope this is useful to some.

Append the ID Mask Combine Node group to your scene and just plug in your Object or Material ID pass into the node,

IT supports up to 10 different object/material index inputs and flattens it into an RGBA Image

Comments:

  • CreativeHacker profile picture
    CreativeHacker

    like what?

    exporting each ID index out as a separate layer means you get 1 file for each item the way I have it here you get one file for all IDs as Different colours to generate masks from,

    Written June 02, 2016
  • MZiemys profile picture
    MZiemys

    I just checked it again to make sure I understood it correctly. It certainly seems I did. You get one image with all the masks in different colors here. The same way some other renderers do it. Like for example Maxwell. In order to achieve it you take IDMask nodes for all the IDs you have and then color them using ColorMix nodes with ColorRamps connected there and set to output one color each, then you take the results and put them all on top of each other. It works. However, it would be far more efficient to use just one ColorRamp node instead of so many. IndexOB from Rander Layers node is basically an array of images indexed by integer numbers starting from 1. You could imagine ColorRamp as an array of single color images as well it's just that its index is in between 0 and 1. So, if you multiply IndexOB by 0.1, IDs of 1, 2, 3... become 0.1, 0.2, 0.3... and that matches what ColorRamp takes as input, so you plug it there and that is it, you get all the colors in the ramp at positions 0.1, 0.2, 0.3... matching the masks 1, 2, 3... As in the picture from my first post. If you needed the alpha for the background for some reason, you can just take it from the RenderLayers node and plug it where you want it, but do you really need an alpha for an image of all alpha masks? :D That's another question. Anyway, this would be a cleaner way of doing it. I used to use this a lot, but I now save all the masks to separate files - as with all the different colors you may get masks not as accurate and I started getting bad results with edges.

    Written June 02, 2016
  • CreativeHacker profile picture
    CreativeHacker

    Good point i will rework it, Still wish they had a better index ID output as a single file using OpenEXR or something , The only reason i do this is for other people to use so they dont need to download many different Masks, it works alright but I also need to make a clearer difference between the colour.

    Written June 05, 2016
  • MZiemys profile picture
    MZiemys

    Actually, Multilayer OpenEXR does support it. You can output different alphas as separate layers to one file using File Output node. However, Adobe does not seem to support it. There are plugins for that, like the one I just googled - http://www.fnordware.com/OpenEXR/ but I have not tried that. I think it might be even free for After Effects. In some cases using separate black and white masks might increase the quality of your final images quite a bit so this might be worth checking out. Well ...if it's of interest to you.

    Written June 05, 2016
  • CreativeHacker profile picture
    CreativeHacker

    I would normally output separate masks generally because there is normally just one or two anyway, I am thinking more along the lines of a smaller set of files for people to just be able to rip of vimeo or youtube and material index using colours was just a way to bring down several layers to just 1 how they use it is up to them and yes quality is not always ideal but for what I have in mind it does the trick.

    Written June 22, 2016
  • CreativeHacker profile picture
    CreativeHacker

    well I have now simplified it into 2 nodes now Hahaha that was pretty over complicated of me.

    Written June 22, 2016