Loading...
Searching...
No Matches
HdMaterialSchema Class Reference

The Material schema is a container schema that provides the correct material definition per render context. More...

#include <materialSchema.h>

+ Inheritance diagram for HdMaterialSchema:

Public Member Functions

HD_API TfTokenVector GetRenderContexts () const
 The following diagram depicts an example scene index prim "Plastic_Material".
 
HD_API HdMaterialNetworkSchema GetMaterialNetwork () const
 Return the material network schema for the universalRenderContext.
 
HD_API HdMaterialNetworkSchema GetMaterialNetwork (TfToken const &renderContext) const
 Return the material network schema for the given render context.
 
HD_API HdMaterialNetworkSchema GetMaterialNetwork (TfTokenVector const &renderContexts) const
 Return the first material network schema found among the given list of render contexts, falling back to the universal context if none of the provided contexts are found.
 
- Public Member Functions inherited from HdSchema
 HdSchema (HdContainerDataSourceHandle container)
 
HD_API HdContainerDataSourceHandle GetContainer () const
 Returns the container data source that this schema is interpreting.
 
HD_API bool IsDefined () const
 
 operator bool () const
 Returns true if this schema is applied on top of a non-null container.
 

Static Public Member Functions

static HD_API TfToken GetLocatorTerminal (HdDataSourceLocator const &locator)
 
static HD_API TfToken GetLocatorTerminal (HdDataSourceLocator const &locator, TfToken const &renderContext)
 
static HD_API TfToken GetLocatorTerminal (HdDataSourceLocator const &locator, TfTokenVector const &Contexts)
 
Schema location
static HD_API const TfTokenGetSchemaToken ()
 Returns a token where the container representing this schema is found in a container by default.
 
static HD_API const HdDataSourceLocatorGetDefaultLocator ()
 Returns an HdDataSourceLocator (relative to the prim-level data source) where the container representing this schema is found by default.
 
Schema construction
static HD_API HdContainerDataSourceHandle BuildRetained (size_t count, const TfToken *names, const HdDataSourceBaseHandle *values)
 

Schema retrieval

 HdMaterialSchema (HdContainerDataSourceHandle container)
 
static HD_API HdMaterialSchema GetFromParent (const HdContainerDataSourceHandle &fromParentContainer)
 Retrieves a container data source with the schema's default name token "material" from the parent container and constructs a HdMaterialSchema instance.
 

Additional Inherited Members

- Public Types inherited from HdSchema
using UnderlyingDataSource = HdContainerDataSource
 
- Protected Member Functions inherited from HdSchema
template<typename T >
T::Handle _GetTypedDataSource (TfToken name) const
 Returns a datasource of the requested type for the given name: schema implementations can use this to ask for child containers, sampled values, vectors, etc.
 
- Protected Attributes inherited from HdSchema
HdContainerDataSourceHandle _container
 

Detailed Description

The Material schema is a container schema that provides the correct material definition per render context.

For example, a material may specify several render contexts like the universalRenderContext (""), Renderman ("ri"), Storm ("glslfx"), etc. Each render context will then provide the specific definition for the renderer, which is defined by the MaterialNetwork schema. The universalRenderContext applies to all renderers.

See "Custom Code: Schema Methods" section for ASCII art diagram.

Definition at line 65 of file materialSchema.h.

Constructor & Destructor Documentation

◆ HdMaterialSchema()

HdMaterialSchema ( HdContainerDataSourceHandle  container)
inline

Definition at line 71 of file materialSchema.h.

Member Function Documentation

◆ GetDefaultLocator()

static HD_API const HdDataSourceLocator & GetDefaultLocator ( )
static

Returns an HdDataSourceLocator (relative to the prim-level data source) where the container representing this schema is found by default.

◆ GetFromParent()

static HD_API HdMaterialSchema GetFromParent ( const HdContainerDataSourceHandle &  fromParentContainer)
static

Retrieves a container data source with the schema's default name token "material" from the parent container and constructs a HdMaterialSchema instance.

Because the requested container data source may not exist, the result should be checked with IsDefined() or a bool comparison before use.

◆ GetMaterialNetwork() [1/3]

