Nuke binary plugins 16.0.1
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Loading...
Searching...
No Matches
slr::SlrShadingContext Class Referenceabstract

#include <SlrShadingContext.h>

Public Member Functions

const SlrShadingContextpreviousStx () const
 
SlrShadingContextcreateEditableShadingContextCopy (bool copyShadingLayers=true) const
 
int32_t nShadingChannels () const
 Number of assigned shading channels.
 
void setShadingParamsToZero ()
 Set all param channels in the Stx to 0. Does nothing if Stx is not writable.
 
virtual bool setIntShadingLayer (ndk::Channel chan, int32_t value)=0
 
virtual bool setFloatShadingLayer (ndk::Channel chan, float value)=0
 
virtual bool setVec2fShadingLayer (ndk::Channel startChan, const fdk::Vec2f &value)=0
 
virtual bool setVec3fShadingLayer (ndk::Channel startChan, const fdk::Vec3f &value)=0
 
virtual bool setVec4fShadingLayer (ndk::Channel startChan, const fdk::Vec4f &value)=0
 
virtual bool setDual2fShadingLayer (const Dual2Chans &chans, const Dual2f &value)=0
 
virtual bool setDual2dShadingLayer (const Dual2Chans &chans, const Dual2d &value)=0
 
virtual bool setDual2Vec2fShadingLayer (const Dual2Chans &chans, const Dual2Vec2f &value)=0
 
virtual bool setDual2Vec3fShadingLayer (const Dual2Chans &chans, const Dual2Vec3f &value)=0
 
virtual bool setDual2Vec4fShadingLayer (const Dual2Chans &chans, const Dual2Vec4f &value)=0
 
fdk::TimeValue time () const
 Absolute time of the context.
 
const SampleInfosampleInfo () const
 
DD::Image::ThreadId threadId () const
 Thread id from current SlrThreadContext.
 
SlrIntegratorContextItx () const
 Integrator context that created this shading context.
 
ndk::SamplingRng & samplingRng () const
 Sampling random number generator to use for this subpixel sample.
 
int32_t rayId () const
 Ray id of srcRtx.
 
uint64_t primId () const
 Unique ID of the current intersection renderable/subpart/subtri.
 
const std::string & primPath () const
 Path of prim currently being evaluated - for debugging only!
 
const SlrPrimInfoprimInfo () const
 Renderable currently being evaluated.
 
SlrPrimInfo::PrimFlag primFlags () const
 
int32_t renderableIndex () const
 PrimInfo index of current intersected object in SlrEngineContext.
 
bool isWritable () const
 This context's shading data can be written to.
 
const fdk::Mat4d & globalSceneXform () const
 
const fdk::Vec3f & globalSceneOffset () const
 Same as _globalSceneXform but single-precision for ray offset convenience.
 
bool enableColorChannels () const
 Shaders should output color layers + alphas.
 
bool enableDataChannels () const
 Shaders should output any data channels (Z, etc)
 
bool textureSamplingEnabled () const
 
void setTextureSampling (bool enabled)
 
void enableTextureSampling ()
 
void disableTextureSampling ()
 
DD::Image::TextureFiltertextureFilter () const
 Texture filter to use. If null the texture will be impulse sampled.
 
void setTextureFilter (DD::Image::TextureFilter *filter)
 
bool lightingEnabled () const
 If true, even if no lights the surface shaders should do illum calcs.
 
bool directLightingEnabled () const
 If true do direct-illumination calculations.
 
bool indirectLightingEnabled () const
 If true handle indirect-illumation calculations.
 
bool shadowingEnabled () const
 If true do shadow occlusion for direct-illumination.
 
const fdk::Vec3f & ambientLightingBias () const
 
bool useHeroCamForSpec () const
 
const fdk::Mat4d & l2w () const
 Local-to-world matrix for current primitive.
 
const fdk::Mat4d & w2l () const
 World-to-local matrix for current primitive.
 
const fdk::Mat4d & camWorld2Eye () const
 Render camera world-to-eye xform (world-space coords to camera local-space)
 
