RenderManAPI  24.0
RtRayGeometry Struct Reference

#include <RixIntegrator.h>

Public Types

enum  RayType {
  k_rtInvalid = 0, k_rtCamera = 1, k_rtLight = 2, k_rtTransmission = 3,
  k_rtDirectlight = 4, k_rtIndirect = 5, k_rtNumRayTypes = 6
}
 

Public Member Functions

void InitOrigination (RixShadingContext const *sCtx, RtNormal3 const *Ngn, int _shadingCtxIndex)
 InitOrigination() should be called after the ray geometry has been setup for calls to GetNearestHits(). More...
 
void InitTransmitOrigination (RixShadingContext const *sCtx, int _shadingCtxIndex)
 InitTransmission() is analogous to InitOrigination() but should be used for transmission rays. More...
 
void SetRaySpread (RixBXLobeSampled lobe, float rayOriginRadius, float rayOriginSpread, float curvature, float fPdf, bool lightPath=false)
 Computes ray spread for given reflection/transmission type, pdf, and surface curvature, using two approaches: More...
 

Static Public Member Functions

static PRMAN_INLINE uint16_t EncodeWavelength (float wavelength)
 Converts a wavelenght (in nanometers) to a compact 16 bits representation of it. More...
 
static PRMAN_INLINE float DecodeWavelength (uint16_t encodedWavelength)
 Converts from encoded 16 bits representation of wavelength to nanometers In both units 0 means "full spectrum", meaning no wavelength is defined. More...
 

Public Attributes

RtPoint3 origin
 
float originRadius
 Ray origin. More...
 
RtVector3 direction
 Radius of ray at its origin. More...
 
float raySpread
 Ray direction. More...
 
float minDist
 How much the ray radius changes for each unit the ray travels. More...
 
float maxDist
 Minimum hit distance. Used only for primary rays. More...
 
float time
 Maximum hit distance. More...
 
uint16_t raytype
 Shutter-normalized time of ray launch. More...
 
RixBXLobeSampled lobeSampled
 See RayType for possible values. More...
 
RixShadingContext::Id shadingCtxId
 Characteristics of the BxDF lobe this ray samples. More...
 
int16_t integratorCtxIndex
 Shading context unique identifier. More...
 
uint16_t shadingCtxIndex
 Associated primary ray index. More...
 
uint16_t rayId
 Index into the lauching shading context. More...
 
RixLPEStatelpeState
 User-provided index in the ray bundle. More...
 
uint32_t private0 [5]
 A pointer to the LPE state for this ray launch. More...
 
float opacityThreshold
 Data for internal use. More...
 
uint16_t hitId
 This value is updated on each presence hit, whenever a surface with presence is hit. More...
 
uint16_t flags
 Internal hit id, zero means 'no hit.'. More...
 
uint16_t wavelength
 Flags for internal use. More...
 
uint16_t ignoreGroupingId
 If non-zero: ignore geometry with the specified Attribute "grouping" "id". More...
 

Member Enumeration Documentation

◆ RayType

Enumerator
k_rtInvalid 
k_rtCamera 
k_rtLight 
k_rtTransmission 
k_rtDirectlight 
k_rtIndirect 
k_rtNumRayTypes 

Member Function Documentation

◆ DecodeWavelength()

static PRMAN_INLINE float RtRayGeometry::DecodeWavelength ( uint16_t  encodedWavelength)
inlinestatic

Converts from encoded 16 bits representation of wavelength to nanometers In both units 0 means "full spectrum", meaning no wavelength is defined.

Parameters
[in]encodedWavelengthA 16-bits encoded wavelength
Returns
the wavelength, in nanometers.

◆ EncodeWavelength()

static PRMAN_INLINE uint16_t RtRayGeometry::EncodeWavelength ( float  wavelength)
inlinestatic

Converts a wavelenght (in nanometers) to a compact 16 bits representation of it.

In both units 0 means "full spectrum", meaning no wavelength is defined.

Parameters
[in]wavelengthA wavelength in nanometers.
Returns
a 16-bits encoded wavelength.

◆ InitOrigination()

void RtRayGeometry::InitOrigination ( RixShadingContext const *  sCtx,
RtNormal3 const *  Ngn,
int  _shadingCtxIndex 
)
inline

InitOrigination() should be called after the ray geometry has been setup for calls to GetNearestHits().

In addition to setting the origination context, we analyze the combination of lobeSampled and Nn to determine whether a transmit event was a nominal enter or exit. Origination state allows rays to be back-tracked to the original shading context for recovery of ray-path information.

Parameters
[in]sCtxShading context containing the shading point that launched this ray.
[in]NgnGeometric normal at the shading point that launched this ray.
[in]_shadingCtxIndexIndex of the shading point in the shading context.

