HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VGEO_Volume Class Referenceabstract

Base class for volume primitives in mantra. More...

#include <VGEO_Volume.h>

+ Inheritance diagram for VGEO_Volume:

Classes

class  DiscreteRayMarcher
 Utility class to perform numerically safe ray marching. More...
 
class  HitList
 

Public Member Functions

 VGEO_Volume ()
 
virtual ~VGEO_Volume ()
 
virtual float getNativeStepSize () const =0
 
virtual void getBoxes (UT_Array< UT_BoundingBox > &boxes, float radius, float dbound, float zerothreshold) const =0
 
virtual void getAttributeBinding (UT_StringArray &names, UT_IntArray &sizes) const =0
 
virtual void evaluate (const UT_Vector3 &pos, const UT_Filter &filter, float radius, float time, int idx, float *data) const =0
 
virtual void evaluateMulti (const UT_Vector3 *pos, const UT_Filter &filter, float radius, const float *time, int idx, float *data, int size, int stride) const
 
virtual bool evaluateInterval (const UT_BoundingBox &box, const UT_Filter &filter, float radius, float time, int idx, float *minval, float *maxval) const
 
virtual void intersectIsosurface (const VGEO_Ray &ray, const UT_Filter &filter, float radius, float time, int idx, float threshold, HitList &hits) const
 
virtual void intersectVolume (const VGEO_Ray &ray, HitList &hits) const
 
virtual UT_Vector3 gradient (const UT_Vector3 &pos, const UT_Filter &filter, float radius, float time, int idx) const
 
virtual float getGradientDelta () const
 Returns a local distance for use in default gradient calculations. More...
 
virtual int getNormalAttribute () const
 
virtual float getVoxelSize () const
 Returns the voxel size in the same space as 'pos' in evaluate. More...
 
virtual bool isSDF () const
 Returns true when the volume data should be interpreted as an SDF. More...
 
virtual GA_Offset getGeoPrimitive () const
 
virtual GA_Offset getGeoVertex () const
 
- Public Member Functions inherited from UT_IntrusiveRefCounter< VGEO_Volume >
SYS_FORCE_INLINE UT_IntrusiveRefCounter () noexcept
 Default constructor: Sets counter to 0. More...
 
SYS_FORCE_INLINE UT_IntrusiveRefCounter (const UT_IntrusiveRefCounter &) noexcept
 Copy constructor: Sets counter to 0. More...
 
UT_IntrusiveRefCounteroperator= (const UT_IntrusiveRefCounter &) noexcept
 Assignment operator: Does not modify counter. More...
 
SYS_FORCE_INLINE uint32 use_count () const noexcept
 Return current counter. More...
 
SYS_FORCE_INLINE bool conditionalAddRef () noexcept
 

Static Public Member Functions

static void addVoxelBoxes (const UT_VoxelArrayF &voxels, UT_Array< UT_BoundingBox > &boxes, float radius, float dbound, float zerothreshold)
 
static GU_DetailgetVoxelIsosurface (const UT_VoxelArrayF &voxels, float radius, float dbound, float zerothreshold)
 Utility method to create an isosurface from a voxel array. More...
 

Additional Inherited Members

- Protected Member Functions inherited from UT_IntrusiveRefCounter< VGEO_Volume >
SYS_FORCE_INLINE ~UT_IntrusiveRefCounter ()
 Destructor: Only derived classes can destruct this. More...
 

Detailed Description

Base class for volume primitives in mantra.

Examples:
RAY/RAY_DemoVolumeSphere.C.

Definition at line 41 of file VGEO_Volume.h.

Constructor & Destructor Documentation

VGEO_Volume::VGEO_Volume ( )
virtual VGEO_Volume::~VGEO_Volume ( )
virtual

Member Function Documentation

static void VGEO_Volume::addVoxelBoxes ( const UT_VoxelArrayF voxels,
UT_Array< UT_BoundingBox > &  boxes,
float  radius,
float  dbound,
float  zerothreshold 
)
static

Utility method to create bounding boxes for every nonzero voxel in the voxel array.

virtual void VGEO_Volume::evaluate ( const UT_Vector3 pos,
const UT_Filter filter,
float  radius,
float  time,
int  idx,
float data 
) const
pure virtual

Evaluate a volume attribute at a given position.

Parameters
posEvaluation position
filterFilter function
radiusFilter radius in voxels
timeEvaluation time (0-1)
idxAttribute index (based on getAttributeBinding())
dataStorage for evaluation data
See Also
UT_Filter

Implemented in HDK_Sample::ray_VolumeSphere.

virtual bool VGEO_Volume::evaluateInterval ( const UT_BoundingBox box,
const UT_Filter filter,
float  radius,
float  time,
int  idx,
float minval,
float maxval 
) const
inlinevirtual

Evaluate the minimum and maximum values for an attribute within a given box. If this operation is not supported, the caller will assume that the interval is unbounded.

Parameters
boxEvaluation interval
filterFilter function
radiusFilter radius in voxels
timeEvaluation time (0-1)
idxAttribute index (based on getAttributeBinding())
minvalStorage for evaluation data (minimum over box)
maxvalStorage for evaluation data (maximum over box)
See Also
UT_Filter

Definition at line 133 of file VGEO_Volume.h.

