MergeLayerShader: Merging Shaders

With the MergeLayerShader node, you can combine two shader nodes together, using compositing algorithms like none, replace, over, and stencil. The MergeLayerShader node is particularly useful for combining multiple Project3DShader nodes, allowing you to composite 2D images projected onto the 3D geometry atop each other.

1.   Add a MergeLayerShader(over) node after the two shader nodes you want to combine.
2.   Connect the MergeLayerShader node to the mat input of the 3D object you want to project the images on.
3.   Connect the shader nodes to the MergeLayerShader node’s A and B inputs. A refers to the foreground element, and B to the background element.

For example, if you wanted to combine two Project3DShader nodes and composite their results onto a GeoSphere, your node tree would look something like the following:

4.   From the operation dropdown menu, select how you want to composite the results of the two shader nodes together:

to only use input B in the composite, select none.

to only use input A in the composite, select replace.

to composite input A over input B using a mask, select over.

to use input B outside the mask area, select stencil.

to use input B inside the mask area, select mask.

to add input B to input A, select plus.

to use input A if it is greater than input B or else use input B, select max.

to use input A if it is less than input B or else use input B, select min.

5.   For operations (such as over) that need an alpha channel (mask), select which channel to use for the alpha from the alpha channels dropdown menu.