const fdk::Mat4d & camEye2World () const
 Render camera eye-to-world xform (camera local-space coords to world-space)
 
const fdk::Vec3d & camP () const
 
const fdk::Vec3d & camHeroP () const
 Hero-view camera origin in world space - for specular copying.
 
const SlrLightInfoList & lights () const
 List of active lights. If lightingEnabled is false an empty list is returned.
 
bool isCameraPath () const
 Did a camera ray create this shading context?
 
bool isThinTransmittedPath () const
 Is the ray that created this shading context evaluating thin transmission?
 
bool isShadowPath () const
 Did a shadow ray create this shading context?
 
bool isReflectedPath () const
 Did a reflected ray create this shading context?
 
bool isRefractedPath () const
 Did a refracted ray create this shading context?
 
float indexOfRefraction () const
 Index of refraction (ior) of the hit surface.
 
void setIndexOfRefraction (float ior)
 
float outsideIndexOfRefraction () const
 
int8_t shadeSides () const
 
bool shadeBothSides () const
 
bool shadeFrontSide () const
 
bool shadeBackSide () const
 
void setShadeSides (int8_t sides)
 
int8_t blendingOrder () const
 
bool blendingOrderFrontToBack () const
 
bool blendingOrderBackToFront () const
 
bool blendingOrderDisabled () const
 
void setBlendingOrder (int8_t order)
 
SlrRayBundle & startNewRayBundle (ndk::RayContext::TypeMask rayType) const
 
void selectActiveRayBundle (const SlrRayBundle &rayBundle) const
 
SlrRayBundle & activeRayBundle () const
 
SlrRayBundle & endRayBundle () const
 
bool intersect (const ndk::RayContext &Rtx=ndk::RayContext()) const
 
bool getNearestIntersection (const ndk::RayContext &Rtx, ndk::RayHitPointf &hitPoint) const
 
bool getThinTransmissionFactor (const ndk::RayContext &Rtx, fdk::Vec3f &transmissionFactor) const
 
float getPolygonEdgeDistance (float minDist) const
 
const fdk::Vec2i & pixelXY () const
 Current output screen coords.
 
const fdk::Vec2f & subpixelXY () const
 
int32_t sampleIndex () const
 Current pixel subsample/camera-ray index.
 
int32_t primaryRayIndex () const
 
float presenceThreshold () const
 
bool isDebugSample () const
 
bool isDebugPixel () const
 
bool isPixel (int32_t px, int32_t py) const
 
bool isPixelX (int32_t px) const
 
bool isPixelY (int32_t py) const
 
const fdk::Vec3f & viewVector () const
 Distance of this context's P from srcRtx origin.
 
float distance () const
 Linear-projected distance (classic Z). Only valid if camera ray.
 
float Zlinear () const
 
const fdk::Vec3f & Ps () const
 Displaced shading point in common shading space where lighting is queried.
 
const fdk::Vec3f & Pg () const
 Geometric point (intersection) in common shading space.
 
const fdk::Vec3f & dPgdx () const
 P differential for dyDir ray direction. ('dx' is the ray cone x-axis, not screen-space 'x')
 
const fdk::Vec3f & dPgdy () const
 P differential for dyDir ray direction. ('dy' is the ray cone y-axis, not screen-space 'y')
 
const fdk::Vec3f & dPgdu () const
 P surface u-space partial derivative, not normalized.
 
const fdk::Vec3f & dPgdv () const
 P surface v-space partial derivative, not normalized.
 
const fdk::Vec3f & dPgdw () const
 P surface z-space partial derivative, not normalized. (for volumes)
 
fdk::Vec3f PWs () const
 Displaced shading point in world space where lighting is queried (common shading space offset by globalSceneXform().)
 
fdk::Vec3f PWg () const
 Geometric point (intersection) in world space (common shading space offset by globalSceneXform().)
 
const fdk::Vec3f & PgStart () const
 Geometric position at motion sample start.
 
const fdk::Vec3f & PgEnd () const
 Geometric position at motion sample end.
 
