RenderMan  26.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RixLightingServices2 Class Referenceabstract

#include <RixLighting2.h>

Inherits RixLightingServices.

Public Types

enum  IntegratorIntent { k_LightSamples, k_MaterialSamples, k_MaterialAndLightSamples }
 
enum  FixedSampleCountMode { k_IgnoreFixedSampleCount = 0, k_RespectFixedSampleCount = 1, k_ReducedFixedSampleCount = 2 }
 
typedef FixedSampleCountMode Mode
 
enum  Type {
  k_Float, k_Integer, k_StringV, k_Color,
  k_Normal, k_Vector, k_Point, k_HPoint,
  k_MPoint, k_Matrix
}
 

Public Member Functions

 RixLightingServices2 ()
 
virtual void GetAllLights (const RixLight ***lights, int *numLights)=0
 
virtual void GetActiveLights (const RixLight ***activeLights, int *numActiveLights)=0
 
virtual void GetActiveLights (int **activeLightNumbers, int *numActiveLights)=0
 
virtual void GetActiveLights (const RixLight ***activeLights, int **activeLightNumbers, int *numActiveLights)=0
 
virtual bool GetLightFilter (int lightIndex, RixLightFilterContext const **lfCtx, RixLightFilter **filter, void const **instance)=0
 
virtual bool HasAnyLightFilter (int lightIndex)=0
 
virtual int GetLightNumber (RixLight *light)=0
 
virtual int GetLightNumber (int lightIndex)=0
 
virtual float GetLightAreaScale (int lightIndex)=0
 
virtual RixLPEToken GetCurrentLpeToken (int lightIndex)=0
 
virtual void BeginSampling (int nSamples, RixRNG *rng)=0
 
virtual void GetLightCtx (int lightIndex, int pointIndex, int sampleIndex, RixLightContext const **lCtx, bool allLights=false)=0
 
virtual void BeginEmissionSampling (int nPoints, int nSamples, int const *integratorCtxIds, RixPhotonGuiding const *photonGuiding, RixRNG *rng)=0
 
virtual void BeginPhoton (RixShadingContext const *shdCtx)=0
 
virtual void Begin (RixShadingContext const *shadingContext, RixRNG *rixRNG, RixBXEvaluateDomain evaluationDomain, IntegratorIntent integratorIntent, FixedSampleCountMode fixedSampleCountMode, SampleMode sampleMode, int *fixedSampleCount=nullptr, int depth=0, int parentIndirectCount=1)=0
 Initializes the lighting services for a given shading context. More...
 
virtual void GenerateSamples (int numLightSamples, RixRNG *rixRNG, int *lightGroupIds, RixLPEToken *lightLpeTokens, RtVector3 *directionsToSamples, RtNormal3 *lightNormals, float *distancesToSamples, RixBXLobeWeights *lightContributions, RtColorRGB *transmissions, RtColorRGB *volumeEmissions, float *directLightingPdfs, float *selectionProbs, RixBXLobeTraits const *materialLobesWanted, RixBXLobeWeights *evaluatedMaterialWeights, float *evaluatedMaterialFPdfs, float *evaluatedMaterialRPdfs, RixBXLobeTraits *evaluatedMaterialLobes, RixLight **sampledLights, RtColorRGB const *pathThroughputs=nullptr, RixMWConnectionResult *mwConnectionResult=nullptr)=0
 Generates light samples for the shading points encapsulated by the RixShadingContext given to Begin(). More...
 
virtual void GenerateSamples (int numLightSamples, RixRNG *rixRNG, int *lightGroupIds, RixLPEToken *lightLpeTokens, RtVector3 *directionsToSamples, RtNormal3 *lightNormals, float *distancesToSamples, RixBXLobeWeights *lightContributions, RtColorRGB *transmissions, RtColorRGB *volumeEmissions, float *directLightingPdfs, float *selectionProbs, float *emissionPositionPdfs, float *emissionDirectionPdfs, float *solidAngleToAreaFactors, RixBXLobeTraits const *materialLobesWanted, RixBXLobeWeights *evaluatedMaterialWeights, float *evaluatedMaterialFPdfs, float *evaluatedMaterialRPdfs, RixBXLobeTraits *evaluatedMaterialLobes, RixLight **sampledLights, RtColorRGB const *pathThroughputs=nullptr, RixPhotonGuiding const *photonGuide=nullptr, RixMWConnectionResult *mwConnectionResult=nullptr)=0
 Generates light samples for the shading points encapsulated by the RixShadingContext given to Begin(). More...
 