virtual void VGEO_Volume::evaluateMulti ( const UT_Vector3 pos,
const UT_Filter filter,
float  radius,
const float time,
int  idx,
float data,
int  size,
int  stride 
) const
virtual

Evaluate multiple volume attribute at given positions.

Parameters
posEvaluation positions
filterFilter function
radiusFilter radius in voxels
timeEvaluation times (0-1)
idxAttribute index (based on getAttributeBinding())
dataStorage for evaluation data
sizeNumber of positions to evaluate
strideData size for an individual evaluation, this should match the size returned by getAttributeBinding() for the given index.
See Also
UT_Filter
virtual void VGEO_Volume::getAttributeBinding ( UT_StringArray names,
UT_IntArray sizes 
) const
pure virtual

Return a list of attributes present in this volume. These attributes will be bound to surface shader variables when the volume is rendered. The "idx" passed into evaluation routines will be the array index returned by this operation.

  • sizes: number of floats in each attribute

Implemented in HDK_Sample::ray_VolumeSphere.

virtual void VGEO_Volume::getBoxes ( UT_Array< UT_BoundingBox > &  boxes,
float  radius,
float  dbound,
float  zerothreshold 
) const
pure virtual

Return a set of bounding boxes that define the structure of the volumetric data. The boxes are used to accelerate ray intersection testing with the volume and to cull empty space for micropolygon rendering. They need not be an exact representation of the volume, though more accurate boxes will lead to more efficient renders. Specifically, the union of the boxes returned by this method should fully enclose the region of the volume to be rendered. If there is volumetric data outside all boxes, the render may contain artifacts.

Boxes should be defined locally, and need to incorporate the displacement bound.

Parameters
radiusFilter radius in voxels
dboundDisplacement bound in local space
zerothresholdThreshold value under which the volume is considered empty.

Implemented in HDK_Sample::ray_VolumeSphere.

virtual GA_Offset VGEO_Volume::getGeoPrimitive ( ) const
inlinevirtual

Return the geometric primitive or vertex associated with the volume. These can be used to fill in primitive and detail attributes associated with the volume.

Definition at line 52 of file VGEO_Volume.h.

virtual GA_Offset VGEO_Volume::getGeoVertex ( ) const
inlinevirtual

Return the geometric primitive or vertex associated with the volume. These can be used to fill in primitive and detail attributes associated with the volume.

Definition at line 54 of file VGEO_Volume.h.

virtual float VGEO_Volume::getGradientDelta ( ) const
inlinevirtual

Returns a local distance for use in default gradient calculations.

Definition at line 239 of file VGEO_Volume.h.

virtual float VGEO_Volume::getNativeStepSize ( ) const
pure virtual

Return the object space step size to use when the volume quality is 1 and there is no object-level scale. For primitives based on voxel grids, this method is usually implemented by returning the voxel size.

Implemented in HDK_Sample::ray_VolumeSphere.

virtual int VGEO_Volume::getNormalAttribute ( ) const
inlinevirtual

Returns the volume attribute index to be used for normal vector calculations.

Definition at line 243 of file VGEO_Volume.h.

static GU_Detail* VGEO_Volume::getVoxelIsosurface ( const UT_VoxelArrayF voxels,
float  radius,
float  dbound,
float  zerothreshold 
)
static

Utility method to create an isosurface from a voxel array.

virtual float VGEO_Volume::getVoxelSize ( ) const
inlinevirtual

Returns the voxel size in the same space as 'pos' in evaluate.

Definition at line 246 of file VGEO_Volume.h.

virtual UT_Vector3 VGEO_Volume::gradient ( const UT_Vector3 pos,
const UT_Filter filter,
float  radius,
float  time,
int  idx 
) const
virtual

Evaluate the gradient of a volume attribute at a given position.

Parameters
posEvaluation position
filterFilter function
radiusFilter radius in voxels
timeEvaluation time (0-1)
idxAttribute index (based on getAttributeBinding())
See Also
UT_Filter

Reimplemented in HDK_Sample::ray_VolumeSphere.

virtual void VGEO_Volume::intersectIsosurface ( const VGEO_Ray ray,
const UT_Filter filter,
float  radius,
float  time,
int  idx,
float  threshold,
HitList hits 
) const
virtual

Find the intersection of a ray against the isosurface defined by a scalar field. The default implementation uses ray marching and the evaluateMulti() method to find a zero-crossing via sampling.

Parameters
rayRay for intersection testing
filterFilter function
radiusFilter radius in voxels
timeEvaluation time (0-1)
idxAttribute index (based on getAttributeBinding())
thresholdIsosurface threshold value
hitsCallback object for insertion of ray intersection results
virtual void VGEO_Volume::intersectVolume ( const VGEO_Ray ray,
HitList hits 
) const
virtual

Perform ray marching through a volume. The default implementation finds occupied intervals of the volume based on the boxes returned by getBoxes(), and inserts evenly spaced samples within these intervals.

Parameters
rayRay for intersection testing
hitsCallback object for insertion of ray intersection results
virtual bool VGEO_Volume::isSDF ( ) const
inlinevirtual

Returns true when the volume data should be interpreted as an SDF.

Definition at line 249 of file VGEO_Volume.h.


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