On this page |
Overview ¶
You can layer the output of shader VOPs, mixing the results of two or more shaders, and controlling the mix with a texture map.
You can layer and mix the “layer” outputs of high-level shaders to create new layered materials. The ShaderLayer
struct combines:
-
Surface components such as BSDF and opacity.
-
Displacement components such as the displaced position and normal.
-
Export maps such as diffuse color, normals, occlusion, roughness, and specular. The layer mixing VOPs mix these exports as well as the surface and displacement shaders.
Because displacement and maps are part of the layer, layering or mixing shaders mixes the displacements and export maps as well, making layering an easy one-step process.
The shaders contributing the layers are usually cached and they contribute information (BSDF, etc.) but don’t run light loops themselves, so layering has very little cost.
Use the Layer Mix node to combine layers.
-
You can vary the alpha blending between the layers by connecting a texture to the
alpha
input. -
You can choose whether to mix surface and/or displacement.
Note
Layer Mix output is only visible in Render View, not in the viewport.
Building a layered material ¶
-
In the network editor, choose Go ▸ Materials to switch to the material network.
-
Create the material nodes you want to mix together.
Materials must have a layer output to be mixable. Pre-made materials included with Houdini should all have a layer output. You can add a layer output to your own custom materials.
-
Create a Layer Mix VOP and connect the layer outputs of the materials you want to mix to the Layer Mix node’s A and B inputs.
You can choose how to mix the two materials using the Layer Mix node’s parameters.
You can mix more than two materials feeding the output of the Layer Mix and another material into another Layer Mix.
If you are creating loose nodes at the /mat
level, you can assign the Layer Mix node at the end of the chain as a material, or select the mixing chain and choose Edit ▸ Collapse into material to create a material builder from it. This is the easiest way to creating a mixing material.
If instead you are already building inside a material builder network, you need to use a Surface Exports VOP and Displace Exports VOP (if the material includes displacement) to pull the values needed by the Output nodes out of the layer struct.
See understanding shader outputs for more information about the relationship between layers and shaders.
Combining BSDFs ¶
If you want to build something a little more custom, without having to write all the lighting code and BSDFs yourself, you can use nodes that generate useful basic BSDFs/layers such as diffuse, reflective, and glass. These nodes are in the Shading (BSDFs) category in the ⇥ Tab menu.
-
Diffuse
-
SSS
-
Reflection
-
Metallic
-
Emission
-
Glass
These nodes take a base
layer input (where it makes sense) that let you easily combine them with other layers/BSDFs. The nodes take care of the physical aspects of combining the looks (fresnel components, energy conservation) automatically.
Metallic |
Reflect |
Metallic + Reflect |
Useful nodes ¶
You can combine layers using the following nodes in the Shading Layers submenu:
Displays the “A” input over the “B” input, using an alpha map input to blend between them. This is the most commonly useful method of combining layers. |
|
This is more complex than Layer Mix, but has more options for how to combine the two layers. It has separate alpha maps for each layer, and lets you choose the method for compositing the two layers. |
Packing and unpacking a layer ¶
If you want to modify the components of a ShaderLayer struct, you can:
-
Break out all components with Surface Exports or Displacement Exports.
-
Build a new
ShaderLayer
struct from components with Layer Pack. -
Extract a single component with Get Layer Export.
-
Set a single component with Set Layer Component (if which component to change is known ahead of time) or Set Layer Export (if the name of the component to replace comes from a string value).
For example, you might need to use a low-level node that has a BSDF (F
) input, but you only have a layer
, you can break out the F
from the layer using Surface Exports, modify it, and then put it back in the layer using Set Layer Component.
Layering material properties ¶
Currently Houdini does not blend property values if the layered materials have render properties. This is because the code can’t know how to combine the values (depending on the property, it might make sense to add the values, multiply them, take the maximum, blend by a certain amount, or use some other method).
For now the only way to get properties on a layered material is to explicitly add the properties in the final layered material, just like any other material.
It’s possible future versions of Houdini may have a solution for configuring how to blend property values in a layered shader.