Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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 PNg, uv 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. This service should not be confused with the RixIntegratorContext ability to trace rays, which is provided only to implementors of RixIntegrator.

Anchor
Transformations
Transformations
Transformations

...

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.

Anchor
RayProperty
RayProperty
Querying Ray Properties

As long as the RixIntegrator used supports the appropriate ray property query, plugin authors may want to query ray properties such as the ray depth or eye throughput, in order to allow for artistic control or optimization. For instance, as an optimization a RixBxdf may want to skip the evaluation of a particularly expensive lobe, if the current ray depth of the hit point is beyond some arbitrary threshold. This service is provided by the GetProperty() routine on the RixShadingContext. Callers of this routine are responsible for allocating and deallocating the result memory.  The integrator is responsible for filling in the result. Below is a code snippet demonstrating how to use this feature.

// Query ray depths for each point in the shading context
int nPts = shadingCtx->numPts;
int* rayDepths = new int [nPts];
if (vCtx->GetProperty(k_RayDepth, rayDepths))
{
    // Do something expensive for small ray depths, or something cheaper for large ray depths  
}
delete[]rayDepths;

For documentation on the available ray properties, please consult the integrator ray property query documentation.