RenderManAPI  24.0
RixVolume.h
Go to the documentation of this file.
1 /*
2 # ------------------------------------------------------------------------------
3 #
4 # Copyright (c) 2020 Pixar. All rights reserved.
5 #
6 # The information in this file (the "Software") is provided for the exclusive
7 # use of the software licensees of Pixar ("Licensees"). Licensees have the
8 # right to incorporate the Software into other products for use by other
9 # authorized software licensees of Pixar, without fee. Except as expressly
10 # permitted herein, the Software may not be disclosed to third parties, copied
11 # or duplicated in any form, in whole or in part, without the prior written
12 # permission of Pixar.
13 #
14 # The copyright notices in the Software and this entire statement, including the
15 # above license grant, this restriction and the following disclaimer, must be
16 # included in all copies of the Software, in whole or in part, and all permitted
17 # derivative works of the Software, unless such copies or derivative works are
18 # solely in the form of machine-executable object code generated by a source
19 # language processor.
20 #
21 # PIXAR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL PIXAR BE
23 # LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
24 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
25 # OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
26 # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. IN NO CASE WILL
27 # PIXAR'S TOTAL LIABILITY FOR ALL DAMAGES ARISING OUT OF OR IN CONNECTION WITH
28 # THE USE OR PERFORMANCE OF THIS SOFTWARE EXCEED $50.
29 #
30 # Pixar
31 # 1200 Park Ave
32 # Emeryville CA 94608
33 #
34 # ------------------------------------------------------------------------------
35 */
36 
37 #ifndef RixVolume_h
38 #define RixVolume_h
39 
40 #include <cstddef> // for NULL
41 #include "RixIntegrator.h" // for RtRayGeometry
42 #include "RixInterfaces.h" // for RixInterface
43 #include "RixShading.h" // for RixSCDetail, etc
44 #include "RiTypesHelper.h" // for RtPoint3, etc.
45 
49 {
50 public:
52  {}
53 
55  {}
56 };
57 
59 {
60 public:
62  {}
63 
64  // Returns true if the iterator was able to advance the full
65  // distance, otherwise returns false, signalling that some local
66  // new maximum density information is now available.
67  virtual bool Advance(float distance) = 0;
68 
69  // Returns the distance at the end of the current segment
70  virtual float GetSegmentEnd() const = 0;
71 
72  virtual float GetTotalDistance() const = 0;
73 
74  virtual RtPoint3 GetOrigin() const = 0;
75 
76  virtual RtVector3 GetDirection() const = 0;
77 
78  virtual float GetOriginRadius() const = 0;
79 
80  virtual float GetRaySpread() const = 0;
81 
82  virtual float GetMaxDensity() const = 0;
83 
84  virtual float GetMinDensity() const = 0;
85 
87 
88  bool finished;
89 
91 
92 protected:
94  {}
95 };
96 
98 {
99  k_SkipMatteVolumes // Whether to skip volumes with Matte 1; bool input
100 };
101 
103 {
104 public:
106  {}
107 
112  virtual RixVolumeAggregateIterator* CreateIterator(int index) = 0;
113 
119  virtual void ComputeDensity(RixVolumeAggregateIterator** iterators, float* densities) = 0;
120 
126  virtual void ComputeEmission(RixVolumeAggregateIterator** iterators, RtColorRGB* emissions) = 0;
127 
138  virtual void CreateScatterContexts(RixVolumeAggregateIterator** iterators,
139  int* numShadingContexts,
140  RixShadingContext** shadingContexts) = 0;
141 
146  virtual void CreateScatterContexts(RixShadingContext const* parentContext,
147  RixVolumeAggregateIterator** iterators,
148  int* numShadingContexts,
149  RixShadingContext** shadingContexts) = 0;
150 
157  virtual void ReleaseScatterContexts(int numShadingContexts, RixShadingContext** shadingContexts,
158  RixBXLobeTraits const* exposeVol = NULL,
159  int** memberships = NULL,
160  int* numNewShadingContexts = NULL,
161  RixShadingContext const** newShadingContexts = NULL) = 0;
162 
170  virtual void GenerateLightSamples(RixVolumeAggregateIterator** iterators, RixRNG* rng,
171  RixLightingServices* lightingServices, float* maxDistances,
172  RtPoint3* positions, bool* sampleFailed) = 0;
173 
179  virtual void ComputeDensity(RixVolumeAggregateIterator** iterators, RtColorRGB* densities) = 0;
180 
182  virtual bool SetProperty(VolumeAggregateProperty, void const* in) = 0;
183 
186 
191  virtual void AddToIrradianceQueries(RixVolumeAggregateIterator* iterator, int stepNum,
192  RixVolumeIrradianceEstimateContext* queryContext) = 0;
193 
197  RixLightingServices* lightingServices, float* estimates,
198  float* confidences) = 0;
199 };
200 
209 {
210 public:
212  {}
213 
214  // Begin for a Rix shading context (RIS usage)
215  virtual void Begin(RixShadingContext const* sCtx) = 0;
216 
217  virtual void End() = 0;
218 
237  virtual int GetDensityRanges(const RtPoint3& pt0, const RtPoint3& pt1, float length,
238  float maxDensity, float** dist, float** minDensities,
239  float** maxDensities, float* minTrans, float* maxTrans) const = 0;
240 
241  virtual RixSCDetail EvalTemporalParam(int paramId, int arrayIndex, float const** result,
242  float const* dflt) const = 0;
243 
244  virtual RixSCDetail EvalTemporalParam(int paramId, int arrayIndex, RtColorRGB const** result,
245  RtColorRGB const* dflt) const = 0;
246 
247  virtual RixSCDetail EvalTemporalParam(int paramId, int arrayIndex, RtFloat3 const** result,
248  RtFloat3 const* dflt) const = 0;
249 
250  virtual RixVolumeAggregate* GetAggregate(RtUString const name, int numRays,
251  RtRayGeometry const* rays,
252  RtUString const subset = US_NULL,
253  RtUString const excludeSubset = US_NULL) const = 0;
254 
255  virtual bool HasAggregate(RtUString const name, bool& hasMatte) const = 0;
256 
257 protected:
259  {}
261 };
262 
263 #endif
#define US_NULL
Definition: RiTypesHelper.h:683
virtual void AddToIrradianceQueries(RixVolumeAggregateIterator *iterator, int stepNum, RixVolumeIrradianceEstimateContext *queryContext)=0
Take the points in space referenced by the iterators&#39; current states and add them to the query contex...
All-inlined interface for generating sample points for use by Monte Carlo integration and multiple-im...
Definition: RixRNG.h:59
virtual float GetMinDensity() const =0
RixShadingContext is analogous to a RenderMan grid - it is a group of 1 or more points that may be sh...
Definition: RixShading.h:663
virtual void ComputeDensity(RixVolumeAggregateIterator **iterators, float *densities)=0
Given a set of iterators, computes the volume aggregate densities at each iterator&#39;s current distance...
This class can be used by an aggregate to queue up a set of estimate queries for later evaluation via...
Definition: RixVolume.h:48
virtual bool Advance(float distance)=0
pxrcore::ColorRGB RtColorRGB
Definition: RiTypesHelper.h:520
Definition: RixVolume.h:102
virtual ~RixVolumeIrradianceEstimateContext()
Definition: RixVolume.h:54
virtual float GetMaxDensity() const =0
virtual RixSCDetail EvalTemporalParam(int paramId, int arrayIndex, float const **result, float const *dflt) const =0
Base class for all Rix interfaces.
Definition: RixInterfaces.h:133
virtual void ComputeEmission(RixVolumeAggregateIterator **iterators, RtColorRGB *emissions)=0
Given a set of iterators, computes the volume aggregate emissions at each iterator&#39;s current distance...
virtual void ReleaseScatterContexts(int numShadingContexts, RixShadingContext **shadingContexts, RixBXLobeTraits const *exposeVol=NULL, int **memberships=NULL, int *numNewShadingContexts=NULL, RixShadingContext const **newShadingContexts=NULL)=0
Releases shading contexts created by a call to CreateScatterContexts.
virtual ~RixVolumeAggregate()
Definition: RixVolume.h:105
The RixVolumeServices interface allow the renderer to provide services that are useful for volume int...
Definition: RixVolume.h:208
RtFloat3 RtPoint3
Definition: RiTypesHelper.h:70
virtual void GenerateLightSamples(RixVolumeAggregateIterator **iterators, RixRNG *rng, RixLightingServices *lightingServices, float *maxDistances, RtPoint3 *positions, bool *sampleFailed)=0
Asks the given lighting services to generate a set of light sampling locations given the current posi...
virtual float GetRaySpread() const =0
RixSCDetail
RixSCDetail enumerates the valid sizing qualifiers for SC parameters.
Definition: RixShading.h:432
virtual float GetOriginRadius() const =0
virtual RixVolumeAggregateIterator & operator=(const RixVolumeAggregateIterator &rhs)=0
virtual RtVector3 GetDirection() const =0
RixVolumeServices()
Definition: RixVolume.h:211
Definition: RixIntegrator.h:234
Definition: RixVolume.h:99
VolumeAggregateProperty
Definition: RixVolume.h:97
pxrcore::Float3 RtFloat3
Definition: RiTypesHelper.h:69
virtual float GetTotalDistance() const =0
~RixVolumeServices() override
Definition: RixVolume.h:258
virtual ~RixVolumeAggregateIterator()
Definition: RixVolume.h:61
virtual RixVolumeAggregate * GetAggregate(RtUString const name, int numRays, RtRayGeometry const *rays, RtUString const subset=US_NULL, RtUString const excludeSubset=US_NULL) const =0
bool finished
Definition: RixVolume.h:88
virtual float GetSegmentEnd() const =0
RixVolumeAggregateIterator()
Definition: RixVolume.h:93
virtual int GetDensityRanges(const RtPoint3 &pt0, const RtPoint3 &pt1, float length, float maxDensity, float **dist, float **minDensities, float **maxDensities, float *minTrans, float *maxTrans) const =0
When invoked on a shading context bound to RiVolume geometry, GetDensityRanges returns information ab...
float currentDistance
Definition: RixVolume.h:90
Definition: RixVolume.h:58
Usage
Definition: RixLighting.h:142
RixShadingContext const * shadingCtx
Definition: RixVolume.h:260
RixVolumeIrradianceEstimateContext()
Definition: RixVolume.h:51
virtual bool SetProperty(VolumeAggregateProperty, void const *in)=0
Sets various desired properties of the volume aggregate.
virtual RixVolumeAggregateIterator * CreateIterator(int index)=0
Creates a new iterator bound to the ray indicated by index.
virtual void CreateScatterContexts(RixVolumeAggregateIterator **iterators, int *numShadingContexts, RixShadingContext **shadingContexts)=0
Given a set of iterators, creates a set of shading contexts that can be used to compute volumetric sc...
virtual void Begin(RixShadingContext const *sCtx)=0
virtual RtPoint3 GetOrigin() const =0
virtual void ServiceIrradianceQueries(RixVolumeIrradianceEstimateContext *queryContext, RixLightingServices *lightingServices, float *estimates, float *confidences)=0
Return an estimate of the irridiance incident on the points accumulated in the query context...
This struct represents the characteristics of potentially several lobes of a bxdf in aggregate...
Definition: RixBxdfLobe.h:178
virtual void End()=0
pxrcore::UString RtUString
Definition: RiTypesHelper.h:682
virtual RixVolumeIrradianceEstimateContext * CreateIrradianceEstimateContext()=0
Create a query context for use by the add and service functions below.
RtFloat3 RtVector3
Definition: RiTypesHelper.h:72
virtual bool HasAggregate(RtUString const name, bool &hasMatte) const =0