-
Notifications
You must be signed in to change notification settings - Fork 3
prman_22.Material Layering System
The term "material" is somewhat overloaded. One use refers to a relatively thin layer of a single substance with its own individual bxdf response characteristics, as in A Comprehensive Framework for Rendering Layered Materials (http://www.cs.cornell.edu/projects/layered-sg14/layered.pdf).
I use the word "stratum" to refer to such an individual bxdf response layer, and the word "material" for the aggregate of such layered strata. In this way, a surface shader such as PxrSurface, which contains a number of individual bxdf responses (i.e. strata), defines the response characteristics of a single material.
Now that our terms are clear, let's move on.
First, the Material Layering System encapsulates a material, which is the combination of a set of responses to illumination (the set of bxdf's) plus the surface displacement, into a single shading node. Secondly, it allows materials to be layered one over the other simply by connecting one material node to another in a daisy-chain to define their layering order. Adding, removing, or altering a single material layer is trivial and involves handling just a single node in the material layering chain. All interactions with the other layered materials maintain their physically correct combination with the altered node and each other.
Other layering systems use separate shading graphs for the bxdf and displacement portions, which makes using them extremely cumbersome and non-intuitive, and their layering is based on low-level mixing nodes that require the shading network author to manually construct all aspects of their combination. This results in very complicated shading graphs which are extremely difficult to navigate and modify, as there is no way to cleanly define a single material separate from its combination with the rest of the materials in the overall bxdf and displacement networks.
The scene/Teapot.katana file contains an example scene using the Material Layering System.
The Material Layering System is built on four custom RenderMan shader nodes and a Katana macro. Only the osl/material/PxrSurface shader node and the PxrSurface_Controls macro are used directly. The other three shaders are "glue" nodes that are contained inside the PxrSurface_Controls macro.
The osl/material/v1_PxrSurface shader node defines a single material based on the PxrSurface bxdf responses plus a set of corresponding displacements. It forms a complete, individual material, allowing control over all the connectable (non-constant) surface response parameters and surface displacements. It is this node that is layered with other osl/material/v1_PxrSurface nodes to define a multi-layered material.
The Material_v1_PxrSurface nodes are Katana macros that produce the prmanBxdf and prmanDisplacement outputs that are then connected to a Katana NetworkMaterial or similar node type. They also provide the user interface to all the non-connectable (constant) PxrSurface controls. Internally, they contain the other "glue" shader nodes that produce the Material Layering functionality.
These shaders are used inside the Material_v1_PxrSurface macros. They are not exposed to the end user.
The osl/material/v1_PxrSurfaceAdapter's purpose is to translate the output of the last osl/material/v1_PxrSurface shader in a Material Layering chain to the parameters of a PxrSurface shader, and to output other values used for controlling displacement.
The osl/material/v1_PxrSurfaceCompositor's purpose is to composite two osl/material/v1_PxrSurface shaders together.
This is used to connect two Socket outputs together.
ris/data/GetPN produces the surface's original, undisplaced Po and No values. These are used by the Material Layering System to generate the final displaced surface P and shading normal values.
ris/displace/SetP is used to set the displaced surface's P value based on the layered set of materials and their combined displacements.
The osl/material/v1_PxrSurface shader node contains parameters for defining a layerable material. The bxdf parameters are based on the PxrSurface shader. The displacement parameters allow for float and vector displacements. There are also parameters for controlling how the material is combined with other material layers.
In the following parameter lists, the osl/material/v1_PxrSurface shader is referenced in the nodeType parameter of a PrmanShadingNode, and the node's name is material_v1_PxrSurface.
Material, Pattern Ramp, Displacement, and Global Parameters | Clear Coat, Primary, and Secondary Specular Parameters |
---|---|
Iridescence, Fuzz, Diffuse, and Scatter Parameters | Subsurface, Glass, and Glow Parameters |
---|---|
Displacement Float Parameters | Displacement Vector Parameters |
---|---|
The Material_v1_PxrSurfaceControls and Material_v1_PxrSurfaceMulti macros have one or more Material inputs, a Presence and a utility Socket input, and produce a prmanBxdf and prmanDisplacement output. They contain all the constant (non-connectable) settings used by all the connected material layers. For example, if you select the Artistic mode in Primary_Specular, all Primary Specular responses in all the connected materials will use the Artistic mode. This limitation is due to the way RIS bxdf shaders work: only the variable (connectable) parameters can change from one material layer to another.
PxrSurface_Controls Parameters |
---|