The Layers device provides a convenient way to combine together many different inputs, using an interface similar to Photoshop.
The Layers device supports heightfields, bitmaps, and full materials. You can use a variety of compositing operations, including powerful heightblend-based options. It also produces output masks showing how much of each layer survived into the final blend.
Parameters
Set the desired number of inputs by setting the “Number of Layers” slider. An input will be created for each layer, along with the corresponding parameters.
The input layers are evaluated top to bottom; Later entries occlude the ones above them in the list.
The layer parameters are:
- Opacity : Fade the layer strength. If a layer mask was provided, the layer mask and opacity are multiplied.
- Operation: How to combine the layer with the existing layers above it. The available options are:
- Layer Over. This is a traditional ‘alpha blend’, equivalent to using a Chooser.
- Layer Under. This unique option places a layer behind all existing layers. Note that this only works if the preceding layers have partially-transparent alpha channels; logically, you can’t see a layer placed behind another fully opaque layer.
- Layer Add. Mathematically add to the existing content. This is very useful when the layer weights have already been appropriately set, such as with a Weightmap device
- Heightblend Replace. The current layer is heightblended with the existing layers. Areas at full opacity reduce the height-weight of the previous layers such that they are guaranteed to appear.
- Heightblend Merge. Areas of the current layer higher than the current highest heightblend value will appear. Only areas that are higher than the existing layers will appear.
- Premultiplied Alpha: Available for heightfield and bitmaps, check this if the input has already been alpha-masked. For more details about alpha masking, take a look at the Compositing help article. This a relatively advanced option and generally speaking if you need to do this, you’ll know.
Inputs
Each layer you create contains both a data input and a mask input:
- The data input can be a heightfield, bitmap, or material. All inputs must be the same type.
- The mask input is optional, and must be a heightfield. No mask input is treated the same as a mask that is all-white.
Outputs
- The Primary Output contains the blended result of the Layering operation.
- The Composite Mask contains the resulting alpha channel. This is often fully white (value 1.0), however if you are compositing masked inputs your result may not fully cover every pixel, which is perfectly OK.
- Each layer outputs a mask that shows what part of that layer survived into the final blend.
Tips and Tricks
The Layer device replaces the previously idiomatic “Cascading Choosers” that you would use to combine multiple texture layers within World Machine.
Limitations
The layer parameters currently cannot be controlled by external parameter inputs, such as from a Macro Parameter device. If you need to programmatically control the blending, use a Chooser to blend the layer instead.
Does the Layer Combiner work like a Photoshop layer stack, where it starts at the bottom of the stack and works it way up, or does it start at the top of the stack and work its way down?
Thanks for the comment!
Top to bottom. That’s an important clarification - I’ll update the article.
I was suspecting that but wanted to confirm. This is a powerful tool that will be replacing a lot of cascading combiners for me.
A couple of usability suggestions for the next time you work on this component:
If you have a layer combiner that has enough inputs to require scrolling down, the layer properties window often bounces back up to the top when you change a blend method. It’s not easily seen and it’s very easy to wind up editing layer 5 instead of layer 11 and wondering why it’s not reacting. If the window could be set to not reset scroll position that would relieve that.
It would be very useful if the Layer Name for each input included the set name for the object providing the input. So if my Advanced Perlin Generator was named “Mountain 4”, it would look like Layer 1 “Mountain 4” on the layer properties screen.