LaSh is a Material layering system based on the paper Layering Displaced Materials with Thickness, Accumulation, and Size. Derived from the Laika Production Shading Library for RenderMan 20, it has been expanded upon and reimplemented using the latest shading and rendering technology.
LaSh implements these key features:
-
It combines a material's bxdf and displacement into an encapsulated Material definition. In this way, a LaSh Material contains all the information about a Material's optical and physical properties in a single atomic object, representing a true physical substance.
-
It combines the encapsulated Material definition with a physically plausible bxdf and displacement layering capability. This layering implementation uses the artistically intuitive notions of Thickness and Accumulation, along with the layered Materials' displacement and bxdf properties, to produce a new physically plausible Material result representing their layered combination.
-
It uses a universal pattern variation metric and control parameter called Size that simultaneously modifies a displaced pattern's variation and magnitude with a single control, while at the same time providing information about the accumulated bulk of layered Materials.
The strength of the LaSh system is derived from these capabilities, resulting in its ability to define a library of self-contained, displaced Materials that can easily be combined or layered in a flexible, intuitively controlled, yet physically plausible way simply by connecting them in the desired layering order.
The rest of this documentation assumes you have read and are familiar with the contents of the Layering Displaced Materials with Thickness, Accumulation, and Size paper, as it is only concerned with the implementation of that system and is not designed to be a separate tutorial about it.
A LaSh Material (LaM) is composed of two parts: its LaSh Bxdf (LaB) and its LaSh Displacement (LaD). This is similar to a MaterialX Material Node that contains both a surface shader and a displacement shader.
A LaB is composed of a Lama Bxdf - which can itself be composed of any number of Lama Bxdfs combined in whatever way you want - plus its Mask. The Mask defines where the LaB is present and where it isn't (or any intermediate value as well). The LaB Mask typically has a relatively sharp transition to 0 at the edge of where the Material ends (assuming it's not present everywhere, in which case the Mask is a constant value of 1).
A LaD is composed of several parts. The first is the displacement itself, which is represented as the change in the surface point: DeltaP. As explained in the Siggraph 2022 OSL Shaders for RenderMan course, this is a much more efficient and useful displacement representation than the displaced point itself. The LaD Bulk is another critical displacement-related value. It allows LaDs to accumulate mass as they're layered over each other. The LaD Mask defines the displacement transition at the edge of the Material. A LaD Mask needs a slightly "softer" transition than the LaB Mask, since rendered displacement does not respond well to severe discontinuities, and abrupt displacement transitions also aren't very realistic looking.
Next are the LaD layering controls: Thickness and Accumulation. These provide the user with the ability to adjust the physical characteristics of the layered displacement's composition. Thickness determines what percentage of the underlying displacement remains or is obliterated by the overlying LaD being applied. And Accumulation determines whether the applied LaD’s displacement will result in the build-up of material in the resulting surface: when displacements accumulate, they increase the resulting Material's Bulk.
Two additional values are contained in the LaD struct: Tau Scale and Nd. Tau Scale is used to make any necessary or desired correction to the Bulk's effect on the optical thickness of the layered BxDFs, and Nd contains the previous LaD's displaced surface normal in order to allow the possibility of cascading height-based displacements.
Note: the displacement Size attribute described in the paper has been renamed Bulk in this implemenation to disambiguate it from the Size pattern generation control parameter and the pattern variation (a.k.a. signal) Size attribute. See Section 3 and Section 5 of the paper for more information about Size.
These examples use the supplied Katana Macros to define the encapsulated LaSh Materials, their layering, and their translation into a prmanBxdf and prmanDisplacement.
The katana/project/ThickAndAccum.katana
file can be used to explore the effects of Thickness and Accumulation on the layered Materials and the resulting Bulk.
This scene can be used to generate the images in Figure 6 of the paper.
Two opaque Materials are layered (small green bumps over large blue bumps), and the resulting Bulk value is shown in grey-scale.
The katana/project/Tau.katana
file can be used to explore the effects of Thickness, Accumulation, and Tau Scale on the resulting layered Material. This scene can be used to generate the images in Figure 7 of the paper.
Transparent cherry syrup is layered over a blue waffle, showing the effects of Thickness, Accumulation, and Tau Scale on the resuling optical thickness (Tau) of the layered result.
The katana/project/RustingPainedMetal.katana
file contains an example of a high-level Material node discussed in the paper's Results Section 6.
It uses an Age parameter to control procedurally generated patterns which define separate LaB and LaD Mask values and displacement.
Note this file does not generate the Mask values and displacement pattern shown in Figure 9 and 10 of the paper, which use fixed patterns.
The katana/project/Layers.katana
file uses the supplied LashLayers macro to layer up to six LaSh Materials.
Three are pre-layered in the example scene, but it contains two others so you can easily experiment with the layering functionality.
The katana/project/Mix.katana
file uses the supplied LashMix macro to blend between two Materials.
The Katana ShadingGroup Macros implement the core functional blocks shown in Figure 2, 3, and 4 of the paper. There are also additional macros that provide other useful functionality. Other than the LashMaterial macro, which contains a Material created by the user, the contents of these ShadingGroup Macros are not altered or exposed.
If you are using another application's shading system, you'll need use that system's shading capabilities to assemble these functional blocks yourself with the supplied osl
shading nodes, or translate them into a different shading langauge.
This macro contains the core set of nodes and UI parameters used to define an encapsulated LaSh Material (LaM). It is useful as a starting point for creating any LaSh Material, and was the starting point for all the Material nodes used in the Examples. Its content is used to define all the characteristics of the desired Material in a self-contained shading network.
This macro is a direct implementation of the block diagram shown in Figure 3 of the paper. The LaD_Layer shading node implements both Listing 2 and Listing 3 components from the paper that are referenced in the Figure 3 block diagram. This represents "vertical" layering in the parlance of MaterialX.
This macro contains a number of cascaded LashLayer macros as a convenience, and allows up to six LaSh Materials to be easily layered with a single node.
This macro does a simple blend between any two LaSh Materials, linearly interpolating all their Material properties. This operation represents "horizontal" Material layering in the parlance of MaterialX.
This macro implements the conversion of a LaSh Material into a prmanBxdf and prmanDisplacement as shown in Figure 4 of the paper. It also exposes all the LamaSurface parameters for controlling the RenderMan BxDF shading functionality.
Section 7.3 of the paper describes an enhancement based on cascading height-based displacements. In order to support this possibility, this implementation has been updated to include Nd in its LaD_struct defintion. Nd contains the Material's displaced surface normal so that an overlying Material's displacement can make use of it.
Rather than using the LashLayer or LashLayers nodes to define the layering order of Materials, the layering functionality of Figure 3 in the paper can be incorporated into a Material's definition. In this way, the Material node has a LaSh Material (LaM) input and output, and the layering order is determined by the order in which the linked Material nodes are connected. This also allows Materials to use Cascading Displacement.
The katana/project/Cascade.katana
file contains this example.
This macro incorporates both of the previous enhancements, allowing for an alternate Material interconnection graph as shown in Daisy Chained Materials. It does so by combining a slightly modified shading graph from the LashMaterial macro that uses the Below Material's LaD_struct.Nd to define the displace_Height Normal direction, and an internal LashLayer macro to layer the Material's internal shading graph over the Below Material input.
To provide control over how much the Material's height-based displacement Normal direction is affected by the Below Material's displaced surface normal, the osl/LaD/ToParts
shader has an added Cascade Normal parameter to adjust its influence.
Given its greater functionality and cleaner top-level Material Layering interconnection graph, this is the preferred Material definition macro over the LashMaterial macro that is layered with the LashLayer or LashLayers macros.