# MaterialX: An Open Standard for Network-Based CG Object Looks **Version 1.39** Doug Smythe - Industrial Light & Magic Jonathan Stone - Lucasfilm Advanced Development Group September 15, 2024 # Introduction Computer graphics production studios commonly use workflows involving multiple software tools for different parts of the production pipeline. There is also a significant amount of sharing and outsourcing of work across facilities, requiring companies to hand off fully look-developed models to other divisions or studios which may use different software packages and rendering systems. In addition, studio rendering pipelines that previously used monolithic shaders built by expert programmers or technical directors with fixed, predetermined texture-to-shader connections and hard-coded texture color-correction options are now using more flexible node-based shader networks built up by connecting images and procedurals to shader inputs through a graph of image processing and blending operators. At least four distinct interrelated data relationships are required to specify the complete "look" of a CG object: 1. _Image processing networks_ of sources, operators, connections and input values, outputting a number of spatially-varying data streams. 2. _Geometry-specific information_ such as associated texture filenames or IDs for various map types. 3. Associations between spatially-varying data streams and/or uniform values and the inputs of surface, volume, or other shaders, defining a number of _materials_. 4. Associations between materials and specific geometries to create a number of _looks_. **MaterialX** addresses the need for an open, platform-independent, well-defined standard for specifying the "look" of computer graphics objects built using node networks by defining a material content schema along with a corresponding XML-based file format to read and write MaterialX content. The MaterialX schema defines a number of primary element types plus several supplemental and sub-element types, as well as a set of **standard nodes** with specific functionality for defining data-processing graphs, shaders and materials. This document describes the core MaterialX specification. Companion documents [**MaterialX Physically Based Shading Nodes**](./MaterialX.PBRSpec.md), [**MaterialX Geometry Extensions**](./MaterialX.GeomExts.md) and [**MaterialX Supplemental Notes**](./MaterialX.Supplement.md) describe additional node and element types and other information about the library, while [**MaterialX: Proposed Additions and Changes**](./MaterialX.Proposals.md) describes forward-looking proposed funnctionality for MaterialX. ## Table of Contents **[Introduction](#introduction)** **[MaterialX Overview](#materialx-overview)**  [Definitions](#definitions)  [MaterialX Names](#materialx-names)  [MaterialX Data Types](#materialx-data-types)  [Custom Data Types](#custom-data-types)  [MTLX File Format Definition](#mtlx-file-format-definition)  [Color Spaces and Color Management Systems](#color-spaces-and-color-management-systems)  [Units](#units)  [MaterialX Namespaces](#materialx-namespaces)  [Geometric Properties](#geometric-properties)  [File Prefixes](#file-prefixes)  [Filename Substitutions](#filename-substitutions) **[Nodes](#nodes)**  [Inputs](#inputs)  [Node Graph Elements](#node-graph-elements)  [Output Elements](#output-elements)  [Standard Source Nodes](#standard-source-nodes)   [Texture Nodes](#texture-nodes)   [Procedural Nodes](#procedural-nodes)   [Noise Nodes](#noise-nodes)   [Shape Nodes](#shape-nodes)   [Geometric Nodes](#geometric-nodes)    [Geometric Spaces](#geometric-spaces)   [Application Nodes](#application-nodes)  [Standard Operator Nodes](#standard-operator-nodes)   [Math Nodes](#math-nodes)   [Logical Operator Nodes](#logical-operator-nodes)   [Adjustment Nodes](#adjustment-nodes)   [Compositing Nodes](#compositing-nodes)   [Conditional Nodes](#conditional-nodes)   [Channel Nodes](#channel-nodes)   [Convolution Nodes](#convolution-nodes)  [Standard Node Inputs](#standard-node-inputs)  [Standard UI Attributes](#standard-ui-attributes)  [Backdrop Elements](#backdrop-elements)  [Node Graph Examples](#node-graph-examples) **[Customization, Targeting and Shading](#customization-targeting-and-shading)**  [Target Definition](#target-definition)  [Custom Attributes and Inputs](#custom-attributes-and-inputs)  [Custom Nodes](#custom-nodes)   [Custom Node Declaration NodeDef Elements](#custom-node-declaration-nodedef-elements)    [NodeDef Parameter Interface](#nodedef-parameter-interface)    [NodeDef Input Elements](#nodedef-input-elements)    [NodeDef Token Elements](#nodedef-token-elements)    [NodeDef Output Elements](#nodedef-output-elements)   [Custom Node Definition Using Implementation Elements](#custom-node-definition-using-implementation-elements)    [Example Custom Nodes Defined by External File Implementations](#example-custom-nodes-defined-by-external-file-implementations)   [Custom Node Definition Using Node Graphs](#custom-node-definition-using-node-graphs)    [Functional Nodegraphs](#functional-nodegraphs)    [Compound Nodegraphs](#compound-nodegraphs)    [Example Custom Node Defined by a Nodegraph](#example-custom-node-defined-by-a-nodegraph)   [Custom Node Use](#custom-node-use)  [Shader Nodes](#shader-nodes)   [Standard Library Shader Nodes](#standard-library-shader-nodes)  [Material Nodes](#material-nodes)   [Example Pre-Shader Compositing Material](#example-pre-shader-compositing-material)  [Material Variants](#material-variants) **[References](#references)** # MaterialX Overview The diagram below gives a high-level overview of a typical MaterialX look definition. A directed acyclic graph of pattern generation and processing nodes is connected to inputs of a surface Shader which defines a layered BSDF response. One or more shaders can be connected to form a Material, which is ultimately associated with specific scene geometry via a MaterialAssign, a number of which comprise a Look. The assignments of Materials to geometries can be defined within a MaterialX document in applications supporting MaterialX Geometry Extensions, or using an alternative mechanism such as USD[^1] or a native application's toolset. Each of the pattern nodes and even the Shaders may in turn be implemented using a graph of nodes: these NodeGraphs are given a parameter interface using NodeDefs, and these implementations may be reused with different input values just like any other Standard node defined by MaterialX. ![MaterialX Overview Diagram](media/MaterialX_1.39_Overview_v5.png "MaterialX Overview Diagram") MaterialX also allows the specification of additional information not shown in this diagram, such as geometry-specific properties, material variations, arbitrary custom inputs and attributes for nodes, rendering-target-specific versions of shaders, nodes and implementations, external compiled or generated shader implementations, and much more. ## Definitions Because the same word can be used to mean slightly different things in different contexts, and because each studio and package has its own vocabulary, it's important to define exactly what we mean by any particular term in this proposal and use each term consistently. An **Element** is a named object within a MaterialX document, which may possess any number of child elements and attributes. An **Attribute** is a named property of a MaterialX element. A **Node** is a function that generates or operates upon spatially-varying data. This specification provides a set of standard nodes with precise definitions, and also supports the creation of custom nodes for application-specific uses. The interface for a node’s incoming data is declared through **Inputs**, which may be spatially-varying or uniform, and **Tokens**, which are string values that can be substituted into filenames declared in node inputs. A **Pattern** is a node that generates or processes simple scalar, vector, and color data, and has access to local properties of any geometry that has been bound. A **Shader** is a node that can generate or process arbitrary lighting or BSDF data, and has access to global properties of the scene in which it is evaluated. A **Material** is a node which internally or externally references one or more shaders with specific data streams or uniform values bound to their inputs. A **Node Graph** is a directed acyclic graph of nodes, which may be used to define arbitrarily complex generation or processing networks. Common uses of Node Graphs are to describe a network of pattern nodes flowing into shader inputs, or to define a complex or layered node in terms of simpler nodes. A **Stream** refers to a flow of spatially-varying data from one node to another. A Stream most commonly consists of color, vector, or scalar data, but can transport data of any standard or custom type. A **Layer** is a named 1-, 2-, 3- or 4-channel color "plane" within an image file. Image file formats that do not support multiple or named layers within a file should be treated as if the (single) layer was named "rgba". A **Channel** is a single float value within a color or vector value, e.g. each layer of an image might have a red Channel, a green Channel, a blue Channel and an alpha Channel. A **Geometry** is any renderable object, while a **Partition** refers to a specific named renderable subset of a piece of geometry, such as a face set. A **Collection** is a recipe for building a list of geometries, which can be used as a shorthand for assigning e.g. a Material to a number of geometries in a Look. A **Target** is a software environment that interprets MaterialX content to generate images, with common examples being digital content creation tools and 3D renderers. ## MaterialX Names All elements in MaterialX (nodes, materials, shaders, etc.) are required to have a `name` attribute of type "string". The `name` attribute of a MaterialX element is its unique identifier, and no two elements within the same scope (i.e. elements with the same parent) may share a name. Element names are restricted to upper- and lower-case letters, numbers, and underscores (“_”) from the ASCII character set; all other characters and symbols are disallowed. MaterialX names are case-sensitive and are not allowed to begin with a digit. ## MaterialX Data Types All values, input and output ports, and streams in MaterialX are strongly typed, and are explicitly associated with a specific data type. The following standard data types are defined by MaterialX: **Base Types**: ``` integer, boolean, float, color3, color4, vector2, vector3, vector4, matrix33, matrix44, string, filename ``` **Array Types**: ``` integerarray, floatarray, color3array, color4array, vector2array, vector3array, vector4array, stringarray ``` The following examples show the appropriate syntax for MaterialX attributes in MTLX files: **Integer**, **Float**: just a value inside quotes: ``` integervalue = "1" floatvalue = "1.0" ``` **Boolean**: the lower-case word "true" or "false" inside quotes: ``` booleanvalue = "true" ``` **Color** types: MaterialX supports two different color types: * color3 (red, green, blue) * color4 (red, green, blue, alpha) Color channel values should be separated by commas (with or without whitespace), within quotes: ``` color3value = "0.1,0.2,0.3" color4value = "0.1,0.2,0.3,1.0" ``` Note: all color3 values and the RGB components of a color4 value are presumed to be specified in the "working color space" defined in the enclosing <materialx> element, although any element within a document may provide a `colorspace` attribute that explicitly states the space in which color values within its scope should be interpreted; implementations are expected to translate those color values into the working color space before performing computations with those values. See the [Color Spaces and Color Management Systems](#color-spaces-and-color-management-systems) section below. **Vector** types: similar to colors, MaterialX supports three different vector types: * vector2 (x, y) * vector3 (x, y, z) * vector4 (x, y, z, w) Coordinate values should be separated by commas (with or without whitespace), within quotes: ``` vector2value = "0.234,0.885" vector3value = "-0.13,12.883,91.7" vector4value = "-0.13,12.883,91.7,1.0" ``` While colorN and vectorN types both describe vectors of floating-point values, they differ in a number of significant ways. First, the final channel of a color4 value is interpreted as an alpha channel by compositing operators, and is only meaningful within the [0, 1] range, while the fourth channel of a vector4 value _could be_ (but is not necessarily) interpreted as the "w" value of a homogeneous 3D vector. Additionally, values of type color3 and color4 are always associated with a particular color space and are affected by color transformations, while values of type vector3 and vector4 are not. More detailed rules for colorN and vectorN operations may be found in the [Standard Operator Nodes](#standard-operator-nodes) section of the specification. **Matrix** types: MaterialX supports two matrix types that may be used to represent geometric and color transforms. The `matrix33` and `matrix44` types, respectively, represent 3x3 and 4x4 matrices and are written as nine or sixteen float values separated by commas, in row-major order: ``` matrix33value = "1,0,0, 0,1,0, 0,0,1" matrix44value = "1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1" ``` **String**: literal text within quotes. See the [MTLX File Format Definition](#mtlx-file-format-definition) section for details on representing special characters within string data. ``` stringvalue = "some text" ``` **Filename**: attributes of type "filename" are just strings within quotes, but specifically mean a Uniform Resource Identifier ([https://en.wikipedia.org/wiki/Uniform_Resource_Identifier](https://en.wikipedia.org/wiki/Uniform_Resource_Identifier)) optionally containing one or more Filename Substitution strings (see below) that represents a reference to an external asset, such as a file on disk or a query into a content management system. ``` filevalue = "diffuse/color01.tif" filevalue = "/s/myshow/assets/myasset/v102.1/wetdrips/drips.{frame}.tif" filevalue = "https://github.com/organization/project/tree/master/src/node.osl" filevalue = "cmsscheme:myassetdiffuse..tif?ver=current" ``` **IntegerArray**, **FloatArray**, **Color3Array**, **Color4Array**, **Vector2Array**, **Vector3Array**, **Vector4Array**, **StringArray**: any number of values (including zero) of the same base type, separated by commas (with or without whitespace), within quotes; arrays of color3’s, color4’s, vector2's, vector3's or vector4's are simply a 1D list of channel values in order, e.g. "r0, g0, b0, r1, g1, b1, r2, g2, b2". Individual string values within stringarrays may not contain commas or semicolons, and any leading and trailing whitespace characters in them is ignored. MaterialX does not support multi-dimensional or nested arrays. Array-typed inputs to nodes must be static uniform values of a length specified by another uniform input value of the node, or implicitly by the node's implementation requirements. Nodes cannot output an Array type. ``` integerarrayvalue = "1,2,3,4,5" floatarrayvalue = "1.0, 2.2, 3.3, 4.4, 5.5" color3arrayvalue = ".1,.2,.3, .2,.3,.4, .3,.4,.5" color4arrayvalue = ".1,.2,.3,1, .2,.3,.4,.98, .3,.4,.5,.9" vector2arrayvalue = "0,.1, .4,.5, .9,1.0" vector3arrayvalue = "-0.2,0.11,0.74, 5.1,-0.31,4.62" vector4arrayvalue = "-0.2,0.11,0.74,1, 5.1,-0.31,4.62,1" stringarrayvalue = "hello, there, world" ``` ## Custom Data Types In addition to the standard data types, MaterialX supports the specification of custom data types for the inputs and outputs of shaders and custom nodes. This allows documents to describe data streams of any complex type an application may require; examples might include spectral color samples or compound geometric data. The structure of a custom type's contents may be described using a number of elements, though it is also permissible to only declare the custom type's name and treat the type as "blind data". Types can be declared to have a specific semantic, which can be used to determine how values of that type should be interpreted, and how nodes outputting that type can be connected. Currently, MaterialX defines three semantics: * "`color`": the type is interpreted to represent or contain a color, and thus should be color-managed as described in the [Color Spaces and Color Management Systems](#color-spaces-and-color-management-systems) section. * "`shader`": the type is interpreted as a shader output type; nodes or nodegraphs which output a type with a "shader" semantic can be used to define a shader-type node, which can be connected to inputs of "material"-type nodes. * "`material`": the type is interpreted as a material output type; nodes or nodegraphs which output a type with a "material" semantic can be referenced by a <materialassign> in a <look>. Types not defined with a specific semantic are assumed to have semantic="default". Custom types are defined using the <typedef> element: ```xml ``` Attributes for <typedef> elements: * `name` (string, required): the name of this type. Cannot be the same as a built-in MaterialX type. To reduce the possible symbol conflict between custom type names and possible variable names created by code generation, we suggest the convention of using `_struct` as a suffix to the type name. * `semantic` (string, optional): the semantic for this type (see above); the default semantic is "default". * `context` (string, optional): a semantic-specific context in which this type should be applied. For "shader" semantic types, `context` defines the rendering context in which the shader output is interpreted; please see the [Shader Nodes](#shader-nodes) section for details. * `inherit` (string, optional): the name of another type that this type inherits from, which can be either a built-in type or a custom type. Applications that do not have a definition for this type can use the inherited type as a "fallback" type. * `hint` (string, optional): A hint to help those creating code generators understand how the type might be defined. The following hints for typedefs are currently defined: * "halfprecision": the values within this type are half-precision * "doubleprecision: the values within this type are double-precision Attributes for <member> elements: * `name` (string, required): the name of the member variable. Must be unique within the list of other member names for this custom type. * `type` (string, required): the type of the member variable; can be any built-in MaterialX type, or any previously defined custom type; recursive inclusion for <member> types is not supported. * `value` (string, required): the default value of the member variable. If a number of elements are provided, then a MaterialX file can specify a value for that type any place it is used, as a brace surrounded, semicolon-separated list of numbers and strings, with the expectation that the numbers and strings between semicolons exactly line up with the expected types in order. The use of the braces allows for custom struct types initializers to be nested. For example, if the following was declared: ```xml ``` Then a permissible input declaration in a custom node using that type could be: ```xml ``` If child elements are not provided, e.g. if the contents of the custom type cannot be represented as a list of MaterialX types, then a value cannot be provided, and this type can only be used to pass blind data from one custom node's output to another custom node or shader input. Once a custom type is defined by a <typedef>, it can then be used in any MaterialX element that allows "any MaterialX type"; the list of MaterialX types is effectively expanded to include the new custom type. It should be noted however that the <typedef> is only declaring the existence of the type and perhaps some hints about its intended definition, but it is up to each application and code generator to provide its own precise definition for any type. The standard MaterialX distribution includes definitions for four "shader"-semantic data types: **surfaceshader**, **displacementshader**, **volumeshader**, and **lightshader**. These types are discussed in more detail in the [Shader Nodes](#shader-nodes) section below. ## MTLX File Format Definition An MTLX file (with file extension ".mtlx") has the following general form: ```xml ``` That is, a standard XML declaration line followed by a root <materialx> element, which contains any number of MaterialX elements and sub-elements. The default character encoding for MTLX files is UTF-8, and this encoding is expected for the in-memory representation of string values in MaterialX implementations. Standard XML XIncludes are supported ([http://en/wikipedia.org/wiki/XInclude](http://en/wikipedia.org/wiki/Xinclude)), as well as standard XML comments and the XML character entities `"`, `&`, `'`, `<` and `>`: ```xml ``` To support stringarray types, MaterialX supports a non-standard XML convention where a comma (and any following whitespace) is a separator for strings within a stringarray, a comma or semicolon preceded by a backslash is interpreted as a regular comma or semicolon rather than as a separator, and two backslashes are interpreted as a single backslash. Each XIncluded document must itself be a valid MTLX file, containing an XML header and its own root `` element, the children of which are added to the root element of the including document. Hierarchical root-level attributes such as `colorspace` and `namespace` are distributed to the included children to maintain correct semantics within the including MaterialX document. Attributes for a <materialx> element: * `version` (string, required): a string containing the version number of the MaterialX specification that this document conforms to, specified as a major and minor number separated by a dot. The MaterialX library automatically upgrades older-versioned documents to the current MaterialX version at load time. * `colorspace` (string, optional): the name of the "working color space" for this element and all of its descendants. This is the default color space for all image inputs and color values, and the color space in which all color computations will be performed. The default is "none", for no color management. * `namespace` (string, optional): defines the namespace for all elements defined within this <materialx> scope. Please see the [MaterialX Namespaces](#materialx-namespaces) section below for details. ## Color Spaces and Color Management Systems MaterialX supports the use of color management systems to associate RGB colors and images with specific color spaces. MaterialX documents typically specify the working color space of the application that created them, and any input color or image described in the document can specify the name of its color space if different from the working color space. This allows applications using MaterialX to transform color values within input colors and images from their original color space into a desired working color space upon ingest. MaterialX does not specify _how_ or _when_ color values should be transformed: that is up to the host application, which can use any appropriate method including code generation, conversion when loading images into memory, maintaining cached or pre-converted image textures, etc. It is generally presumed that the working color space of a MaterialX document will be linear (as opposed to log, a display-referred space such as sRGB, or some other non-linear encoding), although this is not a firm requirement. By default, MaterialX supports the following color spaces as defined in ACES 1.2 ([http://www.oscars.org/science-technology/sci-tech-projects/aces)](http://www.oscars.org/science-technology/sci-tech-projects/aces), and applications rendering MaterialX documents are expected to transform input colors and images from these spaces to the color space of their renderer. One straightforward option for providing this support is to leverage MaterialX code generators, which support these transforms automatically, but applications may use any appropriate means to handle the transforms on their own. * `srgb_texture` * `lin_rec709` * `g22_rec709` * `g18_rec709` * `acescg` * `lin_ap1 (alias for "acescg")` * `g22_ap1` * `g18_ap1` * `lin_srgb` * `adobergb` * `lin_adobergb` * `srgb_displayp3` * `lin_displayp3` The working color space of a MaterialX document is defined by the `colorspace` attribute of its root <materialx> element, and it is strongly recommended that all <materialx> elements define a specific `colorspace` if they wish to use a color-managed workflow rather than relying on a default color space setting from an external configuration file. If a MaterialX document is xi:included into another MaterialX document, it will inherit the working color space setting of the parent document, unless it itself declares a specific working color space. The color space of individual color image files and values may be defined via a `colorspace` attribute in an input which defines a filename or value. Other elements, such as <nodegraph> or a node instance, are allowed to define a `colorspace` attribute that will apply to elements within their scope; color values in inputs and files that do not explicitly provide a `colorspace` attribute will be treated as if they are in the color space of the nearest enclosing scope which does define a `colorspace` attribute. Color images and values in spaces other than the working color space are expected to be transformed by the application into the working space before computations are performed. In the example below, an image file has been defined in the “srgb_texture” color space, while its default value has been defined in “lin_rec709”; both should be transformed to the application’s working color space before being applied to any computations. ```xml ``` MaterialX reserves the color space name "none" to mean no color space conversion should be applied to the images and color values within their scope, regardless of any differences between stated color spaces at the local scope and document or application working color space settings. ## Units MaterialX allows floating-point and vector values to be defined in terms of a specific unit and unit type, and can automatically convert values from their specified unit into a scene unit of the same type specified by the application. This allows images and the quantities they represent such as displacement amount to be specified at an absolute real-world size, and then be converted automatically to the expected scene units of the application. Unit types are defined using a <unittypedef> element, and a set of units of that type is defined using a <unitdef> element with one or more child <unit> elements. The following unittypes and units are pre-defined by MaterialX: ```xml ``` The <unittypedef> defines the name of a unittype, while the <unitdef> defines any number of units for a unittype along with the multiplicative conversion `scale` values relative to the other units. Additional unit definitions for any unit type may be done by providing another <unitdef> with the same `unittype` attribute value. Any input or other floating-point value may specify a `unit` and/or `unittype` attribute subject to guidelines clarified throughout this document. Units and unittypes may also be provided for floatarray, vectorN and vectorNarray quantities, with all components of the vector or all values in the array using the same unit, and for "filename"-type input, in which case the `unit` and/or `unittype` attribute applies to the float or vectorN values read from those files. It is not expected that all inputs will have defined units or unittypes; in fact, it is expected that the vast majority of inputs will have neither. Units and unittypes should only be specified where specific units are important and it is reasonably expected that unit conversion may need to take place. Please refer to the [Inputs](#inputs), [Custom Node Declaration NodeDef Elements](#custom-node-declaration-nodedef-elements), [Geometric Properties](#geometric-properties) and [Geometric Nodes](#geometric-nodes) sections below and in the MaterialX Geometry Extensions document for additional specific requirements for the use of units. ## MaterialX Namespaces MaterialX supports the specification of “namespaces”, which qualify the MaterialX names of all elements within their scope. Namespaces are specified via a `namespace` attribute in a <materialx> element, and other MaterialX files which <xi:include> this .mtlx file can refer to its content without worrying about element or object naming conflicts, similar to the way namespaces are used in various programming languages. It is permissible for multiple <materialx> elements to specify the same namespace; the elements from each will simply be merged into the same namespace. <materialx> elements which do not specify a namespace will define elements into the (unnamed) global namespace. MaterialX namespaces are most commonly used to define families of custom nodes (nodedefs), material libraries, or commonly-used network shaders or nodegraphs. References to elements in a different namespace are qualified using the syntax "_namespace_:_elementname_", where _namespace_ is the namespace at the scope of the referenced element and _elementname_ is the name of the referenced element. References to elements in the same namespace, or to elements in the global namespace, should not be qualified. #### Namespace Examples Mtllib.mtlx contains the following (assuming that "..." contains any necessary material input connections and other element definitions): ```xml ... ... ... ``` Then another MaterialX file could reference these materials like this: ```xml ... ``` Similarly, if a .mtlx file defining the "site_ops" namespace defined a custom color3-typed node "mynoise" with a single float input "f", it could be used in a node graph like this: ```xml ``` A `namespace` attribute may also be added to individual <nodedef>s or <nodegraph>s, in which case the `name` and `node` of a <nodedef>, or just the `name` of a <nodegraph> will be assigned to the specified `namespace`. In a <nodegraph>, the `nodedef` must include a namespace reference if the <nodedef> to which it refers is defined in a specific namespace, even if it's the same namespace as the <nodegraph>: this is because the `namespace` only applies to the content that is created by or contained within an element, not to anything external referenced by that element. ```xml ``` ## Geometric Properties Geometric Properties, or "geomprops", are intrinsic or user-defined surface coordinate properties of geometries referenced in a specific space and/or index, and are functionally equivalent to USD's concept of "primvars". A number of geometric properties are predefined in MaterialX: `position`, `normal`, `tangent`, `bitangent`, `texcoord` and `geomcolor`, the values of which can be accessed in nodegraphs using elements of those same names; see the [Geometric Nodes](#geometric-nodes) section below for details. The value of a varying geometric property can also be used as the default value for a node input using a `defaultgeomprop` attribute. The following geometric properties are pre-defined by MaterialX: | GeomProp Name | Type | Description | | ---- | ---- | ---- | | Pobject | vector3 | Object space position | | Nobject | vector3 | Object space surface normal | | Tobject | vector3 | Object space tangent vector (index 0) | | Bobject | vector3 | Object space bitangent vector (index 0) | | Pworld | vector3 | World space position | | Nworld | vector3 | World space surface normal | | Tworld | vector3 | World space tangent vector (index 0) | | Bworld | vector3 | World space bitangent vector (index 0) | | UV0 | vector2 | Index "0" UV texture coordinate | One may also define custom geometric properties using a <geompropdef> element: ```xml ``` e.g. ```xml ``` The `type` of the geomprop may be any non-array MaterialX type, although `string`- or `filename`-type geomprops must be declared with uniform="true". The "geomprop", "space" and "index" attributes are optional; if "geomprop" is specified, it must be one of the standard geometric properties noted above, and if it is not specified, the new geomprop is a blind geometric property, e.g. one that can be referenced but which MaterialX knows no details about. The "space" and "index" attributes may only be specified if a "geomprop" attribute is specified and the standard geomproperty supports it. "Geomprop", "space" and "index" attributes may not be specified for `uniform="true"` geomprops. Once defined, a custom geomprop name may be used any place that a standard geomprop can: ```xml ``` A geompropdef may also specify a `unittype` and a `unit` to indicate that the geometric property is defined in terms of a specific unit. If a geomprop with a defined unit is accessed in a nodegraph using <geompropvalue>, the geometric property value will be converted from the unit specified by the geompropdef to the application-specified scene unit. ```xml ``` ## File Prefixes As a shorthand convenience, MaterialX allows the specification of a `fileprefix` attribute which will be prepended to input values of type "filename" (e.g. `file` inputs in `` nodes, or any shader input of type "filename") specified within the scope of the element defining the `fileprefix`. Note that `fileprefix` values are only prepended to input with a `type` attribute that explicitly states its data type as “filename”. Since the values of the prefix and the filename are string-concatenated, the value of a `fileprefix` should generally end with a "/". Fileprefixes are frequently used to split off common path components for asset directories, e.g. to define an asset's "texture root" directory. So the following snippets are equivalent: ```xml ``` Note in the second example that `` "in2" redefined `fileprefix` for itself, and that any other nodes in the same nodegraph would use the fileprefix value ("textures/color/") defined in the parent/enclosing scope. Note: Application implementations have access to both the raw input values and attributes (e.g. the "file" name and the current "fileprefix") and to fully-resolved filenames at the scope of any given element. ## Filename Substitutions Filename input values for various nodes can include one or more special strings, which will be replaced as described in the following table. Substitution strings within <>'s come from the current geometry, strings within []'s come from the MaterialX state, and strings within {}'s come from the host application environment. | Token | Description | | ---- | ---- | | <UDIM> | A special geometry token that will be replaced with the computed four digit Mari-style "udim" value at render or evaluation time based on the current point’s uv value, using the formula UDIM = 1001 + U + V*10, where U is the integer portion of the u coordinate, and V is the integer portion of the v coordinate. | | <UVTILE> | A special geometry token that will be replaced with the computed Mudbox-style "uU_vV" string, where U is 1+ the integer portion of the u coordinate, and V is 1+ the integer portion of the v coordinate. | | [interface token] | The value of a specified token declared in the containing nodegraph's <nodedef> interface; the value for the token may be set in the shader node in a material referencing the node or within a <variant>; it is an error if the same token is defined in more than one of those places for the current geometry. | | {hostattr} | The host application may define other variables which can be resolved within filenames. | | {frame} | A special string that will be replaced by the current frame number, as defined by the host environment. | | {0Nframe} | A special string that will be replaced by the current frame number padded with zeros to be N digits total (replace N with a number): e.g. {04frame} will be replaced by a 4-digit zero-padded frame number such as "0010". | Note: Implementations are expected to retain substitution strings within filenames upon export rather than "baking them out" into fully-evaluated filenames. Applications using USD for geometry and assignments may additionally use a <_geometry token_> (a.k.a. "<_primvarname_>") as the entire filename string to access an entire string primvar value unchanged (though that string value may contain the USD-supported <UDIM> token). # Nodes Nodes are individual data generation or processing "blocks". Node functionality can range from simple operations such as returning a constant color value or adding two input values, to more complex image processing operations, 3D spatial data operations, or even complete shader BxDFs. Nodes are connected together into a network or "node graph", and pass typed data streams between them. Individual node elements have the form: ```xml ...additional input or token elements... ``` where _nodecategory_ is the general "category" of the node (e.g. "image", "add" or "mix"), `name` (string, required) defines the name of this instance of the node, which must be unique within the scope it appears in, and `type` (string, required) specifies the MaterialX type (typically float, colorN, or vectorN) of the output of that node. If the application uses a different name for this instance of the node in the user interface, a `uiname` attribute may be added to the <_nodecategory_> element to indicate the name of the node as it appears to the user. Node elements may optionally specify a `version` string attribute in "_major_[._minor_]" format, requesting that a specific version of that node's definition be used instead of the default version. Normally, the types of a node's inputs and outputs are sufficient to disambiguate which signature of the applicable version of a node is intended, but if necessary, a node instantiation may also declare a specific nodedef name to precisely define exactly which node signature is desired. Please refer to the [Custom Node Declaration NodeDef Elements](#custom-node-declaration-nodedef-elements) section below for further details. MaterialX defines a number of Standard Nodes which all implementations should support as described to the degree their architecture and capabilities allow. These standard nodes are grouped into [Standard Source Nodes](#standard-source-nodes) and [Standard Operator Nodes](#standard-operator-nodes); these groups are further divided into additional subcategories of nodes. In the descriptions below, a node with an "(NG)" annotation indicates a node that is implemented using a nodegraph in the MaterialX distribution, while unannotated nodes are implemented natively in the various renderer shading languages. One can define new nodes by declaring their parameter interfaces and providing portable nodegraph or target-specific shading language implementations. Please see the [Custom Nodes](#custom-nodes) section for notes and implementation details. ## Inputs Node elements contain zero or more <input> elements defining the name, type, and value or connection for each node input. Input elements can assign an explicit uniform value by providing a `value` attribute, make a connection to the output of another node by providing a `nodename` attribute, or make a connection to the output of a nodegraph by providing a `nodegraph` attribute. An optional `output` attribute may also be provided for <input> elements, allowing the input to connect to a specific, named output of the referenced upstream node or nodegraph. If the referenced node/nodegraph has multiple outputs, `output` is required; if it has only one output, the `output` attribute of the <input> is ignored. Input elements may be defined to only accept uniform values, in which case the input may provide a `value` or a `nodename` connection to the output of a [<constant> node](#node-constant) (possibly through one or more no-op [<dot> nodes](#node-dot)) or any other node whose output is explicitly declared to be "uniform", but may not provide a `nodename` or `nodegraph` connection to any arbitrary node output or to any nodegraph output. String- and filename-type inputs are required to be "uniform", as are any array-typed inputs. Input elements may be connected to an external parameter interface in the node definition, allowing them to be assigned values from materials or node instantiations; this includes "uniform" and string/filename-type inputs, however, the same connectability restrictions listed above apply to the inputs of the material or node instance. Inputs may only be connected to node/nodegraph outputs or nodedef interface inputs of the same type, though it is permissible for a `string`-type output to be connected to a `filename`-type input (but not the other way around). A float/vectorN input of a node, or a "filename"-type input referring to an image file containing float or vectorN values, may specify a unit for its value by providing a `unit` attribute, and that unit must be one associated with the `unittype` for that input in the nodedef, if specified; please see the [Units](#units) section above for details on declaring units and unittypes. If the nodedef for a node (see the [Custom Nodes](#custom-nodes) section below) does not declare a `unittype` for an input, the node may do so; it is not permissible to provide a `unit` for a node input without a compatible `unittype` being defined on either the node or applicable nodedef. ```xml ``` Unless specified otherwise, all inputs default to a value of 0 in all channels for integer, float, color and vector types, "" for string and filename types, "false" for boolean types, the identity matrix for matrix types, and for array types, an appropriate-length array consisting of the default value for the array's base type. Standard MaterialX nodes have exactly one output, while custom nodes may have any number of outputs; please see the [Custom Nodes](#custom-nodes) section for details. ## Node Graph Elements A graph containing any number of nodes and output declarations forms a Node Graph, which may be enclosed within a <nodegraph> element to group them together into a single functional unit. Please see the [Custom Node Definition Using Node Graphs](#custom-node-definition-using-node-graphs) section below for details on how nodegraphs can be used to describe the functionality of new nodes. ```xml ...node element(s)... ...output element(s)... ``` ## Output Elements Output data streams are defined using **<output>** elements, and may be used to declare which output streams are connectable to other MaterialX elements. Within a node graph, an <output> element declares an output stream that may be connected to a shader input or to the input of a referencing node in another graph when the nodegraph is the implementation of a custom node. See the [Custom Node Definition Using Node Graphs](#custom-node-definition-using-node-graphs) section for details on the use of node graphs as node implementations. ```xml ``` Attributes for Output elements: * `name` (string, required): the name of the output * `type` (string, required): the MaterialX type of the output * `nodename` (string, optional): the name of a node at the same scope within the document, whose result value will be output. This attribute is required for <output> elements within a node graph, but is not allowed in <output> elements within a <nodedef>. * `output` (string, optional): if the node specified by `nodename` has multiple outputs, the name of the specific output to connect this <output> to. * `uniform` (boolean, optional): If set to "true", then the output of this node is treated as a uniform value, and this output may be connected to a uniform input of the same (or compatible) type. It is up to the application creating the nodegraph to ensure that the value actually is uniform. Default is "false". MaterialX also supports the following additional attributes for Output elements in applications which process node graphs in 2D space and save or cache outputs as images for efficiency, such as texture baking or image caching. These attributes do **not** affect values from this <output> connected to other nodes, e.g. they would remain in the working colorspace and retain full resolution and bitdepth precision. * `colorspace` (string, optional): the name of the color space for the output image. Applications that support color space management are expected to perform the required transformations of output colors into this space. * `width` (integer, optional): the expected width in pixels of the output image. * `height` (integer, optional): the expected height in pixels of the output image. * `bitdepth` (integer, optional): the expected per-channel bit depth of the output image, which may be used to capture expected color quantization effects. Common values for `bitdepth` are 8, 16, 32, and 64. It is up to the application to determine what the internal representation of any declared bit depth is (e.g. scaling factor, signed or unsigned, etc.). ## Standard Source Nodes Source nodes use external data and/or procedural functions to form an output; they do not have any required inputs. Each source node must define its output type. This section defines the Source Nodes that all MaterialX implementations are expected to support. Standard Source Nodes are grouped into the following classifications: [Texture Nodes](#texture-nodes), [Procedural Nodes](#procedural-nodes), [Noise Nodes](#noise-nodes), [Shape Nodes](#shape-nodes), [Geometric Nodes](#geometric-nodes) and [Application Nodes](#application-nodes). ### Texture Nodes Texture nodes are used to read filtered image data from image or texture map files for processing within a node graph. ```xml ``` Standard Texture nodes: * **`image`**: samples data from a single image, or from a layer within a multi-layer image. When used in the context of rendering a geometry, the image is mapped onto the geometry based on geometry UV coordinates, with the lower-left corner of an image mapping to the (0,0) UV coordinate (or to the fractional (0,0) UV coordinate for tiled images). The type of the <image> node determines the number of channels output, which may be less than the number of channels in the image file, outputting the first N channels from the image file. So a `float` <image> would return the Red channel of an RGB image, and a `color3` <image> would return the RGB channels of an RGBA image. If the type of the <image> node has more channels than the referenced image file, then the output will contain zero values in all channels beyond the N channels of the image file. * `file` (uniform filename): the URI of an image file. The filename can include one or more substitutions to change the file name (including frame number) that is accessed, as described in the [Filename Substitutions](#filename-substitutions) section above. * `layer` (uniform string): the name of the layer to extract from a multi-layer input file. If no value for `layer` is provided and the input file has multiple layers, then the "default" layer will be used, or "rgba" if there is no "default" layer. Note: the number of channels defined by the `type` of the `` must match the number of channels in the named layer. * `default` (float or colorN or vectorN): a default value to use if the `file` reference can not be resolved (e.g. if a <_geometry token_>, [_interface token_] or {_hostattr_} is included in the filename but no substitution value or default is defined, or if the resolved `file` URI cannot be read), or if the specified `layer` does not exist in the file. The `default` value must be the same type as the `` element itself. If `default` is not defined, the default color value will be 0.0 in all channels. * `texcoord` (vector2): the name of a vector2-type node specifying the 2D texture coordinate at which the image data is read. Default is to use the current u,v coordinate. * `uaddressmode` (uniform string): determines how U coordinates outside the 0-1 range are processed before sampling the image; see below. Default is "periodic". * `vaddressmode` (uniform string): determines how V coordinates outside the 0-1 range are processed before sampling the image; see below. Default is "periodic". * `filtertype` (uniform string): the type of texture filtering to use; standard values include "closest" (nearest-neighbor single-sample), "linear", and "cubic". If not specified, an application may use its own default texture filtering method. * **`tiledimage`** (NG): samples data from a single image, with provisions for tiling and offsetting the image across uv space. * `file` (uniform filename): the URI of an image file. The filename can include one or more substitutions to change the file name (including frame number) that is accessed, as described in the [Filename Substitutions](#filename-substitutions) section. * `default` (float or colorN or vectorN): a default value to use if the `file` reference can not be resolved (e.g. if a <geomtoken>, [interfacetoken] or {hostattr} is included in the filename but no substitution value or default is defined, or if the resolved file URI cannot be read), or if the specified `layer` does not exist in the file. The `default` value must be the same type as the `` element itself. If `default` is not defined, the default color value will be 0.0 in all channels. * `texcoord` (vector2): the name of a vector2-type node specifying the 2D texture coordinate at which the image data is read. Default is to use the current u,v coordinate. * `uvtiling` (vector2): the tiling rate for the given image along the U and V axes. Mathematically equivalent to multiplying the incoming texture coordinates by the given vector value. Default value is (1.0, 1.0). * `uvoffset` (vector2): the offset for the given image along the U and V axes. Mathematically equivalent to subtracting the given vector value from the incoming texture coordinates. Default value is (0.0, 0.0). * `realworldimagesize` (vector2): the real-world size represented by the `file` image, with unittype "distance". A `unit` attribute may be provided to indicate the units that `realworldimagesize` is expressed in. * `realworldtilesize` (vector2): the real-world size of a single square 0-1 UV tile, with unittype "distance". A `unit` attribute may be provided to indicate the units that `realworldtilesize` is expressed in. * `filtertype` (uniform string): the type of texture filtering to use; standard values include "closest" (nearest-neighbor single-sample), "linear", and "cubic". If not specified, an application may use its own default texture filtering method. * **`triplanarprojection`** (NG): samples data from three images (or layers within multi-layer images), and projects a tiled representation of the images along each of the three respective coordinate axes, computing a weighted blend of the three samples using the geometric normal. * `filex` (uniform filename): the URI of an image file to be projected in the direction from the +X axis back toward the origin. * `filey` (uniform filename): the URI of an image file to be projected in the direction from the +Y axis back toward the origin with the +X axis to the right. * `filez` (uniform filename): the URI of an image file to be projected in the direction from the +Z axis back toward the origin. * `layerx` (uniform string): the name of the layer to extract from a multi-layer input file for the x-axis projection. If no value for `layerx` is provided and the input file has multiple layers, then the "default" layer will be used, or "rgba" if there is no "default" layer. Note: the number of channels defined by the `type` of the `` must match the number of channels in the named layer. * `layery` (uniform string): the name of the layer to extract from a multi-layer input file for the y-axis projection. * `layerz` (uniform string): the name of the layer to extract from a multi-layer input file for the z-axis projection. * `default` (float or colorN or vectorN): a default value to use if any `fileX` reference can not be resolved (e.g. if a <geomtoken>, [interfacetoken] or {hostattr} is included in the filename but no substitution value or default is defined, or if the resolved file URI cannot be read) The `default` value must be the same type as the `` element itself. If `default` is not defined, the default color value will be 0.0 in all channels. * `position` (vector3): a spatially-varying input specifying the 3D position at which the projection is evaluated. Default is to use the current 3D object-space coordinate. * `normal` (vector3): a spatially-varying input specifying the 3D normal vector used for blending. Default is to use the current object-space surface normal. * `upaxis` (integer enum): which axis is considered to be "up", either 0 for X, 1 for Y, or 2 for Z. Default is Y (1). * `blend` (float): a 0-1 weighting factor for blending the three axis samples using the geometric normal, with higher values giving softer blending. Default is 1.0. * `filtertype` (uniform string): the type of texture filtering to use; standard values include "closest" (nearest-neighbor single-sample), "linear", and "cubic". If not specified, an application may use its own default texture filtering method. The following values are supported by `uaddressmode` and `vaddressmode` inputs of [image](#node-image) nodes: * “constant”: Texture coordinates outside the 0-1 range return the value of the node's `default` input. * “clamp”: Texture coordinates are clamped to the 0-1 range before sampling the image. * “periodic”: Texture coordinates outside the 0-1 range "wrap around", effectively being processed by a modulo 1 operation before sampling the image. * "mirror": Texture coordinates outside the 0-1 range will be mirrored back into the 0-1 range, e.g. u=-0.01 will return the u=0.01 texture coordinate value, and u=1.01 will return the u=0.99 texture coordinate value. Texture nodes using `file*` inputs also support the following inputs to handle boundary conditions for image file frame ranges for all `file*` inputs: * `framerange` (uniform string): a string "_minframe_-_maxframe_", e.g. "10-99", to specify the range of frames that the image file is allowed to have, usually the range of image files on disk. Default is unbounded. * `frameoffset` (integer): a number that is added to the current frame number to get the image file frame number. E.g. if `frameoffset` is 25, then processing frame 100 will result in reading frame 125 from the imagefile sequence. Default is no frame offset. * `frameendaction` (uniform string): what to do when the resolved image frame number is outside the `framerange` range: * "constant": Return the value of the node's `default` input (default action) * "clamp": Hold the minframe image for all frames before _minframe_ and hold the maxframe image for all frames after _maxframe_ * "periodic": Frame numbers "wrap around", so after the _maxframe_ it will start again at _minframe_ (and similar before _minframe_ wrapping back around to _maxframe_) * "mirror": Frame numbers "mirror" or "ping-pong" at the endpoints of framerange, so a read of the frame after _maxframe_ will return the image from frame _maxframe_-1, and a read of the frame before _minframe_ will return the image from frame _minframe_+1. Arbitrary frame number expressions and speed changes are not supported. ### Procedural Nodes Procedural nodes are used to generate value data programmatically. ```xml ``` Standard Procedural nodes: * **`constant`**: a constant value. * `value` (any non-shader-semantic type): the value to output * **`ramplr`**: a left-to-right linear value ramp. * `valuel` (float or colorN or vectorN): the value at the left (U=0) edge * `valuer` (float or colorN or vectorN): the value at the right (U=1) edge * `texcoord` (vector2): the name of a vector2-type node specifying the 2D texture coordinate at which the ramp interpolation is evaluated. Default is to use the first set of texture coordinates. * **`ramptb`**: a top-to-bottom linear value ramp. * `valuet` (float or colorN or vectorN): the value at the top (V=1) edge * `valueb` (float or colorN or vectorN): the value at the bottom (V=0) edge * `texcoord` (vector2): the name of a vector2-type node specifying the 2D texture coordinate at which the ramp interpolation is evaluated. Default is to use the first set of texture coordinates. * **`ramp4`** (NG): a 4-corner bilinear value ramp. * `valuetl` (float or colorN or vectorN): the value at the top-left (U0V1) corner * `valuetr` (float or colorN or vectorN): the value at the top-right (U1V1) corner * `valuebl` (float or colorN or vectorN): the value at the bottom-left (U0V0) corner * `valuebr` (float or colorN or vectorN): the value at the bottom-right (U1V0) corner * `texcoord` (vector2, optional): the name of a vector2-type node specifying the 2D texture coordinate at which the ramp interpolation is evaluated. Default is to use the first set of texture coordinates. * **`splitlr`**: a left-right split matte, split at a specified U value. * `valuel` (float or colorN or vectorN): the value at the left (U=0) edge * `valuer` (float or colorN or vectorN): the value at the right (U=1) edge * `center` (float): a value representing the U-coordinate of the split; all pixels to the left of "center" will be `valuel`, all pixels to the right of "center" will be `valuer`. Default is 0.5. * `texcoord` (vector2): the name of a vector2-type node specifying the 2D texture coordinate at which the split position is evaluated. Default is to use the first set of texture coordinates. * **`splittb`**: a top-bottom split matte, split at a specified V value. * `valuet` (float or colorN or vectorN): the value at the top (V=1) edge * `valueb` (float or colorN or vectorN): the value at the bottom (V=0) edge * `center` (float): a value representing the V-coordinate of the split; all pixels above "center" will be `valuet`, all pixels below "center" will be `valueb`. Default is 0.5. * `texcoord` (vector2): the name of a vector2-type node specifying the 2D texture coordinate at which the split position is evaluated. Default is to use the first set of texture coordinates. * **`randomfloat`**: Produces a stable randomized float value between 'min' and 'max', based on an 'input' signal and 'seed' value. Uses a 2d cellnoise function to produce the output. * `in` (float or integer): Initial randomization seed, default is 0. * `min` (float): The minimum output value, default is 0.0. * `max` (float): The maximum output value, default is 1.0. * `seed` (integer): Additional randomization seed, default is 0. * **`randomcolor`**: Produces a randomized RGB color within a randomized hue, saturation and brightness range, based on an 'input' signal and 'seed' value. Output type color3. * `in` (float or integer): Initial randomization seed, default is 0. * `huelow` (float): The minimum hue value, default is 0.0. * `huehigh` (float): The maximum hue value, default is 1.0. * `saturationlow` (float): The minimum saturation value, default is 0.0. * `saturationhigh` (float): The maximum saturation value, default is 1.0. * `brightnesslow` (float): The minimum brightness value, default is 0.0. * `brightnesshigh` (float): The maximum brightness value, default is 1.0. * `seed` (integer): Additional randomization seed, default is 0. To scale or offset `rampX` or `splitX` input coordinates, use a <texcoord> or similar Geometric node processed by vector2 <multiply>, <rotate> and/or <add> nodes, and connect to the node's `texcoord` input. ### Noise Nodes Noise nodes are used to generate value data using one of several procedural noise functions. ```xml ``` Standard Noise nodes: * **`noise2d`**: 2D Perlin noise in 1, 2, 3 or 4 channels. * `amplitude` (float or vectorN): the center-to-peak amplitude of the noise (peak-to-peak amplitude is 2x this value). Default is 1.0. * `pivot` (float): the center value of the output noise; effectively, this value is added to the result after the Perlin noise is multiplied by `amplitude`. Default is 0.0. * `period` (float or vectorN): the positive integer distance at which the noise function returns the same value for texture coordinates repeated at that step. Default is 0, meaning the noise is not periodic. * `texcoord` (vector2): the 2D texture coordinate at which the noise is evaluated. Default is to use the first set of texture coordinates. * **`noise3d`**: 3D Perlin noise in 1, 2, 3 or 4 channels. * `amplitude` (float or vectorN): the center-to-peak amplitude of the noise (peak-to-peak amplitude is 2x this value). Default is 1.0. * `pivot` (float): the center value of the output noise; effectively, this value is added to the result after the Perlin noise is multiplied by `amplitude`. Default is 0.0. * `period` (float or vectorN): the positive integer distance at which the noise function returns the same value for position coordinates repeated at that step. Default is 0, meaning the noise is not periodic. * `position` (vector3): the 3D position at which the noise is evaluated. Default is to use the current 3D object-space coordinate. * **`fractal3d`**: Zero-centered 3D Fractal noise in 1, 2, 3 or 4 channels, created by summing several octaves of 3D Perlin noise, increasing the frequency and decreasing the amplitude at each octave. * `amplitude` (float or vectorN): the center-to-peak amplitude of the noise (peak-to-peak amplitude is 2x this value). Default is 1.0. * `octaves` (integer): the number of octaves of noise to be summed. Default is 3. * `lacunarity` (float or vectorN): the exponential scale between successive octaves of noise; must be an integer value if period is non-zero so the result is properly tileable. Default is 2.0. VectorN-output types can provide either a float (isotropic) or vectorN (anisotropic) values for `lacunarity` and `diminish`. * `diminish` (float or vectorN): the rate at which noise amplitude is diminished for each octave. Should be between 0.0 and 1.0; default is 0.5. VectorN-output types can provide either a float (isotropic) or vectorN (anisotropic) values for `lacunarity` and `diminish`. * `period` (float or vectorN): the positive integer distance at which the noise function returns the same value for position coordinates repeated at that step. Default is 0, meaning the noise is not periodic. * `position` (vector3): the 3D position at which the noise is evaluated. Default is to use the current 3D object-space coordinate. * **`cellnoise2d`**: 2D cellular noise, 1 or 3 channels (type float or vector3). * `period` (float or vector3): the positive integer distance at which the noise function returns the same value for texture coordinates repeated at that step. Default is 0, meaning the noise is not periodic. * `texcoord` (vector2): the 2D position at which the noise is evaluated. Default is to use the first set of texture coordinates. * **`cellnoise3d`**: 3D cellular noise, 1 or 3 channels (type float or vector3). * `period` (float or vector3): the positive integer distance at which the noise function returns the same value for position coordinates repeated at that step. Default is 0, meaning the noise is not periodic. * `position` (vector3): the 3D position at which the noise is evaluated. Default is to use the current 3D object-space coordinate. * **`worleynoise2d`**: 2D Worley noise using centered jitter, outputting float (distance metric to closest feature), vector2 (distance metrics to closest 2 features) or vector3 (distance metrics to closest 3 features). * `jitter` (float): amount to jitter the cell center position, with smaller values creating a more regular pattern. Default is 1.0. * `style` (integer): the output style, one of "distance" (distance to the cell center), or "solid" (constant value for each cell). * `texcoord` (vector2): the 2D position at which the noise is evaluated. Default is to use the first set of texture coordinates. * **`worleynoise3d`**: 3D Worley noise using centered jitter, outputting float (distance metric to closest feature), vector2 (distance metrics to closest 2 features) or vector3 (distance metrics to closest 3 features). * `jitter` (float): amount to jitter the cell center position, with smaller values creating a more regular pattern. Default is 1.0. * `style` (integer): the output style, one of "distance" (distance to the cell center), or "solid" (constant value for each cell). Default is "distance". * `position` (vector3): the 3D position at which the noise is evaluated. Default is to use the current 3D object-space coordinate. * **`unifiednoise2d`** (NG): a single node supporting 2D Perlin, Cell, Worley or Fractal noise in a unified interface. * `type` (integer): The type of noise function to use. One of 0 (Perlin), 1 (Cell), 2 (Worley), or 3 (Fractal); default is Perlin. * `texcoord` (vector2): the input 2d space. Default is the first texture coordinates. * `freq` (vector2): Adjusts the noise frequency, with higher values producing smaller noise shapes. Default is (1,1). * `offset` (vector2): Shift the noise in 2d space. Default is (0,0). * `jitter` (float): Adjust uniformity of Worley noise; for other noise types jitters the results. * `outmin` (float): The lowest values fit to the noise. Default is 0.0. * `outmax` (float): The highest values fit to the noise. Default is 1.0. * `clampoutput` (boolean): Clamp the output to the min and max output values. * `octaves` (integer): The number of octaves of Fractal noise to be generated. Default is 3. * `lacunarity` (float): The exponential scale between successive octaves of Fractal noise. Default is 2.0. * `diminish` (float): The rate at which noise amplitude is diminished for each octave of Fractal noise. Default is 0.5. * **`unifiednoise3d`** (NG): a single node supporting 3D Perlin, Cell, Worley or Fractal noise in a unified interface. * `type` (integer): The type of noise function to use. One of 0 (Perlin), 1 (Cell), 2 (Worley), or 3 (Fractal); default is Perlin. * `position` (vector3): the input 3d space. Default is position in object-space. * `freq` (vector3): Adjusts the noise frequency, with higher values producing smaller noise shapes. Default is (1,1,1). * `offset` (vector3): Shift the noise in 3d space. Default is (0,0,0). * `jitter` (float): Adjust uniformity of Worley noise; for other noise types jitters the results. * `outmin` (float): The lowest values fit to the noise. Default is 0.0. * `outmax` (float): The highest values fit to the noise. Default is 1.0. * `clampoutput` (boolean): Clamp the output to the min and max output values. * `octaves` (integer): The number of octaves of Fractal noise to be generated. Default is 3. * `lacunarity` (float): The exponential scale between successive octaves of Fractal noise. Default is 2.0. * `diminish` (float): The rate at which noise amplitude is diminished for each octave of Fractal noise. Default is 0.5. To scale or offset the noise pattern generated by a 3D noise node such as `noise3d`, `fractal3d` or `cellnoise3d`, use a <position> or other [Geometric Node](#geometric-nodes) (see below) connected to vector3 <multiply> and/or <add> nodes, in turn connected to the noise node's `position` input. To scale or offset the noise pattern generated by a 2D noise node such as `noise2d` or `cellnoise2d`, use a <texcoord> or similar Geometric node processed by vector2 <multiply>, <rotate> and/or <add> nodes, and connect to the node's `texcoord` input. ### Shape Nodes Shape nodes are used to generate shapes or patterns in UV space. ```xml ``` Standard Shape nodes: * **`checkerboard`** (NG): a 2D checkerboard pattern. Output type color3. * `color1` (color3): The first color used in the checkerboard pattern. * `color2` (color3): The second color used in the checkerboard pattern. * `uvtiling` (vector2): The tiling of the checkerboard pattern along each axis, with higher values producing smaller squares. Default is (8, 8). * `uvoffset` (vector2): The offset of the checkerboard pattern along each axis. Default is (0, 0). * `texcoord` (vector2): The input 2d space. Default is the first texture coordinates. * **`line`** (NG): Returns 1 if texcoord is at less than radius distance from a line segment defined by point1 and point2; otherwise returns 0. Output type float. * `texcoord` (vector2): The input 2d space. Default is the first texture coordinates. * `center` (vector2): An offset value added to both the point1 and point2 coordinates, default is (0, 0). * `radius` (float): The radius or "half thickness" of the line, default is 0.1. * `point1` (vector2): The UV coordinate of the first endpoint, default is (0.25, 0.25). * `point2` (vector2): The UV coordinate of the second endpoint, default is (0.75, 0.75). * **`circle`** (NG): Returns 1 if texcoord is inside a circle defined by center and radius; otherwise returns 0. Output type float. * `texcoord` (vector2): The input 2d space. Default is the first texture coordinates. * `center` (vector2): The center coordinate of the circle, default is (0, 0). * `radius` (float): The radius of the circle, default is 0.5. * **`cloverleaf`** (NG): Returns 1 if texcoord is inside a cloverleaf shape described by four semicircles on the edges of a square defined by center and radius; otherwise returns 0. Output type float. * `texcoord` (vector2): The input 2d space. Default is the first texture coordinates. * `center` (vector2): 2x the coordinate of the center of the cloverleaf pattern, default is (0, 0); a value of (1,1) will center the cloverleaf in the 0-1 UV space. * `radius` (float): The radius of the complete cloverleaf pattern, default is 0.5 resulting in a cloverleaf pattern filling the 0-1 UV boundary. * **`hexagon`** (NG): Returns 1 if texcoord is inside a hexagon shape inscribed by a circle defined by center and radius; otherwise returns 0. Output type float. * `texcoord` (vector2): The input 2d space. Default is the first texture coordinates. * `center` (vector2): The center coordinate of the hexagon, default is (0, 0). * `radius` (float): The inner (edge center to opposite edge center) radius of the hexagon, default is 0.5. * **`grid`** (NG): Creates a grid pattern of (1, 1, 1) white lines on a (0, 0, 0) black background with the given tiling, offset, and line thickness. Pattern can be regular or staggered. Output type color3. * `texcoord` (vector2): The input 2d space. Default is the first texture coordinates. * `uvtiling` (vector2): Tiling factor, with higher values producing a denser grid. Default is (1, 1). * `uvoffset` (vector2): UV Offset, default is (0, 0). * `thickness` (float): The thickness of the grid lines, default is 0.05. * `staggered` (boolean): If true, every other row will be offset 50% to produce a "brick wall" pattern. Default is false. * **`crosshatch`** (NG): Creates a crosshatch pattern with the given tiling, offset, and line thickness. Pattern can be regular or staggered. Output type color3. * `texcoord` (vector2): The input 2d space. Default is the first texture coordinates. * `uvtiling` (vector2): Tiling factor, with higher values producing a denser grid. Default is (1, 1). * `uvoffset` (vector2): UV Offset, default is (0, 0). * `thickness` (float): The thickness of the grid lines, default is 0.05. * `staggered` (boolean): If true, every other row will be offset 50% to produce an "alternating diamond" pattern. Default is false. * **`tiledcircles`** (NG): Creates a black and white pattern of circles with a defined tiling and size (diameter). Pattern can be regular or staggered. Output type color3. * `texcoord` (vector2): The input 2d space. Default is the first texture coordinates. * `uvtiling` (vector2): Tiling factor, with higher values producing a denser grid. Default is (1, 1). * `uvoffset` (vector2): UV Offset, default is (0, 0). * `size` (float): The diameter of the circles in the tiled pattern, default is 0.5; if `size` is 1.0, the edges of adjacent circles in the tiling will exactly touch. * `staggered` (boolean): If true, every other row will be offset 50%, and the spacing of the tiling will be adjusted in the V direction to center the circles on the vertices of an equilateral triangle grid. Default is false. * **`tiledcloverleafs`** (NG): Creates a black and white pattern of cloverleafs with a defined tiling and size (diameter of the circles circumscribing the shape). Pattern can be regular or staggered. Output type color3. * `texcoord` (vector2): The input 2d space. Default is the first texture coordinates. * `uvtiling` (vector2): Tiling factor, with higher values producing a denser grid. Default is (1, 1). * `uvoffset` (vector2): UV Offset, default is (0, 0). * `size` (float): The outer diameter of the cloverleafs in the tiled pattern, default is 0.5; if `size` is 1.0, the edges of adjacent cloverleafs in the tiling will exactly touch. * `staggered` (boolean): If true, an additional pattern of cloverleafs will be generated in between the originals offset by 50% in both U and V. Default is false. * **`tiledhexagons`** (NG): Creates a black and white pattern of hexagons with a defined tiling and size (diameter of the circles circumscribing the shape). Pattern can be regular or staggered. Output type color3. * `texcoord` (vector2): The input 2d space. Default is the first texture coordinates. * `uvtiling` (vector2): Tiling factor, with higher values producing a denser grid. Default is (1, 1). * `uvoffset` (vector2): UV Offset, default is (0, 0). * `size` (float): The inner diameter of the hexagons in the tiled pattern, default is 0.5; if `size` is 1.0, the edges of adjacent hexagons in the U-direcction tiling will exactly touch. * `staggered` (boolean): If true, every other row will be offset 50%, and the spacing of the tiling will be adjusted in the V direction to center the hexagons on the vertices of an equilateral triangle grid. Default is false. ### Geometric Nodes Geometric nodes are used to reference local geometric properties from within a node graph: ```xml ``` Standard Geometric nodes: * **`position`**: the coordinates associated with the currently-processed data, as defined in a specific coordinate space. This node must be of type vector3. * `space` (uniform string): the name of the coordinate space in which the position is defined. Default is "object", see [Geometric Spaces](#geometric-spaces) for supported options. * **`normal`**: the geometric normal associated with the currently-processed data, as defined in a specific coordinate space. This node must be of type vector3. * `space` (uniform string): the name of the coordinate space in which the normal vector is defined. Default is "object", see [Geometric Spaces](#geometric-spaces) for supported options. * **`tangent`**: the geometric tangent vector associated with the currently-processed data, as defined in a specific coordinate space. This node must be of type vector3. * `space` (uniform string): the name of the coordinate space in which the tangent vector is defined. Default is "object", see [Geometric Spaces](#geometric-spaces) for supported options. * `index` (uniform integer): the index of the texture coordinates against which the tangent is computed. The default index is 0. * **`bitangent`**: the geometric bitangent vector associated with the currently-processed data, as defined in a specific coordinate space. This node must be of type vector3. * `space` (uniform string): the name of the coordinate space in which the bitangent vector is defined. Default is "object", see [Geometric Spaces](#geometric-spaces) for supported options. * `index` (uniform integer): the index of the texture coordinates against which the tangent is computed. The default index is 0. * **`bump`**: offset the surface normal by a scalar value. This node must be of type type vector3, and is generally connected to a shader node's "normal" input. * `height` (float): Amount to offset the surface normal. * `scale` (float): Scalar to adjust the height amount. * `normal` (vector3): Surface normal; defaults to the current world-space normal. * `tangent` (vector3): Surface tangent vector, defaults to the current world-space tangent vector. * **`texcoord`**: the 2D or 3D texture coordinates associated with the currently-processed data. This node must be of type vector2 or vector3. * `index` (uniform integer): the index of the texture coordinates to be referenced. The default index is 0. * **`geomcolor`**: the color associated with the current geometry at the current `position`, generally bound via per-vertex color values. Can be of type float, color3 or color4, and must match the type of the "color" bound to the geometry. * `index` (uniform integer): the index of the color to be referenced, default is 0. * **`geompropvalue`**: the value of the specified varying geometric property (defined using <geompropdef>) of the currently-bound geometry. This node's type must match that of the referenced geomprop. * `geomprop` (uniform string): the geometric property to be referenced. * `default` (same type as the geomprop's value): a value to return if the specified `geomprop` is not defined on the current geometry. * **`geompropvalueuniform`**: the value of the specified uniform geometric property (defined using <geompropdef>) of the currently-bound geometry. This node's type must match that of the referenced geomprop. * `geomprop` (uniform string): the geometric property to be referenced. * `default` (same type as the geomprop's value): a value to return if the specified `geomprop` is not defined on the current geometry. Additionally, the `geomcolor` and `geompropvalue` nodes for color3/color4-type properties can take a `colorspace` attribute to declare what colorspace the color property value is in; the default is "none" for no colorspace declaration (and hence no colorspace conversion). #### Geometric Spaces The following values are supported by the `space` inputs of Geometric nodes and when transforming from one space to another: * "model": The local coordinate space of the geometry, before any local deformations or global transforms have been applied. * "object": The local coordinate space of the geometry, after local deformations have been applied, but before any global transforms. * "world": The global coordinate space of the geometry, after local deformations and global transforms have been applied. ### Application Nodes Application nodes are used to reference application-defined properties within a node graph, and have no inputs: ```xml