virtual void GenerateSamplesForRaySegments (int numLightSamples, RixRNG *rixRNG, float *maxDistances, RtVector3 *samplePositions, float *selectionProbs, float *segmentMinT, float *segmentMaxT)=0
 Generates light samples for the line segments encapsulated by the RixShadingContext given to Begin() (P denotes the origin of the ray, Vn its direction and VLen its length. More...
 
virtual void EvaluateSamples (int numMaterialSamples, RixRNG *rixRNG, RtVector3 const *directions, float *distances, float const *materialPdfs, RixBXLobeWeights const *materialWeights, RixBXLobeSampled const *materialLobeSampled, int *lightGroupIds, RixLPEToken *lightLpeTokens, RixBXLobeWeights *lightContributions, RtColorRGB *transmissions, RtColorRGB *volumeEmissions, float *directLightingPdfs, float *selectionProbs, RtNormal3 *lightNormals, RixLight **evaluatedLights, RtColorRGB const *pathThroughputs=nullptr)=0
 Evaluate light contributions for the provided directions, w.r.t. More...
 
virtual void EvaluateSamples (int numMaterialSamples, RixRNG *rixRNG, RtVector3 const *directions, float *distances, float const *materialPdfs, RixBXLobeWeights const *materialWeights, RixBXLobeSampled const *materialLobeSampled, int *lightGroupIds, RixLPEToken *lightLpeTokens, RixBXLobeWeights *lightContributions, RtColorRGB *transmissions, RtColorRGB *volumeEmissions, float *directLightingPdfs, float *selectionProbs, float *emissionPositionPdfs, float *emissionDirectionPdfs, float *solidAngleToAreaFactors, RtNormal3 *lightNormals, RixLight **evaluatedLights, RtColorRGB const *pathThroughputs=nullptr, RixPhotonGuiding const *photonGuide=nullptr)=0
 Evaluate light contribution for the provided directions, w.r.t. More...
 
virtual void BeginEmission (FixedSampleCountMode mode, int *fixedSampleCount=nullptr)=0
 Initializes the lighting services for photon emission. More...
 
virtual void GenerateEmission (int numPts, int const *integratorContextIndices, int const *rayIds, int numSamples, RixRNG *rixRNG, int *lightGroupIds, RixLPEToken *lightLpeTokens, RixBXLobeWeights *lightContributions, RtColorRGB *transmissions, RtColorRGB *volumeEmissions, int *numShadingContexts, RixShadingContext const ***shadingContexts, RtPoint3 *emissionPositions, RtVector3 *emissionNormals, float *distances, float *directLightingPdfs, float *selectionProbs, float *emissionPositionsPdfs, RtVector3 *emissionDirections, float *emissionCosines, float *emissionDirectionPdfs, float *solidAngleToAreaFactors, RixPhotonGuiding const *photonGuide=nullptr)=0
 Generates photons on the surface of the lights, then trace them through the scene. More...
 
virtual void End ()=0
 Must be call in pair with Begin(). More...
 
virtual void EndEmission ()=0
 Must be call in pair with BeginEmission(). More...
 
virtual int GetNumLightGroups ()=0
 
virtual int GetLightGroup (RtUString const name)=0
 
virtual RtUString GetLightGroupName (int i)=0
 
virtual int GetTotalNumLights ()=0
 
virtual int GetTotalNumLightsWithFixedSamples ()=0
 
virtual int GetTotalFixedSamples ()=0
 
virtual void UpdateWithResults (int nSamples, RixBXLobeWeights const *contribution, RtColorRGB const *trans, float const *lPdfDirect, float const *lightSelectionProbs, float const *distances, RixBXLobeWeights const *evaluatedMaterialWeights, const RixLight *const *lights)=0
 Optional function to update the lighting services with results after the caller has independently computed material weights and/or visibility. More...
 
virtual void IrradianceEstimate (uint32_t lightSetId, RtPoint3 const *points, int numPts, float *estimates, float *confidences)=0
 Return an estimates of the irridiance incident on a set of points in space This will be zero if no estimate is available. More...
 
virtual void UpdateIndirectPaths (const std::vector< IndirectResult > *indirectResults, int numPaths)=0
 
virtual void EvalIndirect (int const *rayIds, int numPts, const RtVector3 *wos, void **learningNodes, const int *faceIdx, const RtNormal3 *pNn, const RixBXLobeTraits *lobesWanted, float *pdfs, float *vals)=0
 
virtual void SampleIndirect (int const *rayIds, int numPts, RixRNG *rixRNG, const RtVector3 *pNgn, const RtVector3 *pVn, const RtNormal3 *pNn, int *sampleFlags, RtVector3 *wos, float *pdfs, float *confidences, void **learningNodes, int *faceIdxs, RtPoint3 *camPs, float *nodeRs, float *vals)=0
 
virtual int GetVersion () const
 Get the version number of this interface. More...
 

Protected Member Functions

virtual ~RixLightingServices2 ()
 

Protected Attributes

RixShadingContext const * shadingCtx
 
RixBXEvaluateDomain domain
 
int m_version
 Version number of this interface. More...
 

Member Typedef Documentation

Member Enumeration Documentation

Enumerator
k_IgnoreFixedSampleCount 
k_RespectFixedSampleCount 
k_ReducedFixedSampleCount 
Enumerator
k_LightSamples 
k_MaterialSamples 
k_MaterialAndLightSamples 
enum RixInterface::Type
inherited
Enumerator
k_Float 
k_Integer 
k_StringV 
k_Color 
k_Normal 
k_Vector 
k_Point 
k_HPoint 
k_MPoint 
k_Matrix 

Constructor & Destructor Documentation

RixLightingServices2::RixLightingServices2 ( )
inline
virtual RixLightingServices2::~RixLightingServices2 ( )
inlineprotectedvirtual

Member Function Documentation

virtual void RixLightingServices::Begin ( RixShadingContext const *  shadingContext,
RixRNG rixRNG,
RixBXEvaluateDomain  evaluationDomain,
IntegratorIntent  integratorIntent,
FixedSampleCountMode  fixedSampleCountMode,
SampleMode  sampleMode,
int *  fixedSampleCount = nullptr,
int  depth = 0,
int  parentIndirectCount = 1 
)
pure virtualinherited

Initializes the lighting services for a given shading context.

Following calls to GenerateSamples() and EvaluateSamples() are relative to the shading context provided to the associated Begin() call. In particular, the 'number of points' referred to by these methods is the shading context's `numPts'.

Parameters
[in]shadingContextShading context encapsulating the points to be lit. The lighting services will retrieve various quantities from this shading context (P, Nn, bxdf, etc.)
[in]rixRNGPointer to a single RixRNG object.
[in]evaluationDomainDescribes the domain that needs to be considered by the lighting services. Light samples will not be generated outside of this domain.
[in]integratorIntentIndicates if only GenerateSamples(), EvaluateSamples(), or both will be called.
[in]fixedSampleCountModeIndicates if the lights' fixed sample count should be used.
[in]sampleModeDeprecated. Use a default-constructed SampleMode object.
[out]fixedSampleCountNumber of fixed samples required by the lights (for the currently linked light set).
[in]depthIndicates the depth of the lighting computations. 0 means the shading context encapsulate camera ray hit points.
[in]parentIndirectCountDeprecated and ignored.
virtual void RixLightingServices::BeginEmission ( FixedSampleCountMode  mode,
int *  fixedSampleCount = nullptr 
)
pure virtualinherited

Initializes the lighting services for photon emission.

Photon emission is a global process, so there is no associated shading context.

Parameters
[in]modeIndicates if the lights' fixed sample count should be used. Note that the fixed sample counts are not taken into account during photon emission, and only affect direct lighting methods (GenerateSamples() and EvaluateSamples()).
[out]fixedSampleCountNumber of fixed samples required by all the lights in the scene.
virtual void RixLightingServices2::BeginEmissionSampling ( int  nPoints,
int  nSamples,
int const *  integratorCtxIds,
RixPhotonGuiding const *  photonGuiding,
RixRNG rng 
)
pure virtual
virtual void RixLightingServices2::BeginPhoton ( RixShadingContext const *  shdCtx)
pure virtual
virtual void RixLightingServices2::BeginSampling ( int  nSamples,
RixRNG rng 
)
pure virtual
virtual void RixLightingServices::End ( )
pure virtualinherited

Must be call in pair with Begin().

virtual void RixLightingServices::EndEmission ( )
pure virtualinherited

Must be call in pair with BeginEmission().

virtual void RixLightingServices::EvalIndirect ( int const *  rayIds,
int  numPts,
const RtVector3 *  wos,
void **  learningNodes,
const int *  faceIdx,
const RtNormal3 *  pNn,
const RixBXLobeTraits lobesWanted,
float *  pdfs,
float *  vals 
)
pure virtualinherited
virtual void RixLightingServices::EvaluateSamples ( int  numMaterialSamples,
RixRNG rixRNG,
RtVector3 const *  directions,
float *  distances,
float const *  materialPdfs,
RixBXLobeWeights const *  materialWeights,
RixBXLobeSampled const *  materialLobeSampled,
int *  lightGroupIds,
RixLPEToken lightLpeTokens,
RixBXLobeWeights lightContributions,
RtColorRGB *  transmissions,
RtColorRGB *  volumeEmissions,
float *  directLightingPdfs,
float *  selectionProbs,
RtNormal3 *  lightNormals,
RixLight **  evaluatedLights,
RtColorRGB const *  pathThroughputs = nullptr 
)
pure virtualinherited

Evaluate light contributions for the provided directions, w.r.t.

shading points encapsulated by the RixShadingContext given to Begin(). This is the unidirectional version.

Can optionally:

  • trace transmision rays
  • evaluate participating medium emission

For each shading point and material sample configuration, we describe the corresponding intersection point with a light, and its associated contributions and geometric properties as the 'evaluated light sample'. If multiple lights can be hit for a given configuration, only one evaluated light sample is returned (stochastically chosen).

In the following section, numPts refers to the number of points on the shading context given to Begin() (shadingContext->numPts). Additionally, for this section, the expression 'light samples' is meant to be read as 'evaluated light samples'.

Unless explicitly specified otherwise, the pointer parameters are arrays of size numPts * numMaterialSamples (i.e. the total number of samples being evaluated for the batch of shading points).

Shading points and light samples (potentially more than one sample per shading point) are associated in the following way: for a given shading point with (shading context) index i, the corresponding light sample properties are stored at indices i + j * numPts, where j is a number between 0 and numMaterialSamples.

The RixBXLobeWeights objects must encapsulate arrays of length numPts * numMaterialSamples (for each required lobe).

Optional pointer parameters can be set to nullptr if the associated quantity isn't needed.

Parameters
[in]numMaterialSamplesNumber of material samples to be evaluated for each point.
[in]rixRNGPointer to a single RixRNG object.
[in]directions
[in,out]distancesInput: maximum distances to consider when searching for light samples. Output: distances to the light samples.
[in]materialPdfsForward pdfs of the sampled material samples.
[in]materialWeightsPointer to a single RixBXLobeWeights object, that contains the material responses of the sampled material samples.
[in]materialLobeSampledLobe traits of the sampled material samples.
[out]lightGroupIdsLight group ids of the lights associated with each light sample. These ids can be given to GetLightGroupName().
[out]lightLpeTokensLpe tokens of the lights associated with each light sample. These lpe tokens can be given to the RixLPE::SplatHelper() constructor.
[out]lightContributionsPointer to a single RixBXLobeWeights object, where the light samples contributions will be stored.
[out]transmissionsTransmissions between each shading point and the light samples. Optional.
[out]volumeEmissionsEmissions due to participating medium along the segments between the shading points and the light sample positions. Optional.
[out]directLightingPdfsLight samples pdfs, expressed in solid angle measure w.r.t. the shading points.
[out]selectionProbs
[out]lightNormalsLight surface normals at the evaluated sample positions.
[out]evaluatedLightsPointers to the lights associated with the light samples. Optional.
[in]pathThroughputsThroughputs associated with the shading points. May be used to help culling transmission rays. Array of size numPts. Optional.
virtual void RixLightingServices::EvaluateSamples ( int  numMaterialSamples,
RixRNG rixRNG,
RtVector3 const *  directions,
float *  distances,
float const *  materialPdfs,
RixBXLobeWeights const *  materialWeights,
RixBXLobeSampled const *  materialLobeSampled,
int *  lightGroupIds,
RixLPEToken lightLpeTokens,
RixBXLobeWeights lightContributions,
RtColorRGB *  transmissions,
RtColorRGB *  volumeEmissions,
float *  directLightingPdfs,
float *  selectionProbs,
float *  emissionPositionPdfs,
float *  emissionDirectionPdfs,
float *  solidAngleToAreaFactors,
RtNormal3 *  lightNormals,
RixLight **  evaluatedLights,
RtColorRGB const *  pathThroughputs = nullptr,
RixPhotonGuiding const *  photonGuide = nullptr 
)
pure virtualinherited

Evaluate light contribution for the provided directions, w.r.t.

shading points encapsulated by the RixShadingContext given to Begin(). This is the bidirectional version.

The bidirectional version of this method directly extends the unidirectional version, and produces additional emission pdfs.

Can optionally:

  • evaluate volumetric pdfs
Parameters
[in]numMaterialSamples
[in]rixRNG
[in]directions
[in,out]distances
[in]materialPdfs
[in]materialWeights
[in]materialLobeSampled
[out]lightGroupIds
[out]lightLpeTokens
[out]lightContributions
[out]transmissions
[out]volumeEmissions
[out]directLightingPdfs
[out]selectionProbs
[out]emissionPositionPdfsPositional pdfs of the light samples, expressed in area measure. For samples evaluated for infinite lights (for which area is not well-defined), the value FLT_MAX is returned.
[out]emissionDirectionPdfsDirectional pdfs of the light samples, expressed in solid angle measure, w.r.t. emission position. These are conditional pdfs, knowing the emission positions. For samples evaluated for infinite lights, the value 1.0f is returned.
[out]solidAngleToAreaFactorsConversion factors from solid angle measure (w.r.t. the shading points) to area measure.
[out]lightNormals
[out]evaluatedLights
[in]pathThroughputs
[in]photonGuidePointer to a single RixPhotonGuide object. If photon guiding is used when calling GenerateEmission(), the same object needs to be used here in order to get consistent emission pdfs across the various GenerateSamples() and EvaluateSamples() calls. Optional.
virtual void RixLightingServices::GenerateEmission ( int  numPts,
int const *  integratorContextIndices,
int const *  rayIds,
int  numSamples,
RixRNG rixRNG,
int *  lightGroupIds,
RixLPEToken lightLpeTokens,
RixBXLobeWeights lightContributions,
RtColorRGB *  transmissions,
RtColorRGB *  volumeEmissions,
int *  numShadingContexts,
RixShadingContext const ***  shadingContexts,
RtPoint3 *  emissionPositions,
RtVector3 *  emissionNormals,
float *  distances,
float *  directLightingPdfs,
float *  selectionProbs,
float *  emissionPositionsPdfs,
RtVector3 *  emissionDirections,
float *  emissionCosines,
float *  emissionDirectionPdfs,
float *  solidAngleToAreaFactors,
RixPhotonGuiding const *  photonGuide = nullptr 
)
pure virtualinherited

Generates photons on the surface of the lights, then trace them through the scene.

The resulting hits are returned in the form of RixShadingContext objects.

Caller is responsible for freeing the returned RixShadingContext pointers via a calls to RixIntegratorContext::ReleaseShadingContexts().

Number of emitted photons

This function needs to be provided with a number of 'points' (numPts), where each point represents a configuration composed of:

  • the index of a primary ray
  • a user-provided ray id The primary ray index will be used to retrieve properties, like emission time. The ray id will be return as rayId in the shading context associated with all the photons generated for this point.

For each point configuration, numSamples photons will be generated. These photons will share some properties, such as their emission time. However, they will have independent emission positions, directions and properties.

As a consequence, a total number of numPts * numSamples photons will be generated.

The RixBXLobeWeights objects must encapsulate arrays of length numPts * numSamples (for each required lobe).

Photon hits

Each photon hit is returned in its own shading context. The numSamples hits found for the photons associated with the 'point' of index i are stored in shadingContexts[i]. The shading context associated with sample j of point i is shadingContexts[i][j].

This means that shadingContexts has to be an array of size numPts (element type is RixShadingContext**). And each array element has to be an array of size numSamples (element type is RixShadingContext*).

Because photons can entirely miss the scene geometry, the actual number of valid shading contexts for a given point i may be less than numSamples. This number will be returned in the array numShadingContexts[i]. A value of zero indicates that all photon emitted for the corresponding point have missed.

Light linking

Because photon emission is a global process, light linking isn't known at the moment of photon creation and emission. However, after a photon has hit an object, light linking checked. If the light that emitted the photon isn't part of the linked light set of the hit object, the corresponding direct lighting pdf will be set to zero, and all other quantities for this hit should be considered invalid.

Parameters
[in]numPtsNumber of point configurations for which to generate photons.
[in]integratorContextIndicesIntegrator context indices associated with each point configuration.
[in]rayIdsUser-provided ray ids associated with each point configuration.
[in]numSamplesNumber of photons to generate for each point configuration.
[in]rixRNGPointer to a single RixRNG object.
[out]lightGroupIdsLight group ids of the lights associated with each photon. These ids can be given to GetLightGroupName().
[out]lightLpeTokensLpe tokens of the lights associated with each photon. These lpe tokens can be given to the RixLPE::SplatHelper() constructor.
[out]lightContributionsPointer to a single RixBXLobeWeights object, where the photon contributions will be stored.
[out]transmissionsTransmissions between the photon emission positions and their associated hit points.
[out]volumeEmissionsEmissions due to participating medium along the segments between the photon emission positions and their associated hit points. Optional.
[out]numShadingContextsNumber of valid shading contexts returned for each point configuration. Must be an array of size numPts. Returned values will be a number between 0 and numSamples. See method description for more details.
[out]shadingContextsShading contexts associated with each photon hit. Must be an array of size `numPts', of arrays of size 'numSamples'. See method description for more details.
[out]emissionPositionsPhoton emission positions.
[out]emissionNormalsLight surface normals at the photon emission positions.
[out]distancesDistances between the photon emission positions and photon hits. These are also valid for infinite lights, since the actual photon emission positions and distances to hits may be needed by some light transport algorithms.
[out]directLightingPdfsDirect light sampling pdfs, expressed in solid angle measure w.r.t. the photon hits. These are the directLightingPdfs quantities that would have been returned by the GenerateSamples() and EvaluateSamples() when generating or evaluating light samples at the photon emission position.
[out]selectionProbs
[out]emissionPositionsPdfsPositional pdfs of the light samples, expressed in area measure. For samples evaluated for infinite lights (for which area is not well-defined), the value FLT_MAX is returned.
[out]emissionDirectionsPhoton emission direction. Oriented from the photon emission position to the photon hit.
[out]emissionCosinesCosine between the photon emission direction and the photon emission normal. position to the photon hit.
[out]emissionDirectionPdfsDirectional pdfs of the light samples, expressed in solid angle measure, w.r.t. emission position. These are conditional pdfs, knowing the emission positions. For samples evaluated for infinite lights, the value 1.0f is returned.
[out]solidAngleToAreaFactorsConversion factors from solid angle measure (w.r.t. the photon hits) to area measure.
[in]photonGuidePointer to a single RixPhotonGuide object. If photon guiding is used when calling GenerateEmission(), the same object needs to be used here in order to get consistent emission pdfs across the various GenerateSamples() and EvaluateSamples() calls. Optional.
virtual void RixLightingServices::GenerateSamples ( int  numLightSamples,
RixRNG rixRNG,
int *  lightGroupIds,
RixLPEToken lightLpeTokens,
RtVector3 *  directionsToSamples,
RtNormal3 *  lightNormals,
float *  distancesToSamples,
RixBXLobeWeights lightContributions,
RtColorRGB *  transmissions,
RtColorRGB *  volumeEmissions,
float *  directLightingPdfs,
float *  selectionProbs,
RixBXLobeTraits const *  materialLobesWanted,
RixBXLobeWeights evaluatedMaterialWeights,
float *  evaluatedMaterialFPdfs,
float *  evaluatedMaterialRPdfs,
RixBXLobeTraits evaluatedMaterialLobes,
RixLight **  sampledLights,
RtColorRGB const *  pathThroughputs = nullptr,
RixMWConnectionResult mwConnectionResult = nullptr 
)
pure virtualinherited

Generates light samples for the shading points encapsulated by the RixShadingContext given to Begin().

This is the unidirectional version.

Can optionally:

  • evaluate material responses
  • trace transmision rays
  • evaluate participating medium emission

In the following section, numPts refers to the number of points on the shading context given to Begin() (shadingContext->numPts). Additionally, the expression 'light samples' is meant to be read as 'generated light samples'.

Unless explicitly specified otherwise, pointer parameters are arrays of size numPts * numLightSamples (i.e. the total number of light samples being generated for the batch of shading points).

Shading points and light samples (potentially more than one sample per shading point) are associated in the following way: for a given shading point with (shading context) index i, the corresponding light samples properties are stored at indices i + j * numPts, where j is a number between 0 and numLightSamples.

The RixBXLobeWeights objects must encapsulate arrays of length numPts * numLightSamples (for each required lobe).

Optional pointer parameters can be set to nullptr if the associated quantity isn't needed.

Parameters
[in]numLightSamplesNumber of light samples to be generated for each point. Depending on the FixedSampleCountMode passed to Begin(), this number must at least be equal to the number of fixed samples fixedSampleCount returned by Begin().
[in]rixRNGPointer to a single RixRNG object.
[out]lightGroupIdsLight group ids of the lights associated with each light sample. These ids can be given to GetLightGroupName().
[out]lightLpeTokensLpe tokens of the lights associated with each light sample. These lpe tokens can be given to the RixLPE::SplatHelper() constructor.
[out]directionsToSamplesNormalized directions to the light samples. For local lights, the sample positions are P + directionToSample * distanceToSample (where P is obtained from the shading context).
[out]lightNormalsLight surface normals at the sample positions.
[out]distancesToSamplesDistances to the light samples. For local lights, this is exactly the distance to the light sample. For infinite lights, this will be set to a value that is larger that the scene extent.
[out]lightContributionsPointer to a single RixBXLobeWeights object, where the light samples contributions will be stored.
[out]transmissionsTransmissions between each shading point and the light samples. Optional.
[out]volumeEmissionsEmissions due to participating medium along the segments between the shading points and the light sample positions. Optional.
[out]directLightingPdfsLight samples pdfs, expressed in solid angle measure w.r.t. the shading points.
[out]selectionProbsThe probability assigned by light selection for the chosen light being selected.
[in]materialLobesWantedProvides restrictions on the lobes that will be considered when the lighting services evaluate material responses. Array of size numPts. Optional.
[out]evaluatedMaterialWeightsPointer to a single RixBXLobeWeights object, where the material responses for the samples will be stored. The bxdf is retrieved from the shading context. Optional.
[out]evaluatedMaterialFPdfsForward pdfs of the evaluated material responses. Optional.
[out]evaluatedMaterialRPdfsReverse pdfs of the evaluated material responses. Optional.
[out]evaluatedMaterialLobesLobe traits of the evaluated material responses. Optional.
[out]sampledLightsPointers to the lights associated with the light samples. Optional.
[in]pathThroughputsThroughputs associated with the shading points. May be used to help culling transmission rays. Array of size numPts. Optional.
[in]mwConnectionResult
virtual void RixLightingServices::GenerateSamples ( int  numLightSamples,
RixRNG rixRNG,
int *  lightGroupIds,
RixLPEToken lightLpeTokens,
RtVector3 *  directionsToSamples,
RtNormal3 *  lightNormals,
float *  distancesToSamples,
RixBXLobeWeights lightContributions,
RtColorRGB *  transmissions,
RtColorRGB *  volumeEmissions,
float *  directLightingPdfs,
float *  selectionProbs,
float *  emissionPositionPdfs,
float *  emissionDirectionPdfs,
float *  solidAngleToAreaFactors,
RixBXLobeTraits const *  materialLobesWanted,
RixBXLobeWeights evaluatedMaterialWeights,
float *  evaluatedMaterialFPdfs,
float *  evaluatedMaterialRPdfs,
RixBXLobeTraits evaluatedMaterialLobes,
RixLight **  sampledLights,
RtColorRGB const *  pathThroughputs = nullptr,
RixPhotonGuiding const *  photonGuide = nullptr,
RixMWConnectionResult mwConnectionResult = nullptr 
)
pure virtualinherited

Generates light samples for the shading points encapsulated by the RixShadingContext given to Begin().

This is the bidirectional version.

The bidirectional version of this method directly extends the unidirectional version, and produces additional emission pdfs.

Can optionally:

  • evaluate volumetric pdfs
Parameters
[in]numLightSamples
[in]rixRNG
[out]lightGroupIds
[out]lightLpeTokens
[out]directionsToSamples
[out]lightNormals
[out]distancesToSamples
[out]lightContributions
[out]transmissions
[out]volumeEmissions
[out]directLightingPdfs
[out]selectionProbsThe probability assigned by light selection for the chosen light being selected.
[out]emissionPositionPdfsPositional pdfs of the light samples, expressed in area measure. For samples generated by infinite lights (for which area is not well-defined), the value FLT_MAX is returned.
[out]emissionDirectionPdfsDirectional pdfs of the light samples, expressed in solid angle measure, w.r.t. emission position. These are conditional pdfs, knowing the emission positions. For samples generated by infinite lights, the value 1.0f is returned.
[out]solidAngleToAreaFactorsConversion factors from solid angle measure (w.r.t. the shading points) to area measure.
[in]materialLobesWanted
[out]evaluatedMaterialWeights
[out]evaluatedMaterialFPdfs
[out]evaluatedMaterialRPdfs
[out]evaluatedMaterialLobes
[out]sampledLights
[in]pathThroughputs
[in]photonGuidePointer to a single RixPhotonGuide object. If photon guiding is used when calling GenerateEmission(), the same object needs to be used here in order to get consistent emission pdfs across the various GenerateSamples() and EvaluateSamples() calls. Optional.
[in]mwConnectionResult
virtual void RixLightingServices::GenerateSamplesForRaySegments ( int  numLightSamples,
RixRNG rixRNG,
float *  maxDistances,
RtVector3 *  samplePositions,
float *  selectionProbs,
float *  segmentMinT,
float *  segmentMaxT 
)
pure virtualinherited

Generates light samples for the line segments encapsulated by the RixShadingContext given to Begin() (P denotes the origin of the ray, Vn its direction and VLen its length.

Note that Vn is in this usage is pointing along the direction of travel of the ray. This function is used to help a volume integrator perform equiangular sampling on rays travelling through the volume

Parameters
[in]numLightSamplesNumber of light samples to be generated for each ray.
[in]rixRNGPointer to a single RixRNG object.
[in]maxDistancesMay be null. Otherwise, specifies the maximum distance a light can be from a line segment and still be considered a valid candidate.
[out]samplePositionsThe positions on the selected lights to be used as apexes for subsequent equiangular sampling.
[out]selectionProbsThe probability assigned by light selection for the chosen light being selected.
[out]segmentMinTMay be null. A number in the range 0-1 specifying the start of the subset of the input ray that is actually illuminated if the selected light has a spot cone.
[out]segmentMaxTMay be null. A number in the range 0-1 specifying the end of the subset of the input ray that is actually illuminated if the selected light has a spot cone.
virtual void RixLightingServices2::GetActiveLights ( const RixLight ***  activeLights,
int *  numActiveLights 
)
pure virtual
virtual void RixLightingServices2::GetActiveLights ( int **  activeLightNumbers,
int *  numActiveLights 
)
pure virtual
virtual void RixLightingServices2::GetActiveLights ( const RixLight ***  activeLights,
int **  activeLightNumbers,
int *  numActiveLights 
)
pure virtual
virtual void RixLightingServices2::GetAllLights ( const RixLight ***  lights,
int *  numLights 
)
pure virtual
virtual RixLPEToken RixLightingServices2::GetCurrentLpeToken ( int  lightIndex)
pure virtual
virtual float RixLightingServices2::GetLightAreaScale ( int  lightIndex)
pure virtual
virtual void RixLightingServices2::GetLightCtx ( int  lightIndex,
int  pointIndex,
int  sampleIndex,
RixLightContext const **  lCtx,
bool  allLights = false 
)
pure virtual
virtual bool RixLightingServices2::GetLightFilter ( int  lightIndex,
RixLightFilterContext const **  lfCtx,
RixLightFilter **  filter,
void const **  instance 
)
pure virtual
virtual int RixLightingServices::GetLightGroup ( RtUString const  name)
pure virtualinherited
Returns
The light group ids associated with a given light group name.
virtual RtUString RixLightingServices::GetLightGroupName ( int  i)
pure virtualinherited
Returns
The light group name associated with a given light group id.
virtual int RixLightingServices2::GetLightNumber ( RixLight light)
pure virtual
virtual int RixLightingServices2::GetLightNumber ( int  lightIndex)
pure virtual
virtual int RixLightingServices::GetNumLightGroups ( )
pure virtualinherited
Returns
The total number of distinct light groups in use.
virtual int RixLightingServices::GetTotalFixedSamples ( )
pure virtualinherited
Returns
The total number of fixed samples.
virtual int RixLightingServices::GetTotalNumLights ( )
pure virtualinherited
Returns
The total number of lights.
virtual int RixLightingServices::GetTotalNumLightsWithFixedSamples ( )
pure virtualinherited
Returns
The total number of lights with non-zero fixed sample count.
virtual int RixInterface::GetVersion ( ) const
inlinevirtualinherited

Get the version number of this interface.

Different interfaces might have different version numbers in a given release.

References RixInterface::m_version.

virtual bool RixLightingServices2::HasAnyLightFilter ( int  lightIndex)
pure virtual
virtual void RixLightingServices::IrradianceEstimate ( uint32_t  lightSetId,
RtPoint3 const *  points,
int  numPts,
float *  estimates,
float *  confidences 
)
pure virtualinherited

Return an estimates of the irridiance incident on a set of points in space This will be zero if no estimate is available.

The confidence will likewise be set to zero. Confidence is higher the more results have contributed to the learning node closest to each shading point

virtual void RixLightingServices::SampleIndirect ( int const *  rayIds,
int  numPts,
RixRNG rixRNG,
const RtVector3 *  pNgn,
const RtVector3 *  pVn,
const RtNormal3 *  pNn,
int *  sampleFlags,
RtVector3 *  wos,
float *  pdfs,
float *  confidences,
void **  learningNodes,
int *  faceIdxs,
RtPoint3 *  camPs,
float *  nodeRs,
float *  vals 
)
pure virtualinherited
virtual void RixLightingServices::UpdateIndirectPaths ( const std::vector< IndirectResult > *  indirectResults,
int  numPaths 
)
pure virtualinherited
virtual void RixLightingServices::UpdateWithResults ( int  nSamples,
RixBXLobeWeights const *  contribution,
RtColorRGB const *  trans,
float const *  lPdfDirect,
float const *  lightSelectionProbs,
float const *  distances,
RixBXLobeWeights const *  evaluatedMaterialWeights,
const RixLight *const *  lights 
)
pure virtualinherited

Optional function to update the lighting services with results after the caller has independently computed material weights and/or visibility.

Member Data Documentation

RixBXEvaluateDomain RixLightingServices::domain
protectedinherited
int RixInterface::m_version
protectedinherited

Version number of this interface.

Referenced by RixInterface::GetVersion().

RixShadingContext const* RixLightingServices::shadingCtx
protectedinherited

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