I got a little inspired by this and starting coding something to make it a little more useful for myself so I thought I’d share (attached). I usually generate mattes based on materials (matID) rather than g-buffer so that was my first addtion. So as it stands right now here’s what it’s got so far:
- You can generate mattes based on either the g-buffer ID (unlimited) or the MatID (max 15) of the current selection. I included the checkbox for the first 15 materials as a worst case when you know the material is one of the first objects selected. Normally it’ll pop up a message telling you how many materials (including multi/sub materials) you have selected and tell you to revise your selection.
- The Mattes are generated using all three channels (RGB) and the channel name is generated from either the object names or the material names.
- The “Select and group all instances” checkbox will (duh) select all instances if any in your selection and group them under a common g-buffer ID and channel. Otherwise instanced objects each get their own separate channel (this was getting a little crazy for large scenes). Keep in mind this will select all instances of any selected objects whether or not you have them as part of your selection. With this you can get similar results to the MatID output but using g-buffers.
- The render element prefix just adds a prefix to the render element in addition to the material or object name if you want it.
The code is really, really rough and hasn’t been thoroughly tested so use at your own risk, etc, etc. There’s probably better/faster/cleaner ways to do what I did but it gets the job done. Apologies to Neil Blevins for some of the lifted functions and you’ll also need the Neil/BlurScript library functions (BSLib.ms) for it to function correctly. Run the script and it’ll be under “dPict Tools”-->“MultiMatte Generator” in the customize user interface dialog.
Let me know if any of you have any problems or see where it could be improved.
EDIT: I noticed there was a necessary function for the MatID to work properly that wasn’t part of the script. I updated the attached script.
MME Generator v1.0.zip (2.16 KB)