const fdk::Vec2f & PgMotionFwd () const
 Motion vector forward, only created on demand by calling generateMotionVectorAovs().
 
const fdk::Vec2f & PgMotionBwd () const
 Motion vector backwards, only created on demand by calling generateMotionVectorAovs().
 
const fdk::Vec3f & triUvw () const
 
const fdk::Vec3f & Ns () const
 Shading normal, normalized.
 
const fdk::Vec3f & Ng () const
 Geometric surface normal, normalized.
 
const fdk::Vec3f & Ts () const
 Shading tangent, normalized.
 
fdk::Vec3f NsFaceForward () const
 
fdk::Vec3f NgFaceForward () const
 
const fdk::Vec2f & uv () const
 
const fdk::Vec2f & dUVdx () const
 Parametric-uv differential for dxDir ray direction.
 
const fdk::Vec2f & dUVdy () const
 Parametric-uv differential for dyDir ray direction.
 
float uvw () const
 Surface Z parametric coordinate of P (for volumes)
 
float dUVWdx () const
 Parametric-w differential for dxDir ray direction.
 
float dUVWdy () const
 Parametric-w differential for dyDir ray direction.
 
float presenceWeight () const
 
const fdk::Vec3f & Oi () const
 Rgb Opacity for colored transparency and thin-transmission.
 
float opacity () const
 Float version returns Oi.x (assumes all Oi elements are same value.)
 
const fdk::Vec2f & st () const
 Texture st(uv) coordinate (with w divided out)
 
const fdk::Vec2f & dStdx () const
 Texture coord st differential for dxDir ray direction.
 
const fdk::Vec2f & dStdy () const
 Texture coord st differential for dyDir ray direction.
 
const fdk::Vec2f & dStdu () const
 Texture coord st partial derivative in parametric-u direction, not normalized.
 
const fdk::Vec2f & dStdv () const
 Texture coord st partial derivative in parametric-u direction, not normalized.
 
const fdk::Vec4f & Cf () const
 Interpolated vertex color + alpha-transparency.
 
const fdk::Vec4f & rgba () const
 
const fdk::Vec3f & rgb () const
 
float alpha () const
 
float r () const
 
float g () const
 
float b () const
 
float a () const
 
fdk::Vec3f getAov (const SlrAovLayer &aov) const
 Retrieve value from Aov, if valid. If not valid returned value is 0,0,0.
 
void aovsCopy (DD::Image::Pixel &outputPixel) const
 
void aovsAReplaceB (const DD::Image::Pixel &A, DD::Image::Pixel &B) const
 
void aovsAUnderB (int32_t sampleIndex, const DD::Image::Pixel &A, DD::Image::Pixel &B, float Balpha) const
 
void aovsAOverB (int32_t sampleIndex, const DD::Image::Pixel &A, DD::Image::Pixel &B) const
 
void createMotionVectorAovs (DD::Image::Pixel &out, bool force=false) const
 
int32_t getIntShadingLayer (ndk::Channel chan, int32_t def_val) const
 
float getFloatShadingLayer (ndk::Channel chan, float def_val) const
 
double getDoubleShadingLayer (ndk::Channel chan, double def_val) const
 
const fdk::Vec2f & getVec2fShadingLayer (ndk::Channel startChan, const fdk::Vec2f &def_val) const
 
const fdk::Vec3f & getVec3fShadingLayer (ndk::Channel startChan, const fdk::Vec3f &def_val) const
 
const fdk::Vec4f & getVec4fShadingLayer (ndk::Channel startChan, const fdk::Vec4f &def_val) const
 
Dual2f getDual2fShadingLayer (const Dual2Chans &chans, float def_val) const
 
Dual2d getDual2dShadingLayer (const Dual2Chans &chans, double def_val) const
 
Dual2Vec2f getDual2Vec2fShadingLayer (const Dual2Chans &chans, const fdk::Vec2f &def_val) const
 
Dual2Vec3f getDual2Vec3fShadingLayer (const Dual2Chans &chans, const fdk::Vec3f &def_val) const
 