HD_API HdMaterialNetworkSchema GetMaterialNetwork ( ) const

Return the material network schema for the universalRenderContext.

◆ GetMaterialNetwork() [2/3]

HD_API HdMaterialNetworkSchema GetMaterialNetwork ( TfToken const &  renderContext) const

Return the material network schema for the given render context.

Note
This does not fall back to the universalRenderContext.

◆ GetMaterialNetwork() [3/3]

HD_API HdMaterialNetworkSchema GetMaterialNetwork ( TfTokenVector const &  renderContexts) const

Return the first material network schema found among the given list of render contexts, falling back to the universal context if none of the provided contexts are found.

◆ GetRenderContexts()

HD_API TfTokenVector GetRenderContexts ( ) const

The following diagram depicts an example scene index prim "Plastic_Material".

"Plastic_Material" is a scene index prim that has multiple container data sources, like 'material' (HdMaterialSchema) and 'materialOverride' (HdMaterialOverrideSchema). "Plastic_Material" as a scene index prim also has a scene index prim type, which is type 'material'. (See HdPrimTypeTokens). Note the following:

  1. The data flows from left to right.
  2. The lines between "materialOverride" and "interfaceMappings" are not true connections and are not backed by the MaterialConnection schema. Each item within "materialOverride" and "interfaceMappings" is loosely coupled by their matching names.
  3. The connections in the diagram are drawn with an 'o' to indicate the source where the connection was authored, and these connections are backed by the MaterialConnection schema.
    +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------—+ | |
    "Plastic_Material" [scene index prim name]
    +--------------------------------—+ +-----------------------------------------------------------------------------------------------------------------------------------------------------—+
    | | materialOverride | | material | | | | +---------------------------—+ | | +-----------------------------------------------------------------------------------------------------------------------------------------------—+ | | | | | interfaceValues | | | | ri [materialNetwork for Renderman render context] | | | | | | | | | | +--------------------—+ +-----------------------------------------------------------------------------—+ +----------------—+ | | | | | | *globalVal = 0.2----------—+-+-—+ | | |interface [parameters] | | nodes | |terminals | | | | | | | | | | | | | | | +-----------------—+ | | | | | | | | | *globalSpecularKface = 0.666-+-+-+ +-+–+–+-+*globalVal o--------—+—+ | |"Color_Manipulate" | | +-+-o*surface | | | | | | | | | | | | | | | | |[materialNode] | | | | | | | | | | +---------------------------—+ | +–+-+–+–+-+*globalSpecularKface o-+-+ | | | | | | | | | | | | | | | | | | | +—+-+-*adjustVal *out+-—+ | | +----------------—+ | | | | +--------------------------------—+ | | +--------------------—+ | | | | | | | | | | | | | | | | | +-----------------—+ | +--------------------—+ +-----------------—+ | | | | | | | | | | | | |"MaterialLayer" | |"PxrSurface" | | | | | | | | | | | | | |[materialNode] | |[materialNode] | | | | | | | | | | | | | | | | | | | | | | | | | +-+—+------------------------—+–+–*specularKface *out+–+-o*materialIn *out+-+-+ | | | | | | | | | | | | | | | | | | | | | | | | *diffuseK = 0.12 | | | | | | | | | | | | +-------------------—+ | | | +-----------------—+ | | | | | | | | | |"Color_RetargetLayer" | | | | | | | | | | | | | |[materialNode] | +–+-o*someInput_A | | | | | | | | | | | | | | | | | | | | | +—+-+-*valRemapAmount *out+--—+-o*someInput_B | | | | | | | | | | | | | | | | |
    +-------------------—+ +--------------------—+
    | | | +-----------------------------------------------------------------------------—+ | | | | | | | | | | | +-----------------------------------------------------------------------------------------------------------------------------------------------—+ | | | | | | | +-----------------------------------------------------------------------------------------------------------------------------------------------------—+ | | | +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------—+ Convenience method to get the available render contexts. This is preferable to HdMaterialSchema::GetContainer()->GetNames().

◆ GetSchemaToken()

static HD_API const TfToken & GetSchemaToken ( )
static

Returns a token where the container representing this schema is found in a container by default.


The documentation for this class was generated from the following file: