Jump to content

Confused about Material Layering vs Material Chaining

Recommended Posts

I'm learning about material layering in Mantra, and up until now I have always used the layermix VOP.  This video shows another way of combining materials, chaining one node's "layer" output into another node's "base" input (at 33:22):



Are these methods equivalent?  The documentation has got me a bit confused.  It makes it sound like the layermix VOP just averages the inputs and the bsdfs whereas the chaining method also performs some sort of energy conservation:

 The nodes take care of the physical aspects of combining the looks (fresnel components, energy conservation) automatically.

Does that mean the layermix VOP does NOT perform these conservations?  What exactly is happening in both of these cases?  The fact that the video advises that the order in which you chain materials has gotten me especially confused.

I am somewhat familiar with the layering techniques (averaging output pixel color in realtime world, performing inter-layer scattering in offline world) but I have no idea how Mantra works in either of these two cases.

Does anybody have insight into layermix VOP vs chaining layers to base inputs?


Edited by xxyxxy

Share this post

Link to post
Share on other sites

the way I see it is that they do more or less the same thing, however

the advantage of passing through is that you get physical layer mixing based on weight (alpha) automatically computed from the settings on the top layer

so passing diffuse layer through dielectric reflection layer will mix them based on the fresnel values computed directly from the parameters on the dielectric reflection layer

if you had to do it yourself, you'd have to recreate microfacet fresnel mask just to blend diffuse and reflection and that reflection would still have to have the same microfacet model, so rather than taking a chance and trying to compute the same thing twice independently, just pass it through and it will use the same math for both

for all the mixing where the coverage is not dependent on some physical mask tied to the applied model you should be ok with layermix based on custom mask or textures

Edited by anim

Share this post

Link to post
Share on other sites

Thanks so much for the answer.  I have a couple of clarifying questions if you don't mind.  I took a look at the generated VEX code for both pbrdiffuse VOP and layermix VOP to try to understand, but all I saw was a bunch of exports and a call to layer_composite_a_over_b that I couldn't see the implementation for.

Where does this weight (alpha) come from?  Is it based Fresnel in the sense of just the incoming light angle or is it based on the specular layer's "reflectivity" setting?

Also, for the PBR-Non Metallic VOP I do see the controls for energy conservation... does this process of energy conservation only occur when the box is ticked?

Lastly, I apologize if this is trivial but I understand BSDFs to be just maps from a solid angle to a [0..1] value.  Does that mean adding two BSDFs as described here is simply adding their map values?

You can add bsdf values together and scale them by vectors or floats. Multiplying a BSDF by a color vector makes the surface reflect that color.


Share this post

Link to post
Share on other sites
58 minutes ago, xxyxxy said:

layer_composite_a_over_b that I couldn't see the implementation for

its defined in here: $HFS/houdini/vex/include/bsdf.h

the weight is based on the returned energy, well, you can see all math in there if interested

BSDFs are not maps, but bidirectional functions, you may need to do some research even outside of the scope of Houdini to learn more as it's pretty extensive topic


Share this post

Link to post
Share on other sites

Oh, this is great!  Thanks for the pointer to the source!

Thanks for the BSDF clarification, I always thought map was the right term since people sometimes used those merl textures to do (angle ==> [0..1]) lookups instead of like an analytic function...  but now I realize that no matter how you get your (angle ==> [0..1]) value it is still called a BSDF.

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