Nuke binary plugins  14.0.8
slr::SlrSurfaceMaterial Class Reference

Public Member Functions

 SlrSurfaceMaterial (SlrRenderContext *slrtx)
 
 ~SlrSurfaceMaterial ()
 Releases the SlrShader allocations in the SlrSurfaceShaderGroup.
 
const std::string & path () const
 Return the path of the surface_group output shader, if there is one.
 
SlrSurfaceShader * surface () const
 
SlrGeometryShader * displacement () const
 
void validateShader (const SlrRenderContext &slrtx)
 Calls the output shader, if assigned, and sets the material channels.
 
void requestTextures (const DD::Image::ChannelSet &request_channels, SlrRenderContext &slrtx)
 Calls requestTextures() 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 (SlrShadingContext &stx, DD::Image::Pixel &out)
 Redirects to surface_group.output, if valid.
 
void displacementShader (const SlrShadingContext &stx, SlrVertex &out)
 Redirects to surface_group.output, if valid.
 
float displacementBound ()
 

Static Public Member Functions

static void translatePrimMaterial (const usg::StageConstRef &stage, const fdk::TimeValue &time, const usg::Prim &prim, SlrPrimInfo &primInfo, SlrRenderContext &slrtx)
 

Public Attributes

SlrSurfaceShaderGroup surface_group
 Slr(ScanlineRender) Shader group - managed externally.
 
SlrGeometryShaderGroup displacement_group
 Slr(ScanlineRender) Shader group - managed externally.
 
DD::Image::Hash hash
 Global hash of object material.
 
DD::Image::ChannelSet texture_channels
 All the channels from all texture samplers.
 
DD::Image::ChannelSet output_channels
 All the channels this material outputs.
 
DD::Image::Format output_format
 Nominal Format if the material represents a texture.
 
SlrShader::InputBindingList texture_bindings
 List of all texture bindings used in material.
 
bool displacement_enabled
 Is displacement enabled?
 
int displacement_subdivision_level
 What recursion level to subdivide to.
 
fdk::Vec3f displacement_bounds
 Displacement bounds scaled by local-to-world matrix.
 

Protected Attributes

SlrRenderContext * _slrtx
 Used to build OutputContext for shaders, if needed.
 

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 active_surface_materials list, 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

void slr::SlrSurfaceMaterial::translatePrimMaterial ( const usg::StageConstRef &  stage,
const fdk::TimeValue &  time,
const usg::Prim &  prim,
SlrPrimInfo primInfo,
SlrRenderContext &  slrtx 
)
static

Fills in/updates the SlrRenderContext with the SlrShaders created from the enabled SlrPrimInfos assuming the source Prims in the stage have materials assigned.

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 stored in each SlrScene time sample.

References slr::SlrShaderGroup< ShaderT >::deleteShaders(), slr::SlrPrimInfo::material, slr::SlrPrimInfo::object_index, slr::SlrShaderGroup< ShaderT >::output, slr::SlrShaderGroup< ShaderT >::property_hash, slr::SlrShaderGroup< ShaderT >::shaders, surface_group, and slr::SlrShaderGroup< ShaderT >::topology_hash.



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