Dual2Vec4f getDual2Vec4fShadingLayer (const Dual2Chans &chans, const fdk::Vec4f &def_val) const
 
int32_t getIntPrimAttrib (ndk::Channel chan, int32_t def_val) const
 
float getFloatPrimAttrib (ndk::Channel chan, float def_val) const
 
double getDoublePrimAttrib (ndk::Channel chan, double def_val) const
 
const fdk::Vec2f & getVec2fPrimAttrib (ndk::Channel startChan, const fdk::Vec2f &def_val) const
 
const fdk::Vec3f & getVec3fPrimAttrib (ndk::Channel startChan, const fdk::Vec3f &def_val) const
 
const fdk::Vec4f & getVec4fPrimAttrib (ndk::Channel startChan, const fdk::Vec4f &def_val) const
 
Dual2f getDual2fPrimAttrib (const Dual2Chans &chans, float def_val) const
 
Dual2d getDual2dPrimAttrib (const Dual2Chans &chans, double def_val) const
 
Dual2Vec2f getDual2Vec2fPrimAttrib (const Dual2Chans &chans, const fdk::Vec2f &def_val) const
 
Dual2Vec3f getDual2Vec3fPrimAttrib (const Dual2Chans &chans, const fdk::Vec3f &def_val) const
 
Dual2Vec4f getDual2Vec4fPrimAttrib (const Dual2Chans &chans, const fdk::Vec4f &def_val) const
 
void sample (DD::Image::Sampler *sampler, const DD::Image::ChannelSet &get, DD::Image::Pixel &out) const
 
void sample (DD::Image::Sampler *sampler, const Dual2Vec2f &v, const DD::Image::ChannelSet &get, DD::Image::Pixel &out) const
 Same as sample(Sampler*) but with overrides for st & derivatives currently in context.
 
void sample (DD::Image::Iop *texture, const DD::Image::ChannelSet &get, DD::Image::Pixel &out) const
 Slower version using a raw Iop.
 
void sample (DD::Image::Iop *texture, const Dual2Vec2f &v, const DD::Image::ChannelSet &get, DD::Image::Pixel &out) const
 Same as sample(Iop*) but with overrides for st & derivatives currently in context.
 
DD::Image::PixeltextureColor () const
 
DD::Image::PixelbindingColor () const
 Per-thread context - for Connection sampling calls - defaults to RGBA.
 
DD::Image::PixelillumColor () const
 Per-ray - for LightShader evaluation - defaults to RGB.
 
DD::Image::PixelshadowColor () const
 Per-ray - for LightShader shadow transmission evaluation - defaults to RGB (no depth!)
 
DD::Image::PixelvolumeColor () const
 Per-ray - for VolumeShader color evaluation - defaults to RGB.
 
DD::Image::PixelindIllumColor () const
 Per-ray - or surface shader calls to retrieve indirect results - defaults to RGB.
 
void printParamData (std::ostream &) const
 

Public Attributes

ndk::RayContext srcRtx
 Ray that created this context.
 
uint16_t rayDepth
 Ray depth that created this context where 0 indicates a camera, or primary ray.
 
uint16_t diffuseDepth
 
uint16_t reflectionDepth
 
uint16_t refractionDepth
 
SlrSurfaceShader * surfaceShader
 Current surface shader being evaluated.
 
SlrGeometryShader * displacementShader
 Current displacement shader being evaluated, if any.
 
SlrVolumeShader * atmosphereShader
 Current atmospheric volume shader being evaluated, if any.
 

Protected Member Functions

 SlrShadingContext ()=default
 Member vars left intentionally uninitialized for performance reasons.
 

Protected Attributes

uint8_t _blendingOrder
 Surface blending order.
 
uint8_t _shadeSides
 Which sides to shade.
 
float _indexOfRefraction
 Index of refraction of the hit surface.
 
bool _textureSamplingEnabled
 Whether shaders should sample their textures.
 
