Introduction
A RixShadingContext
encapsulates a shading context - a description of the environment in which shading is to be performed. It is the primary domain of operation for the shader classes RixBxdf
, RixDisplacement
, RixLight
, RixPattern
, and RixVolume
, and is also of high importance to RixIntegrator
. Implementors of these classes and their associated plugins will thus need to be intimately familiar with the RixShadingContext
class.
...
In some circumstances, users of EvalParam()
that do not know the paramId
(perhaps due to the use of a dynamic parameter table) or the type of the parameter can introspect for the paramId or information about the parameter via the GetParamId()
and the GetParamInfo()
methods.
Memory ManagementRixShadingContext
provides a fast memory allocation service tailored to shaders that need to execute quickly. The main provider of this service is the Allocate()
routine; the New()
routine and the class Allocator
are wrappers around Allocate()
. The backing store for this memory allocation are memory pools which are tailored specifically to the lifetime requirements of RixPattern
and RixBxdf
, with the latter category equating to the the lifetime of the RixShadingContext
. Clients that use these memory management services should use "placement new" semantics and should not rely on the invocation of a destructor.
Anchor |
---|
| getnearesthits |
---|
| getnearesthits |
---|
|
Tracing Rays
RixShadingContext
provides a limited service for tracing rays. The GetNearestHits()
routine allows shaders to trace rays to determine the nearest hit. These rays do not trigger shading on the hit geometry, and should thus be considered geometric probe rays: the only information that can be returned from GetNearestHits
is a RtHitPoint
struct, which contains a minimal set of geometric information including the distance, the P
, Ng
, u
, v
builtins of the hit geometry, and the filter and micropolygon sizes. A ray that missed is indicated by the distance being set to 0. While limited, this service is sufficient to allow for calculation of effects such as ambient occlusion.
Anchor |
---|
| Transformations |
---|
| Transformations |
---|
|
TransformationsTransformation of RtFloat3
data between two coordinate systems known to the renderer can be accomplished using the Transform()
method. The interpretation of the RtFloat3
data as point, vector, or normal data is specified using the TransformInterpretation
enum. The array of data must be numPts
in size and the data will be transformed in place. A non-zero return value indicates a failed transformation, typically due to unknown coordinate systems being specified.
In addition, transform matrices between two coordinate systems can be returned directly via the GetTransform()
method. The matrix
output parameter points at storage allocated by the renderer containing the matrices. The size of this storage is indicated by the numMatrices
output parameter. If the transformation is time varying, the numMatrices
returned will be the same as numPts
. If the transformation is uniform, numMatrices
will be set to 1. A non-zero return value indicates a failed transformation, typically due to unknown coordinate systems being specified.