#include <SlrIntegrator.h>
Public Member Functions | |
| const SlrThreadContext & | threadContext () const |
| Thread memory context. | |
| const fdk::Vec2i & | pixelXY () const |
| int32_t | pixelX () const |
| int32_t | pixelY () const |
| bool | isPixel (int32_t x, int32_t y) const |
| bool | isPixelX (int32_t x) const |
| bool | isPixelY (int32_t y) const |
| bool | isDebugPixel () const |
| bool | isDebugSample () const |
| const DD::Image::Format & | renderFormat () const |
| const DD::Image::Box & | renderRegion () const |
| SlrEngineContext::RenderProjectionMode | renderProjectionMode () const |
| Special projection modes. Default SceneCamera is standard lens projection. | |
| const fdk::Mat4d & | worldToShadingXform () const |
| const fdk::Mat4d & | shadingToWorldXform () const |
| Inverse of worldToShadingXform, for going from shading space to world. | |
| const fdk::Vec3f & | worldToShadingOffset () const |
| Same as worldToShadingXform but single-precision for ray offset convenience. | |
| const ndk::LensProjectionFunction & | cameraLensFunc () const |
| Camera projection function renderer is using. | |
| const ndk::CameraSampleList & | cameraMotionSamples () const |
| List of per motion sample camera contexts. | |
| const ndk::Camera::Sample & | cameraMotionSample (size_t motionIndex) const |
| const ndk::ProjectionImageContext & | cameraImageContext () const |
| Screen coordinate transformation info. | |
| uint16_t | rayMaxDepth () const |
| uint16_t | rayDiffuseMaxDepth () const |
| uint16_t | rayReflectionMaxDepth () const |
| uint16_t | rayRefractionMaxDepth () const |
| int32_t | pixelSeed () const |
| Random number seed for current pixel. | |
| ndk::SamplingRng & | subpixelRng (int32_t i) const |
| Per-subpixel sampling random number generator. | |
| const fdk::Vec2fList & | subpixelXYs () const |
| const fdk::Vec2f & | subpixelXY (int32_t i) const |
| int32_t | nPrimaryRays () const |
| Number of primary/camera ray samples. | |
| int32_t | nSamples () const |
| Same as nPrimaryRays. | |
| const SampleInfoList & | sampleInfoList () const |
| Per primary ray sample info including time, motion step index and step offset t. | |
| const SampleInfo & | sampleInfo (size_t i) const |
| fdk::TimeValue | time (size_t i) const |
| Time value for a primary ray sample. | |
| const fdk::FloatList & | presenceThresholds () const |
| float | presenceThreshold (size_t i) const |
| bool | haveAovOutputs () const |
| bool | motionVectorsOutputRequested () const |
| const SlrAovLayerList & | aovShadingLayersList () const |
| const SlrAovLayerList & | aovCustomLayersList () const |
| const SlrAovIndexMap & | aovLayerMap () const |
| The map of Aov names to SlrAovLayer indices. | |
| const SlrAovLayer * | findAovLayer (const char *name) const |
| Find an AovLayer by name. | |
| bool | trace (const SlrShadingContext &srcStx, const fdk::Vec3f &origin, const fdk::Vec3f &dir, ndk::RayContext::TypeMask type=ndk::RayContext::shadowRay(), float minDist=defaultMinDistance(), float maxDist=defaultMaxDistance()) const |
| bool | trace (const SlrShadingContext &srcStx, const SlrRayContext &Rtx) const |
| bool | trace (const SlrShadingContext &srcStx, const SlrRayContext &Rtx, ndk::RayHitPointf &hitPoint) const |
| int32_t | getNearestSurfaceIntersections (const SlrShadingContext &srcStx, const ndk::RayContext *rtxArray, int32_t nRays, StxBundle &stxBundle) const |
| void | getNearestIntersections (const SlrShadingContext &srcStx, const ndk::RayContext *rtxArray, int32_t nRays, ndk::RayHitPointfList &hitList) const |
| int32_t | getAllIntersections (const SlrShadingContext &srcStx, const SlrRayContext &Rtx) const |
| void | getAllIntersections (const SlrShadingContext &srcStx, const ndk::RayContext &Rtx, ndk::RayHitPointfList &hitList) const |
| bool | getThinTransmissionFactor (const SlrShadingContext &srcStx, const SlrRayContext &Rtx, fdk::Vec3f &transmissionFactor) const |
| void | getPathIllumination (const SlrShadingContext &srcStx, const SlrRayContext **rays, int32_t nRays, const DD::Image::ChannelSet &get, DD::Image::Pixel &out) const |
| Perform shading, etc to calculate the final output result for the provided scene ray. | |
| void | getPathTransmission (const SlrShadingContext &surfaceStx, const SlrRayContext **entryRays, int32_t nRays, const DD::Image::ChannelSet &get, DD::Image::Pixel &out) const |
| void | getUvIntersections (const SlrShadingContext &srcStx, const SlrRayContext &Rtx, const fdk::Vec2f &uvCoord, const fdk::Vec2f &uvDxy) const |
| bool | getBboxIntersection (const SlrRayContext &Rtx, int32_t level) const |
| const DD::Image::ChannelSet & | surfaceShadingChannelSet () const |
| Global set of all channels surface shaders produce. | |
| const DD::Image::ChannelSet & | shaderColorChannelSet () const |
| Global set of all channels that need alpha blending. | |
| const DD::Image::ChannelSet & | shaderDataChannelSet () const |
| Global set of data channels that don't want blending with alpha (vectors, Z, normals, etc) | |
| const DD::Image::ChannelSet & | requestedOutputChannelSet () const |
| Global set of requested channels that Slr2 needs to produce. | |
| const DD::Image::ChannelSet & | requestedOutputColorChannelSet () const |
| Global set of requested channels that need to be premultiplied for alpha blending. | |
| const DD::Image::ChannelSet & | requestedOutputDataChannelSet () const |
| Global set of requested Aov data channels that don't need to be premulted/blended. | |
| const DD::Image::ChannelPack & | surfaceShadingChannelPack () const |
| const DD::Image::ChannelPack & | shaderColorChannelPack () const |
| const DD::Image::ChannelPack & | shaderDataChannelPack () const |
| const DD::Image::ChannelPack & | bgChannelPack () const |
| const DD::Image::ChannelPack & | requestedOutputChannelPack () const |
| const DD::Image::ChannelPack & | requestedOutputColorChannelPack () const |
| const DD::Image::ChannelPack & | requestedOutputDataChannelPack () const |
| const SlrAovChannelMap & | aovUnpremultByCoverageChannelMap () const |
| const SlrAovChannelMap & | aovUnpremultByAlphaChannelMap () const |
Protected Member Functions | |
| SlrIntegratorContext (ThreadContext *) | |
Friends | |
| class | SlrIntegrator |
| class | ThreadContext |
| class | RenderEngine |
This class is passed to an SlrIntegrator from the renderer pixel loop for each pixel being rendered. It contains all the camera rays being shot for a pixel so the integrator could perform spatial weighting since each ray origin is at a known relative subpixel location inside the pixel.
| const fdk::Mat4d & slr::SlrIntegratorContext::worldToShadingXform | ( | ) | 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.
| const ndk::Camera::Sample & slr::SlrIntegratorContext::cameraMotionSample | ( | size_t | motionIndex | ) | const |
Per motion sample camera context. Note that motionIndex is clamped to the last motion sample. Note that camera transforms are in shading-space so the camera translation from the frame0 motion sample has been removed. For example if the camera translation is [0 0 10] then the sample will be at [0 0 0] and the Z=+10 offset will be in worldToShadingXform().
|
inline |
Returns the subpixel XY offset coordinate inside pixelXY where 0,0 is the center of the pixel, -1,-1 is the pixel left/bottom edge, and +1,+1 is the pixel right/top edge.
| bool slr::SlrIntegratorContext::haveAovOutputs | ( | ) | const |
Are there active Aov outputs? These are extra float channels provided by the shading contexts to be copied to the output samples.
| bool slr::SlrIntegratorContext::motionVectorsOutputRequested | ( | ) | const |
Motion vector output has been requested. This is only true if the render controls have a valid output channel routing for the motion vector data, to save the cost of calculating them.
| const SlrAovLayerList & slr::SlrIntegratorContext::aovShadingLayersList | ( | ) | const |
List of shading data Aovs to output. These Aovs are copied directly from SlrShadingContext shading data and are faster to access.
| const SlrAovLayerList & slr::SlrIntegratorContext::aovCustomLayersList | ( | ) | const |
List of custom-handler Aovs to output. These Aovs have a custom SlrAovLayer::Handler that must be called individually and is thus slower than iterating across the aovShadingLayers list.
| bool slr::SlrIntegratorContext::trace | ( | const SlrShadingContext & | srcStx, |
| const fdk::Vec3f & | origin, | ||
| const fdk::Vec3f & | dir, | ||
| ndk::RayContext::TypeMask | type = ndk::RayContext::shadowRay(), |
||
| float | minDist = defaultMinDistance(), |
||
| float | maxDist = defaultMaxDistance() |
||
| ) | const |
Returns true if anything is occluding the ray, including transparent objects. Does not call shaders or return information about the hit object. srcStx is required for sample/time info.
References slr::SlrShadingContext::rayId(), and slr::SlrShadingContext::time().
| bool slr::SlrIntegratorContext::trace | ( | const SlrShadingContext & | srcStx, |
| const SlrRayContext & | Rtx | ||
| ) | const |
Returns true if anything is occluding the ray, including transparent objects. Does not call shaders or return information about the hit object. srcStx is required for sample/time info.
| bool slr::SlrIntegratorContext::trace | ( | const SlrShadingContext & | srcStx, |
| const SlrRayContext & | Rtx, | ||
| ndk::RayHitPointf & | hitPoint | ||
| ) | const |
Returns true if anything is occluding the ray, filling in hitPoint with the information about the hit object, including hit distance and opacity. Calls presence and opacity shaders only.
References slr::SlrRayContext::hitPointStack().
| int32_t slr::SlrIntegratorContext::getNearestSurfaceIntersections | ( | const SlrShadingContext & | srcStx, |
| const ndk::RayContext * | rtxArray, | ||
| int32_t | nRays, | ||
| StxBundle & | stxBundle | ||
| ) | const |
Intersect a bundle of rays with the closest surfaces to the ray origins, filling in shading contexts. There will only be one shading context created per ray, so the size of the StxBundle will never exceed nRays. If the rays are a coherent set the hits can be described as a 'wavefront' pushed out from the ray origins along the ray directions.
Building surface shading contexts requires evaluating additional surface properties so is more costly than getting the raw geometric hit info.
Note that stxBundle is -not- cleared before adding hits to it.
Returns the number of hits added to stxBundle.
| void slr::SlrIntegratorContext::getNearestIntersections | ( | const SlrShadingContext & | srcStx, |
| const ndk::RayContext * | rtxArray, | ||
| int32_t | nRays, | ||
| ndk::RayHitPointfList & | hitList | ||
| ) | const |
Intersect a bundle of rays with the closest surfaces to the ray origins, filling in geometric hit infos. There will only be one hit info created per ray, so the size of the hit list will never exceed nRays. If the rays are a coherent set the hits can be described as a 'wavefront' pushed out from the ray origins along the ray directions.
Note - hitList -is- cleared before adding the hits.
| int32_t slr::SlrIntegratorContext::getAllIntersections | ( | const SlrShadingContext & | srcStx, |
| const SlrRayContext & | Rtx | ||
| ) | const |
Intersect a single ray with all surfaces, filling in the ray's hit point/shading context list retrievable via Rtx.hitPointStack(). The list is always cleared by this intersection method, so move any hit points you care about out of the list before calling another intersection method with the same ray.
Note that even though the SlrRayContext arg is const the ray data bound to the ray is not, so while the SlrRayContext itself is not modified the bound data is.
This is the most expensive intersection method as all intersectable surfaces are retrieved, even potentially hidden ones, and building surface shading contexts requires evaluating additional surface properties.
References slr::SlrRayContext::hitPointStack().
| void slr::SlrIntegratorContext::getAllIntersections | ( | const SlrShadingContext & | srcStx, |
| const ndk::RayContext & | Rtx, | ||
| ndk::RayHitPointfList & | hitList | ||
| ) | const |
Intersect a single ray with the all surfaces, filling in geometric hit infos. Note - hitList is -not- cleared before adding the hits.
| bool slr::SlrIntegratorContext::getThinTransmissionFactor | ( | const SlrShadingContext & | srcStx, |
| const SlrRayContext & | 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 occlusion (shadow) testing. Only materials with the thinInterfaceTransmission() trait enabled are fully evaluated for opacity (transmission amount,) otherwise only the material's presence is considered to determine the solidity factor. If the material's presence is derived from its opacity then opacity will be calculated as a byproduct but will not contribute to the material's occlusion factor unless thinInterfaceTransmission() is enabled.
Returns true on trivial 0% transmission, or a 100% occluded path.
transmissionFactor is a Vec3 so that colorized shadows can be supported. It will contain the total occlusion from all surfaces and volumes along the ray path up to 100% occlusion or Rtx.maxT, whichever comes first.
Transmission factor is only valid between 0..1, or 0%..100% transmission, so usually this factor is a weight multiplied against a light's emission to determine the total amount of light reaching srcStx.
Note that thin transmission is an efficiency to speed up direct shadow calculations without needing to calculate expensive object qualities like scatter, refraction, etc. During thin transmission path evalation the ray is never bent so a single set of intersections between ray minT and maxT is all that is ever considered.
References slr::SlrRayContext::areAllHitsOpaqueSolid(), slr::SlrRayContext::nHitPoints(), slr::SlrShadingContext::sampleIndex(), and slr::SlrRayContext::sortHitsNearToFar().
| void slr::SlrIntegratorContext::getPathTransmission | ( | const SlrShadingContext & | surfaceStx, |
| const SlrRayContext ** | entryRays, | ||
| int32_t | nRays, | ||
| const DD::Image::ChannelSet & | get, | ||
| DD::Image::Pixel & | out | ||
| ) | const |
Perform transmission shading on the surface, assuming entryStx represents the entry interface pointer of the object. If the object is marked as double-sided then the entry interface is assumed to also be the exit interface. In this case there's no possibility of object overlap resolution via dielectric priority so the surface is interpreted as warping surface with no thickness. If single-sided the surface is assumed to have a back surface that terminates the interior of the surface.
| void slr::SlrIntegratorContext::getUvIntersections | ( | const SlrShadingContext & | srcStx, |
| const SlrRayContext & | Rtx, | ||
| const fdk::Vec2f & | uvCoord, | ||
| const fdk::Vec2f & | uvDxy | ||
| ) | const |
Intersect a 2d UV point with surface UV coords, filling in the ray's hit point/shading context list retrievable via Rtx.hitPointStack(). uvDxy specifies the radius of the filter area to calculate in UV coordinate space.
| bool slr::SlrIntegratorContext::getBboxIntersection | ( | const SlrRayContext & | Rtx, |
| int32_t | level | ||
| ) | const |
Utility function to intersect a ray with the BVH bboxes. hitPoint will only contain info about the bbox wall geometry, so opacity, presence, etc will be at defaults. Hit point result will be in Rtx.hitPointStack().
References slr::SlrRayContext::hitPointStack().
| ©2026 The Foundry Visionmongers, Ltd. All Rights Reserved. |