Jordan Walsh Posted August 27, 2012 Share Posted August 27, 2012 Is it possible to output an image plane for each object containing that object's alpha? I can easily do it on a per shader basis but Im not sure of the best way to do this on an object basis where the shaders are shared. Perhaps some type of local override for a shader parameter and then build the parameter into every shader in the scene? I usually do this in 3dsmax/Maya with the use of object ID's and the Vray Multi Matte render element. Any tips of a good workflow for this? Quote Link to comment Share on other sites More sharing options...
Stalkerx777 Posted August 27, 2012 Share Posted August 27, 2012 Is it possible to output an image plane for each object containing that object's alpha? I can easily do it on a per shader basis but Im not sure of the best way to do this on an object basis where the shaders are shared. Perhaps some type of local override for a shader parameter and then build the parameter into every shader in the scene? I usually do this in 3dsmax/Maya with the use of object ID's and the Vray Multi Matte render element. Any tips of a good workflow for this? Does Vray Multi Matte outputs antialiased pixel data? If so, that's imposible to do in houdini without you own custom shader. You can have ID's for free in mantra, but without antialiasing. This is "Prim ID" image plane. But this image plane is pretty usless in compositing, so i suggest you to add masks in your shader. Quote Link to comment Share on other sites More sharing options...
Jordan Walsh Posted August 28, 2012 Author Share Posted August 28, 2012 Does Vray Multi Matte outputs antialiased pixel data? If so, that's imposible to do in houdini without you own custom shader. You can have ID's for free in mantra, but without antialiasing. This is "Prim ID" image plane. But this image plane is pretty usless in compositing, so i suggest you to add masks in your shader. Yeah, Vray gives you antialiased data so they are perfect for comp. Thanks for the info. Quote Link to comment Share on other sites More sharing options...
zephyr707 Posted April 28, 2013 Share Posted April 28, 2013 Does Vray Multi Matte outputs antialiased pixel data? If so, that's imposible to do in houdini without you own custom shader. You can have ID's for free in mantra, but without antialiasing. This is "Prim ID" image plane. But this image plane is pretty usless in compositing, so i suggest you to add masks in your shader. how would you go about doing this in your own custom shader? I've always wondered about the object ID pass workflow for overlapping objects. The lack of antialiasing seems to make it useless, but maybe I'm missing something. 1 Quote Link to comment Share on other sites More sharing options...
anim Posted April 28, 2013 Share Posted April 28, 2013 just create export parameter in your shader with name you like for example object_id (and add it to image planes in mantra) then in each of your object create attribute called the same with the same type and assign different value per object what works best is to create Vector4 attribute since then you can have 4 different object groups (red, green, blue, alpha) so {1,0,0,0}, {0,1,0,0}, etc in that case you'll get perfect antialiasing between them as you can separate it per channel in comp to create more object groups just add another variable export like object_id2 etc you can of course export just float variable and assign values like 0, 1, 2, ..., but that will create problems in antialiasing where any 2 non neighbour ids overlap (like 0 and 3, since interpolated value will go through 1 and 2) 3 Quote Link to comment Share on other sites More sharing options...
zephyr707 Posted April 28, 2013 Share Posted April 28, 2013 hey hey tomas, good to hear from you dude, thanks for the advice. yes, i've done this before, and it worked great for non-overlapping objects, but i always had an edge problem with overlapping objects. Tried different pixel filters and unpremulting, shuffling, etc. Could be I just don't know how to composite/use as a mask correctly Also, my export plane (i called it tag) has an alpha of 0.998 which is due to the gaussian filtering, but I'm not sure why. Af pass as well. Normally I render out individual objects with matte shading and composite the renders id_pass.hipnc 1 Quote Link to comment Share on other sites More sharing options...
zephyr707 Posted April 28, 2013 Share Posted April 28, 2013 with no aa filtering it works great, so i've always just assumed it was the filtering... Quote Link to comment Share on other sites More sharing options...
anim Posted April 28, 2013 Share Posted April 28, 2013 hi Alex, the 0.9998 value seems to be 1 if you use 16bit float, which I use by default so I never faced that problem here is the example of the object_id variable 1 shader and 4 objects each object has object_id attribute with different value which gets picked by the shader when you render and look at object_id image plane you will have 4 masks that can be isolated by looking at red, green, blue or alpha channel, they should have exactly the same filtering as the objects in beauty pass actually in my opinion this is the only way how to avoid edge problems since you keep objects in different channels, at least the only one I can count on usage in compositing is pretty straightforward, you simply extract one of the channels and use as a mask object_id.hipnc 3 Quote Link to comment Share on other sites More sharing options...
Jordan Walsh Posted April 28, 2013 Author Share Posted April 28, 2013 So I have been using this setup for a little bit and its been working great. I just add a Matte01 parameter in the shader then use local material overrides on the different objects to set the value (for up to 4 objects). Is there a way to add a local override or set up some system that lets me change the name of the parameter to Matte02, Matte03 etc. procedurally? I find I've only needed up to matte04 a few times but its a bit of a pain to have to add new parameters in the shader. Quote Link to comment Share on other sites More sharing options...
zephyr707 Posted April 29, 2013 Share Posted April 29, 2013 hi Jordan, perhaps a simple solution would be to just have the extra Matte0# parameters in the shader by default? you may not use all of them, but it saves you from having to add new parameters in the shader, just need to add the image plane exports in the rop if you used them. So I have been using this setup for a little bit and its been working great. I just add a Matte01 parameter in the shader then use local material overrides on the different objects to set the value (for up to 4 objects). Is there a way to add a local override or set up some system that lets me change the name of the parameter to Matte02, Matte03 etc. procedurally? I find I've only needed up to matte04 a few times but its a bit of a pain to have to add new parameters in the shader. Quote Link to comment Share on other sites More sharing options...
zephyr707 Posted April 29, 2013 Share Posted April 29, 2013 ah thanks, i made the example in haste and didn't change the defaults. don't understand the <1 value for gaussian, it is 1 for catmull-rom. nice example, can do a lot with local material overrides if you can accomplish everything with the single shader. it's true, the object_id pass does have the same filtering, but for overlapping objects I find that it is still a problem. exactly what i'm doing, just using the object_id color pass as a mask for grade/colorcorrect, etc, but I still get an edge when it overlaps objects. tried to get rid of it and I can't figure it out. Granted I'm really pushing the gain it to expose the problem, so it works for most adjustments, the results are just never as good for me as rendering out each object with others as matte shaded and using disjoint-over in nuke. It definitely works for most purposes though and it is very straightforward. hi Alex, the 0.9998 value seems to be 1 if you use 16bit float, which I use by default so I never faced that problem here is the example of the object_id variable 1 shader and 4 objects each object has object_id attribute with different value which gets picked by the shader when you render and look at object_id image plane you will have 4 masks that can be isolated by looking at red, green, blue or alpha channel, they should have exactly the same filtering as the objects in beauty pass actually in my opinion this is the only way how to avoid edge problems since you keep objects in different channels, at least the only one I can count on usage in compositing is pretty straightforward, you simply extract one of the channels and use as a mask hi Alex, the 0.9998 value seems to be 1 if you use 16bit float, which I use by default so I never faced that problem here is the example of the object_id variable 1 shader and 4 objects each object has object_id attribute with different value which gets picked by the shader when you render and look at object_id image plane you will have 4 masks that can be isolated by looking at red, green, blue or alpha channel, they should have exactly the same filtering as the objects in beauty pass actually in my opinion this is the only way how to avoid edge problems since you keep objects in different channels, at least the only one I can count on usage in compositing is pretty straightforward, you simply extract one of the channels and use as a mask 1 Quote Link to comment Share on other sites More sharing options...
slamfunk Posted May 2, 2013 Share Posted May 2, 2013 Was just thinking about how to go about this in Houdini today, as we've been using Object ID passes from V-Ray in production, and I find two good friends discussing it over here. Quote Link to comment Share on other sites More sharing options...
slamfunk Posted May 2, 2013 Share Posted May 2, 2013 Hey Alex how bad is this edge you are talking about? Screengrab? Quote Link to comment Share on other sites More sharing options...
anim Posted May 2, 2013 Share Posted May 2, 2013 using this method will give you exactly the same masks (same filtering etc) as you would get by using constant shader on desired object matted by everything else (and certainly much better than roto), so any compositing problems should be solvable in comp or at least produce the same results but it's logical that at the filtered border where more objects mix together you cannot separate just one from the another completely by the mask, the mask only contains the same contribution to the pixel as the object it belongs to so any operation masked by it will alter the whole value of border pixels, just with the smaller intensity and I suppose you are compositing in linear color space Quote Link to comment Share on other sites More sharing options...
slamfunk Posted May 2, 2013 Share Posted May 2, 2013 ok cool, that's all I was hoping to hear Quote Link to comment Share on other sites More sharing options...
Jordan Walsh Posted May 3, 2013 Author Share Posted May 3, 2013 So back to the idea of getting multiple mattes in shaders procedurally... can I use a for loop in the shader then chuck a parameter node in there and get the parameter name to change based on the for loop iteration? Quote Link to comment Share on other sites More sharing options...
zephyr707 Posted May 4, 2013 Share Posted May 4, 2013 hey hey, good to hear from you billy. it is exactly as tomas describes, the mask of the object_id pass exactly matches the alpha if you were to render everything else matte shaded. the overlapping filtered border is where the line manifests itself. granted, it is only very noticeable if you push it in comp to the point where you would probably be best re-rendering anyways. certainly easier and faster than creating a bunch of passes with each object matted by the others. Was just thinking about how to go about this in Houdini today, as we've been using Object ID passes from V-Ray in production, and I find two good friends discussing it over here. Quote Link to comment Share on other sites More sharing options...
zephyr707 Posted May 4, 2013 Share Posted May 4, 2013 hey jordan, take a look at the attached cobbled together example where the matte* parameters are declared in the shader (up to matte04). probably not best to put the id on the point attrib, but it was the fastest to get the example going. procedurally changing parameter names on the fly might work, but i think declaring your spare parameters in the shader is much easier and, as far as i know, doesn't negatively affect performance in any significant way. you only export the planes you use. it would be cool to see a procedural method, though. So back to the idea of getting multiple mattes in shaders procedurally... can I use a for loop in the shader then chuck a parameter node in there and get the parameter name to change based on the for loop iteration? matteID.hipnc Quote Link to comment Share on other sites More sharing options...
tricecold Posted July 8, 2013 Share Posted July 8, 2013 This is what I was looking for and thanks for the information, However I used to render with Mental Ray, and I really would like to learn how to do the contribution pass equivalent of Mantra, so I render one take but i have all the passes I want object based, can anyone shed some light to this, also with the option off disabling cutouts for objects staying behind other objects Quote Link to comment Share on other sites More sharing options...
tricecold Posted July 12, 2013 Share Posted July 12, 2013 This is what I was looking for and thanks for the information, However I used to render with Mental Ray, and I really would like to learn how to do the contribution pass equivalent of Mantra, so I render one take but i have all the passes I want object based, can anyone shed some light to this, also with the option off disabling cutouts for objects staying behind other objects I figured out exporting whatever there is at any level in a shader, which was quiet simple actually, I have no idea how I didnt think about it before, But then I faced a new problem, So I am rendering a sea with ship making wakes and etc, I am trying to avoid making multiple Mantra nodes, The passes I want are, sea refl, sea refr, on top of that I have foam beauty and foam alpha ( i could not join them properly in the shader so i get them seperate)... All is fine but when I get my reflection pass from mantra I naturally have the foam rendering as black since they are not reflective yet. I need to find a way to exclude foam object from sea reflection take. anyone ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.