Mantra Auto Per Light Bundle Exports

Setting up passes for your render can be a pain especially if you want per light bundle exports. Houdini does not support this by default (as far as I know) and making a tool that does this has always been something I wanted to do. Recently I achieved that result using SOHO (Script Output of Houdini Object) and a custom version of the Mantra node.

A screenshot of the Auto Planes Setup in Houdini

Today I just want to explain it, later I will upload a completed version of it to our git.

I started with the wanting to achieve a few things when creating a version of the Mantra node. 

  1. Automatic Per Light Exports
  2. Per Light Exports that respect bundle groupings.
  3. Allow for the AOVs to be dumped into another file.
  4. Allow it to work with a Vanilla Mantra node.

Luckily 1 and 3 were already almost complete as Houdini Supports per like exports and dumping AOVs to another file. The problems really like with 2 and 4. Exporting a pass per light is possible, exporting a pass per light bundle is not. This has surprised me as I love light bundles because it allows me to group a bunch of lights under "KEY" or "FILL" and expecially in a large scene with 10+ lights I do not want a pass for each light per component as that could mean 20-50 different layers and that is a little much to manage.


Create Custom Render Parameters and use SOHO to export predefined passes during IFD Generation.

Screenshot of my default passes

First I needed to define some passes. I did this inside of a yaml file. In there I defined a number of attributes per pass including whether it supported light exports.

Next I created the Custom SOHO Parameters. There is not a lot of documentation on this but its as simple as create a file that defines from render properties. I have to do this because when the IFD generation occurs on render parms are attainable (easily) .

Finally, I had to create a IFD hook that ran after the default plane generation, during this hook I also set it up so it exports out AOVs (seperated into DATA and LIGHTING) to a different file. I just prefer that workflow. Addtionaly I take this moment to group the lights by their light bundles. If the light does not have a bundle just my a layer with its own name. This ensure that bundle groups will be respected but they can be mixed with non-bundled lights.