References RixBXLobeSampled::GetTransmit(), RixShadingContext::integratorCtxIndex, RixBXLobeSampled::SetEntering(), and RixShadingContext::shadingCtxId.

◆ InitTransmitOrigination()

void RtRayGeometry::InitTransmitOrigination ( RixShadingContext const *  sCtx,
int  _shadingCtxIndex 
)
inline

InitTransmission() is analogous to InitOrigination() but should be used for transmission rays.

All transmission 'events' are transmit events and lobeSampled is ill-defined (since lights are responsible for producing most transmission rays).

Parameters
[in]sCtxShading context containing the shading point that launched this ray.
[in]_shadingCtxIndexIndex of the shading point in the shading context.

References RixShadingContext::integratorCtxIndex, RixBXLobeSampled::Set(), RixBXLobeSampled::SetEntering(), and RixShadingContext::shadingCtxId.

◆ SetRaySpread()

void RtRayGeometry::SetRaySpread ( RixBXLobeSampled  lobe,
float  rayOriginRadius,
float  rayOriginSpread,
float  curvature,
float  fPdf,
bool  lightPath = false 
)
inline

Computes ray spread for given reflection/transmission type, pdf, and surface curvature, using two approaches:

  1. Ray spread based on roughness (pdf). The ray spread from a flat rough surface depends on roughness: the higher roughness the lower the pdf in a given direction; here we map the pdf to a ray spread using a heuristic mapping.
  2. Ray spread based on surface curvature. The ray spread for reflection from a curved smooth surface is simple to compute using Igehy's formula.

We set the overall ray spread to the max of these two. (For rough curved surfaces a better answer might be larger than the max – perhaps the sum? – but it's not 100% clear what the optimal combined value should be.)

Parameters
[in]lobeUsed to determine if we are dealing with a reflection or transmission event.
[in]rayOriginRadiusIncident ray radius at ray origin.
[in]rayOriginSpreadIncident ray spread at ray origin.
[in]curvatureLocal surface curvature.
[in]fPdfPdf associated with the ray direction.
[in]lightPathIndicates if the rays is part of a light path or not. Optional.

References RixBXLobeSampled::GetReflect(), RixBXLobeSampled::GetSolidAngle(), RixBXLobeSampled::GetTransmit(), and RixIsFinite().

Member Data Documentation

◆ direction

RtVector3 RtRayGeometry::direction

Radius of ray at its origin.

◆ flags

uint16_t RtRayGeometry::flags

Internal hit id, zero means 'no hit.'.

◆ hitId

uint16_t RtRayGeometry::hitId
mutable

This value is updated on each presence hit, whenever a surface with presence is hit.

The presence value will be compared against this threshold to decide if it is a hit or a miss.

◆ ignoreGroupingId

uint16_t RtRayGeometry::ignoreGroupingId

If non-zero: ignore geometry with the specified Attribute "grouping" "id".

◆ integratorCtxIndex

int16_t RtRayGeometry::integratorCtxIndex

Shading context unique identifier.

◆ lobeSampled

RixBXLobeSampled RtRayGeometry::lobeSampled

See RayType for possible values.

◆ lpeState

RixLPEState* RtRayGeometry::lpeState

User-provided index in the ray bundle.

◆ maxDist

float RtRayGeometry::maxDist

Minimum hit distance. Used only for primary rays.

◆ minDist

float RtRayGeometry::minDist

How much the ray radius changes for each unit the ray travels.

Use as is to get tex/env filter radii. Multiply by 2 to get footprints and tex/env filter diameters. Values range between 0 and 1 (where 1 corresponds to an angle of 45 degrees).

◆ opacityThreshold

float RtRayGeometry::opacityThreshold

Data for internal use.

◆ origin

RtPoint3 RtRayGeometry::origin

◆ originRadius

float RtRayGeometry::originRadius

Ray origin.

◆ private0

uint32_t RtRayGeometry::private0[5]

A pointer to the LPE state for this ray launch.

◆ rayId

uint16_t RtRayGeometry::rayId

Index into the lauching shading context.

◆ raySpread

float RtRayGeometry::raySpread

Ray direction.

◆ raytype

uint16_t RtRayGeometry::raytype

Shutter-normalized time of ray launch.

◆ shadingCtxId

RixShadingContext::Id RtRayGeometry::shadingCtxId

Characteristics of the BxDF lobe this ray samples.

◆ shadingCtxIndex

uint16_t RtRayGeometry::shadingCtxIndex

Associated primary ray index.

◆ time

float RtRayGeometry::time

Maximum hit distance.

◆ wavelength

uint16_t RtRayGeometry::wavelength

Flags for internal use.

Wavelength associated with the ray. See EncodeWavelength() and DecodeWavelength() methods. This quantity is then available on hits by querying the k_wavelength built-in primvar with RixShadingContext::GetBuiltinVar().


The documentation for this struct was generated from the following file: