Welcome to od|forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

jon3de

separate reflection pass of matte object

hello,

I have a gid with an torus object on top. The torus object is rendered as matte. I would like to have a reflection pass of my torus object in a separate channel or in the beauty pass. Is this possible?

kind regards 

Jon

reflectionPass.hip

Share this post


Link to post
Share on other sites

do you want the torus reflected on the grid or vice versa?

you can use AOVs. tick on direct lighting (per component) and above in export components make sure there is reflect. then you have the reflection as pass.

 

reflection on the matte torus, i have no idea if thats possible in one render. i dont think so. make another rop and set it up so you have the reflection of the grid visible on torus

 

1 person likes this

Share this post


Link to post
Share on other sites

Yea I wanted the reflection of the grid on the "matte torus" but of course it makes sense to me that this is not so easily possible. I thought if I am able to render it in one go I can save some time and space with the ifd files because my actually scene is much more complex.

Thank you very much Dominik. 

Share this post


Link to post
Share on other sites

I'm sure it is somehow possible by hacking the shaders. like setting the matte option in a shader instead on the geo level. or hacking mantra directly. but i'm no expert on this area. maybe @dennis.albus can help ;)

Share this post


Link to post
Share on other sites

wow. Thank you for the file Dennis.

Its kind of what I wanted to achieve except for the torus reflection channel. It should only show the reflection/specular element of the torus. Like a normal reflection pass but only for the torus object. 

I´m very impressed that even the current way what you did is possible with houdini. I will try to comprehend this. Thanks again.

Jon

 

Share this post


Link to post
Share on other sites

To get exactly what you are looking for I actually had to customize a little bit more. This is neither recommended nor a good way to do it (it is just hacked for this single case).

I basically made the same changes that I did in the fog shader, but this time directly inside the pathtracer that mantra uses for rendering. This way we get access to all the export variables (AOVs).

Note that I did not change the actual pathtracing, but only the results!!!

Heres what I added:

// Custom Exports
export vector4 torus_reflection = 0;

....

// custom code goes here
string object_name;
renderstate("object:name", object_name);
if (object_name == "/obj/torus_object1") {
    torus_reflection = direct_comp[1] + indirect_comp[1]; // sum up the direct and indirect components
    Af = 0; // set Alpha to zero for the color channel
    Cf *= Af; // premultiply the color channel
}

You can see the full code when looking at the code section of the pathtracer vop node.

Maybe this is interesting to someone.

The problem is interesting enough that I will spend some more time with it and see if I can find a better (more convenient) solution.

Cheers,

Dennis

reflectionPass_pathtracer.hipnc

Edited by dennis.albus
2 people like this

Share this post


Link to post
Share on other sites

Here's basically the same setup but this time in VOPs. Hopefully this is even more useful, especially for people not comfortable with code.

I was struggling with this as I tried to do it in a fog shader, but the pbrlighting VOP was not available in that context.

Doing it in a material shader context solved this problem. Just be sure to export your needed variables (all_comp in that case) into the fog context and not only into the surface context.

reflectionPass_pathtracer_vop.hip

reflectionPass_pathtracer_vop_simpler.hip

Edited by dennis.albus
Added a stripped down setup with less nodes.
1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now