modo bubbble logo

Advancing the Shader Tree

Home >> Shade, Light & Render >> Working with Shader Tree

back next

The Shader Tree is both immensely powerful and tremendously flexible. It is this flexibility that can lead to it feeling unwieldy at times. Based on user feedback, it was a design requirement to allow materials and textures to be applied at any level in the scene; even globally if necessary, but as the saying goes, "With great power comes great responsibility". The result is user diligence is required to keep the Shader Tree organized and the effort necessary increases as the complexity of a project increases. Understanding how to work with layers in the Shader Tree and what each contributes is an important start in wielding the power that the Shader Tree provides. The basics are covered on the Shading, Shader Tree Items and Layer Effect page of the documentation. Beyond the basics covered on these pages, it was important to add an additional page to go over some more advanced aspects of shading surfaces in MODO.

Groups and Groups

The number one most important item in the Shader Tree is the Material Group item. In the 'Add Layer' function of the Shader Tree, it is simply referred to as a 'Group', but here I'm calling it a 'Material Group' to avoid any confusion with actual 'Groups'. The Material Group serves multiple purposes and understanding its few settings are extremely important in getting the most out of them. When users add a Material Group item to the tree, they are simply empty containers. These containers can hold any number of layers, including collections of other groups. In this case, they are strictly organizational devices, providing hierarchy to a scene, for instance associating like Materials to an item in the scene, making it easier to navigate a complex tree. This can be illustrated by selecting a few layers in the tree and pressing the 'Ctrl+G' keyboard shortcut, grouping together like materials under an undefined Material Group item.

The Material Group item also provides the principal means for applying materials to surfaces by way of masks. By selecting from named Items and/or Polygon Tags in the Material Group items 'Properties' panel, any contents (i.e. layers) within the Material Group can be limited to only affect geometry surfaces that carry that specific tag in the scene. This is done automatically every time a user applies a Material tag using the 'M' keyboard command. Users press 'M' opening the 'Polygon Set Material' dialog box. Defining a name and pressing 'OK' will generate a new Material Group item in the Shader Tree automatically setting the 'tag type' and 'tag name' options to the particular name that was defined. Its a very simple procedure, but the implications of the power that the Material Group provide are immense.


Masking Surfaces

While the Material Group is an easy way to assign surfacing for geometry when rendering, its reliance on polygon tags limits what is possible with just Material Groups; not all surface borders are hard edged polygonal boundaries. Therefore MODO provides several other ways to mask textures that provide much finer control. The masking functions combined with the layering possibilities of the Shader Tree makes it simple to produce very complex surfaces with ease. Whenever an alpha transparency mask is applied to a texture layer the underlying layers are revealed.

Group Masks
The 'Group Mask' is a Layer Effect option, defined for a layer in the 'Effects' column of the Shader Tree. It allows the contents of an entire Material Group, regardless of complexity or number of layers, to be masked by using any single texture item. The texture can be a procedural texture such as a Noise layer, an image map or even a weight map using the Weight Map texture layer. The use of image maps provides very fine pixel-level control. Users can create these images externally using an image editor, or paint them directly in MODO using the built in paint tools. The use of gradients opens up a number of interesting possibilities as well, where Material Groups can be masked by the numerous gradient input parameters, such as slope or incidence angle.

Layer Masks
The 'Layer Mask' result is similar to the masking functionality of the 'Group Mask', but it application is limited to a single layer within the Shader Tree providing even more granular control. There are two ways to apply a layer mask, either choosing the 'Layer Mask' effect and placing the layer directly below the layer the user wishes to mask, or by simply dragging and dropping the layer onto the target layer (therefore automatically defining it as a layer mask effect). Users can modify the settings of the texture layer, toggling the visibility of this kind of mask using the '+' icon preceding the layers name.

Alpha Channels
Modo opens and respects embedded alpha channels or layer transparency on imported image map layers. Their actual application can be a point of confusion because some users are surprised when they can't see-through their surface in the transparent areas of the image map. This is because MODO respects the alpha channel for the image map as a texture layer (revealing any lower surface shading), but it doesn't serve double-duty as 'Transparency' (or 'Stencil' or 'Dissolve') for the surface when set as the default 'Diffuse Color' effect. Users would need to also apply the image as a 'Layer' or 'Group' Mask, or additionally assign the Alpha channel on the image as 'Transparency' or 'Dissolve' utilizing the 'Alpha Only' option of the images properties. Additionally, users can simply use the 'RGBA' layer effect to designate both diffuse color and transparency (applied as 'Stencil') using a single texture layer.