DD::Image::TextureFilter_textureFilter
 Global texture filter to use. May be null!
 

Friends

class SlrThreadContext
 
class StxBundle
 
class RenderEngine
 
std::ostream & operator<< (std::ostream &, const SlrShadingContext &)
 

Detailed Description

This class is intended to be passed up a SlrShader tree.

Member Function Documentation

◆ previousStx()

const SlrShadingContext * slr::SlrShadingContext::previousStx ( ) const

Previous SlrShadingContext, normally the last surface intersected/shaded and one level up in ray depth.

◆ createEditableShadingContextCopy()

SlrShadingContext * slr::SlrShadingContext::createEditableShadingContextCopy ( bool  copyShadingLayers = true) const

Create an editable shading context that's a copy of this one. Use the setAttrib() methods to change the values on the returned context. The setAttrib() methods will fail on a non-editable context. This is primarily used to modify the shading context when passing it to an input shader. A good example of this is modifying the UV attrib based on the current point location to perform high quality texture projections.

◆ sampleInfo()

const SampleInfo & slr::SlrShadingContext::sampleInfo ( ) const

Sample info of the context containing the sample time, motion step, motion step offset, etc.

◆ primFlags()

SlrPrimInfo::PrimFlag slr::SlrShadingContext::primFlags ( ) const

Surface quality flags from the renderable - same as calling primInfo().flags; See SlrPrimInfo for flag definitions.

◆ globalSceneXform()

const fdk::Mat4d & slr::SlrShadingContext::globalSceneXform ( ) const

World-space values are transformed into shading-space by this matrix, which is commonly just a translate.

Note - Shaders that have world-space values passed as inputs from scene shader nodes need to transform those values by this matrix to put them into shading-space. Lights and objects are transformed by the renderer during setup and have this xform applied.

◆ textureSamplingEnabled()

bool slr::SlrShadingContext::textureSamplingEnabled ( ) const
inline

Should textures sample? This may be disabled for camera rays when shading a pre-rendered scene with pixel containing the surface albedo.

◆ ambientLightingBias()

const Vec3f & slr::SlrShadingContext::ambientLightingBias ( ) const

Adds light globally to the diffuse (albedo) surface response of surface shaders which respect this shading global.

◆ useHeroCamForSpec()

bool slr::SlrShadingContext::useHeroCamForSpec ( ) const

If enabled viewVector() uses camHeroP() instead of camP() if rayDepth == 0. When rayDepth is > 0 (ie not a camera ray) then this ignored.

◆ camP()

const Vec3d & slr::SlrShadingContext::camP ( ) const

Render camera origin (camera rays originate here). Same as camEye2World().getTranslation(), but cached for speed.

◆ outsideIndexOfRefraction()

float slr::SlrShadingContext::outsideIndexOfRefraction ( ) const

Index of refraction (ior) of the 'outside' of the hit surface. This value is automatically determined when evaluating transmission rays, usually by taking the 'dielectric priority' of the surface into account to determine which surface is more important (which can ignored, really.)

◆ shadeSides()

int8_t slr::SlrShadingContext::shadeSides ( ) const
inline

Which side of the geometry should be shaded. This is not about intersection testing it's whether a surface shader should be run on the front side, back side or both.

◆ blendingOrder()

int8_t slr::SlrShadingContext::blendingOrder ( ) const
inline

Surface blending order assigned during Integrator StxBundle contruction. The default surface shader blend method checks this order when deciding to use Under or Over blend math. The direction of blending also affects which blending modes can be used effectively since many on the 'non-standard' modes like min/max cannot be correctly performed when blending front-to-back. A surface shader is free to implement whatever blending math it wants to, but there's no guarantee the result will be correct for all blending orders unless this value is taken into consideration.

Referenced by slr::SlrIntegratorContext::getPathIllumination().

◆ startNewRayBundle()

SlrRayBundle & slr::SlrShadingContext::startNewRayBundle ( ndk::RayContext::TypeMask  rayType) const

