coverage pass

   4051   3   1
User Avatar
Member
72 posts
Joined: 7月 2006
Offline
Hello again,

Does mantra have a pixel filter or default AOV to generate a coverage pass or does that have to be done in a shader?

Cheers

John
john @ hydrastudios
User Avatar
Member
41 posts
Joined: 3月 2008
Offline
I' m bumping this two year old post as I actually also need some insights on how to get a coverage pass. I have to provide the comper with both that layer and ObjectID.

Rbg mattes would be an option if there was a way to automate the process for a scene with 200+ objects.

Any tips ?
User Avatar
Member
1390 posts
Joined: 7月 2005
Offline
br1
Rbg mattes would be an option if there was a way to automate the process for a scene with 200+ objects.
Any tips ?

Python IFD filtering with custom shader:

import sys, mantra
type = sys.argv

def filterInstance():
print ‘Filtering:’, mantra.property('object:name')
mantra.setproperty('object:surface', ‘opdefShop/rgbPass type %s’) % type

Say you save it as ifd_filter.py and call render with -P, like:

mantra -f myframe.ifd -P “/path/ifd_filter.py 1”

You need a shader called rgbPass installed in Houdini. It might look like this:

surface
makeRgbPass(int type=0)
{
int id;
if (!renderstate(“object:id”, id)) id = -1;

if (!type) Cf = id;
else Cf = hsvtorgb(set(random(id), 1, 1));
}

When run with type == 1, it generates a random color based on object's id, otherwise unnormalized id. Some work has to be done to stratify values to avoid overlapping colors. Perhaps hard coded values indexed with ids would be better option.

hth,
skk.

ps code untested…
User Avatar
Member
575 posts
Joined: 11月 2005
Offline
thanks SYmek,

have to look at that ifd filtering, looks very powerful

Martin
  • Quick Links