Nuke binary plugins 15.1.4
 
Loading...
Searching...
No Matches
slr::SlrSurfaceMaterial Class Reference

#include <SlrSurfaceShader.h>

Public Member Functions

 ~SlrSurfaceMaterial ()
 Releases the SlrShader allocations in the SlrSurfaceShaderGroup.
 
int32_t renderVersion () const
 Current render version the material has been updated at.
 
void setRenderVersion (int32_t v)
 
const std::string & path () const
 Return the path of the surface_group output shader, if there is one. Used mainly for debugging.
 
SlrSurfaceShader * surface () const
 
SlrGeometryShader * displacement () const
 
const ShadingLayerReqSet & inputPrimvars () const
 
const ShadingLayerReq parametricStPrimvar () const
 
const ShadingLayerReqSet & writableShadingLayers () const
 
const SlrSurfaceShader::VisibilityTraitsvisibilityTraits () const
 Visibility traits from the surface shader.
 
void validateShader (SlrRenderContext &slrtx)
 Calls the output shader, if assigned, and sets the material channels.
 
void requestResources (const DD::Image::ChannelSet &request_channels, SlrRenderContext &slrtx)
 Calls requestResources() on the set of input shaders.
 
void initializeForShading (uint32_t num_shading_threads, SlrRenderContext &slrtx)
 Calls initializeForShading() on the set of input shaders.
 
float surfaceShader (const SlrShadingContext &stx, DD::Image::Pixel &out)
 Redirects to surface_group.output, if valid.
 
float displacementBound ()
 

Static Public Member Functions

static SlrSurfaceMaterialtranslateUsgMaterial (SlrRenderContext &slrtx, const fdk::TimeValue &time, const usg::Path &material_path, SlrSurfaceMaterial *existing_slr_material)
 

Public Attributes

SlrSurfaceShaderGroup surfaceGroup
 Slr(ScanlineRender) Shader group - managed externally.
 
SlrGeometryShaderGroup displacementGroup
 Slr(ScanlineRender) Shader group - managed externally.
 
DD::Image::Hash hash
 Global hash of object material.
 
DD::Image::ChannelSet textureChannels
 All the channels from all texture samplers.
 
DD::Image::ChannelSet outputChannels
 All the channels this material outputs.
 
DD::Image::Format outputFormat
 Nominal Format if the material represents a texture.
 
SlrShader::InputBindingList textureBindings
 List of all texture bindings used in material.
 
bool displacementEnabled
 Is displacement enabled?
 
int displacementSubdivisionLevel
 What recursion level to subdivide to.
 
fdk::Vec3f displacementBounds
 Displacement bounds scaled by local-to-world matrix.
 

Protected Attributes

int32_t _renderVersion
 Updated each time material is refreshed.
 

Detailed Description

Entry point for SlrSurfaceShader and SlrGeometryShader groups.

There's one of these created for each enabled SlrPrimInfo in the primary render scene.

They're stored in the SlrRenderContext, owned by the renderer, and are are static for the entire render session so any texture bindings remain stable and thread safe through the entirety of the render.

Member Function Documentation

◆ translateUsgMaterial()

SlrSurfaceMaterial * slr::SlrSurfaceMaterial::translateUsgMaterial ( SlrRenderContext &  slrtx,
const fdk::TimeValue &  time,
const usg::Path &  material_path,
SlrSurfaceMaterial existing_slr_material 
)
static

Fills in/updates the SlrSurfaceMaterial with the SlrShaders created from the enabled SlrPrimInfo and its assigned material prim path.

The priminfo will be updated to point at any created or existing material. This is usually called by the renderer in its _validate() method as all the shaders are required to know what input textures and channels the renderer needs to output and request.

The SlrRenderContext holds the shared resources that are pointed to by the SlrPrimInfos.

References slr::SlrShaderGroup< ShaderT >::deleteShaders(), slr::SlrShaderGroup< ShaderT >::output, slr::SlrShaderGroup< ShaderT >::propertyHash, slr::SlrShaderGroup< ShaderT >::shaders, surfaceGroup, and slr::SlrShaderGroup< ShaderT >::topologyHash.

◆ inputPrimvars()

const ShadingLayerReqSet & slr::SlrSurfaceMaterial::inputPrimvars ( ) const

The list of primvars this material needs from the Gprim it's assigned to. At tessellation time this list is used to build the array of values read from prim.

◆ parametricStPrimvar()

const ShadingLayerReq slr::SlrSurfaceMaterial::parametricStPrimvar ( ) const

Return the primary 'st' primvar name this material uses for parametric surface evaluation. Note that this is usually the same primvar that's used for texture coordinates, but there can be different texture primvars used in each texture sampler, so it's not obvious what is the 'primary' parametric primvar.



©2024 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.foundry.com