Start a new RayContext bundle making it the current bundle and returning a reference to it. Note that only one bundle may be active at a time since each bundle must be a contiguous section of RayContexts in the cache. See SlrIntegratorContext for more info.

◆ selectActiveRayBundle()

void slr::SlrShadingContext::selectActiveRayBundle ( const SlrRayBundle &  rayBundle) const

Make rayBundle be the active one that intersection testing is done on and store in. If the bundle has rays in it the active ray will be set to the first in the bundle. This is not required if startNewRayBundle() was just called. See SlrIntegratorContext for more info.

◆ activeRayBundle()

SlrRayBundle & slr::SlrShadingContext::activeRayBundle ( ) const

Access the currently active RayBundle for this thread which can then be added to. Note that only one bundle may be current at a time. See SlrIntegratorContext for more info.

◆ endRayBundle()

SlrRayBundle & slr::SlrShadingContext::endRayBundle ( ) const

End ray bundle, releasing all the ray, intersection and shading info created for that bundle and changing the current bundle to the previous one in the list. See SlrIntegratorContext for more info.

◆ intersect()

bool slr::SlrShadingContext::intersect ( const ndk::RayContext &  Rtx = ndk::RayContext()) const

Returns true if anything is occluding the ray, including transparent objects. Does not call shaders or return information about the hit object.

◆ getNearestIntersection()

bool slr::SlrShadingContext::getNearestIntersection ( const ndk::RayContext &  Rtx,
ndk::RayHitPointf &  hitPoint 
) const

Intersect the scene with the RayContext Rtx, returning true if there was a hit within Rtx's distance range, and filling in hitStx with the information about the hit surface. See SlrIntegratorContext::getNearestIntersection() for more info.

◆ getThinTransmissionFactor()

bool slr::SlrShadingContext::getThinTransmissionFactor ( const ndk::RayContext &  Rtx,
fdk::Vec3f &  transmissionFactor 
) const

Find the 'thin' transmission factor for all surfaces between Rtx.minT and Rtx.maxT, which is most commonly used for direct lighting shadow casting. Returns false on trivial 0% transmission (100% occlusion.) See SlrIntegratorContext::getThinTransmissionFactor() for more info.

◆ getPolygonEdgeDistance()

float slr::SlrShadingContext::getPolygonEdgeDistance ( float  minDist) const

Distance from P to the nearest not-occluded polygon edge in screen-space for the current primitive. All triangles generated from the tessellation of the original SlrPrimInfo are tested, so the method checks all polygon edges. Returns when the first edge distance is under minDist.

◆ subpixelXY()

const fdk::Vec2f & slr::SlrShadingContext::subpixelXY ( ) const

Current output subpixel coord inside pixelXY, where [0 0] is the center of the pixel and [-1 -1] is the lower-left corner.

◆ presenceThreshold()

float slr::SlrShadingContext::presenceThreshold ( ) const

Current presence threshold 0..1. If a hit surface's presence is below this value then it's considered to have no presence, not a hit, and the ray continues. This value will change randomly after each presence test.

◆ viewVector()

const fdk::Vec3f & slr::SlrShadingContext::viewVector ( ) const

Distance of this context's P from srcRtx origin.

Returns a 'fake' stereo view vector built from the camHeroP, or the negated ray direction depending on context's stereo mode and rayDepth. When rayDepth > 0 (not a camera ray) then the inverted srcRtx direction is returned.

For camera rays using the camHeroP camera ray makes specular calculations identical for all stereo cameras, visually 'flattening' the specular onto the surface.

◆ triUvw()

const fdk::Vec3f & slr::SlrShadingContext::triUvw ( ) const

Barycentric triangle uvw coordinates at srcRtx intersection. For a triangle with corners (p0 p1 p2) w=1 is along edge p0->p1, u=1 is along edge p1->p2, and v=1 is along edge p0->p2. If v or w are outside 0..1 then P is outside the bounds of the triangle and w in invalid. This happens when uvw is calculated for ray offsets dxDir & dyDir. They will always intersect the triangle plane but can often be outside the triangle's perimeter.