By virtue of how MODO handles alpha transparency for a image maps, this makes it possible to layer any number of transparent images and combine the result into a single complex surface. Even when painting, using transparent image layers, Photoshop-like multi layered images are possible by stacking several image map layers with Alpha channels. User can simply select the layer in the Shader Tree to designate which image receives the brush strokes while painting, leaving other layers unaffected.

Item Masks
Within the Material Group items Properties panel, users can specify item masks in addition to the other setting. Item Masks can be extremely useful limiting the application of images or shading to a single Mesh item layer, without resorting to a bunch of different polygon tags. This makes it possible to apply different shading or image maps to an Instance simply by specifying the Instanced items name in the 'Item' property of the Material Group item. Instances usually have the inherited parent items name followed by a number in parenthesis. A simple Item selection will show which Instance is the target for the mask. Item Masks also allow shading to be applied to individual Items that would otherwise overwrite other same named (tagged) surfaces in the scene.


Layering Surfaces

Not only can users layer images and textures in a single material, users can also layer different tags for interesting results. Polygons can only have a single 'Part' or Material' tag, but it can have both tags simultaneously as well as an unlimited number of 'Selections Sets'. The polygons tagged do not have to be identical in their grouping, or even similar. It is therefore possible to create a 'Selection Set' that spans polygons from two separate Material surfaces, define it as a mask and apply an image that straddles the two surfaces. Use a straight Material tag for the two regular surfaces and then assign the smaller areas the Selection Set with a custom UVs. This is also very useful to apply labels and such.


Cleaning Up the Shader Tree

On occasion, users may find the Shader Tree encumbered with unnecessary layers that need to be removed, These extra layers be be the result of experimentation or excessive copying of material Presets. Choosing which layers to delete can be difficult. The 'Purge Unused Materials' command will remove all Shader Tree material and/or texture layers that do not contribute toward the final rendered image, including those that reference unassigned Polygon Tags. These could occur when geometry is deleted, or new tags are assigned, as polygons can only hold a single material or part tag. It is also possible when moving item layers into a scene from another that extraneous layers are added. To use, simply select the command from the menu bar 'Texture > Purge Unused Materials'.


Targeted Control

One often confusing aspect of the Shader Tree is its Base Shader item that defaults to the top of every Shader Tree. The Base Shader controls visibility, shading rate and many other aspects of the rendered image. In a way it is like a soldier at the gate controlling what information gets by the gate to the renderer and how much of that information is passed along for evaluation. Due to the global nature of the Shader Tree, being that it is the top most layer and is unmasked, it has meant the any Shader Items added below it will have their settings overwritten by it unless the lower level Shader was masked appropriately and placed higher up in the Shader Tree. The juggling of Shader Tree layers and Group Materials masks evaluating based on their position can get confusing, especially in complex scene. Sometimes users are just looking for a simple way to make a single object invisible to the camera. To do this Item Shaders have been introduced. They are in every way identical to the regular Shader items except that they are the only Shader Tree layer that doesn't exist in the Shader Tree. These are assigned and modified directly in the Items list. When any of their 'Control...' options are enabled, those settings will always override those of the Shader Tree counterpart upon evaluation. To assign an Item Shader, simply LMB+Click on the target Mesh Item layer in the Items List and select the "Create Item Shader' option from the contextual menu. With the Shader Item selected, users can modify its attributes in the Properties panel. To target a specific control, such as visibility, disable all the 'Control' option except for 'Control Visibility' and then disable the single 'Visible to Camera' option. This will make the targeted item invisible tot he camera, yet it will still cast shadows and show up in reflections. Item Shaders simplify many aspect that used to be difficult to apply.


Some Additional Notes-

Users often forget that texture items such as image maps and procedurals can be added to lights and environments as well. By adjusting their 'Projection' types and 'Effect' settings, a whole range of interesting effects can be obtained.

Texture layers can be used to mask any other types of layer, including 'Surface Generators' and 'Fur'. The only layer that cannot be used as a mask for Surface Generators or Fur is the 'Occlusion' layer; since it requires rays to be fired to calculate, this only happens at render time, and it is therefore too late in the evaluation process to produce the intended result. In these cases users should bake the occlusion layer out to a image map texture and then reapply the image map in place of the occlusion.



back next