◆ NsFaceForward()

fdk::Vec3f slr::SlrShadingContext::NsFaceForward ( ) const

Ns() but facing toward 'view' vector (srcRtx.direction) so that backside surface can shade correctly.

◆ NgFaceForward()

fdk::Vec3f slr::SlrShadingContext::NgFaceForward ( ) const

Ng() but facing toward 'view' vector (srcRtx.direction) so that backside surface can shade correctly.

◆ uv()

const fdk::Vec2f & slr::SlrShadingContext::uv ( ) const

Surface 2D parametric coordinates of P Note - Parametric UVs are required for dPdu & dPdv and stable bump mapping, etc, and these are not neccessarily 'texture' UVs. For example texture coords can be projected onto a surface which can break the parametric-ness of the UVs along the surface. To avoid this we keep them logically separated to make sure shading operations like bump mapping are not adversely impacted. When not projecting texture coords the value of uv() and st() will likely be identical.

◆ presenceWeight()

float slr::SlrShadingContext::presenceWeight ( ) const

Note - presence contributes to pixel coverage weight, it does -not- influence opacity! 1.0 = solid, 0.0 = no object. Fractional values indicate multiple 0% or 100% samples have been combined together, usually due to filtering a texture.

Referenced by slr::SlrIntegratorContext::getPathIllumination().

◆ aovsCopy()

void slr::SlrShadingContext::aovsCopy ( DD::Image::Pixel outputPixel) const

Copy Aov values from this shading context's shading channels into the output Pixel, and call any custom Aov handlers for them to copy their values to the output Pixel.

◆ aovsAReplaceB()

void slr::SlrShadingContext::aovsAReplaceB ( const DD::Image::Pixel A,
DD::Image::Pixel B 
) const

Copy all Aov channels from pixel A to pixel B. If the Aov is set to mode MERGE_PREMULT_BLEND then the A channel is premulted by A.coverage() before copying to B. Note that opacity is not included in this premult!

◆ aovsAUnderB()

void slr::SlrShadingContext::aovsAUnderB ( int32_t  sampleIndex,
const DD::Image::Pixel A,
DD::Image::Pixel B,
float  Balpha 
) const

Merge UNDER all Aov channels from pixel A under the mathcing pixel B channels. If the Aov is set to mode MERGE_PREMULT_BLEND then the A channel is premulted by A.coverage() while merging UNDER B. Note that opacity is not included in this premult!

◆ aovsAOverB()

void slr::SlrShadingContext::aovsAOverB ( int32_t  sampleIndex,
const DD::Image::Pixel A,
DD::Image::Pixel B 
) const

Merge OVER all Aov channels from pixel A under the mathcing pixel B channels. If the Aov is set to mode MERGE_PREMULT_BLEND then the A channel is premulted by A.coverage() while merging OVER B. Note that opacity is not included in this premult!

◆ createMotionVectorAovs()

void slr::SlrShadingContext::createMotionVectorAovs ( DD::Image::Pixel out,
bool  force = false 
) const

Create the motion vector values for the Aov layer Chan_MotionFwd. This should only be called on demand to reduce render cost by checking the IntegratorContext motionVectorsRequested() value.

References slr::SampleInfo::motionSampleStart, and slr::SampleInfo::shutterPercentage.

◆ sample()

void slr::SlrShadingContext::sample ( DD::Image::Sampler sampler,
const DD::Image::ChannelSet get,
DD::Image::Pixel out 
) const

Use st() and the derivatives of st() to sample the incoming image. The st coord 0,0 is mapped to the lower-left corner of the image's format, and 1,1 is mapped to the upper-right corner.

For texture sampling it's much faster to provide a DD::Image::Sampler rather than a raw Iop so Tile caching is properly leveraged.

References DD::Image::Sampler::sampleTextureUV().

◆ textureColor()

DD::Image::Pixel & slr::SlrShadingContext::textureColor ( ) const

Per-thread context - for sampling texture map Iops - defaults to RGBA Note - has InterestRatchet set so should sample faster.



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