VTK  9.7.20261123
vtkWebGPUVolumeRayCastCoordinator Class Reference

#include <vtkWebGPUVolumeRayCastCoordinator.h>

Detailed Description

Ray casts every WebGPU volume in a renderer in one pass.

Volume rendering only composites correctly when the volumes that share a ray are sampled together. Handing each vtkVolume to its own mapper and letting each mapper draw in turn cannot do that: every mapper would composite a finished image over the previous one, which is wrong wherever two volumes occupy the same space and is order dependent everywhere else.

This class is where the volumes of a renderer are brought back together. Each vtkWebGPUVolumeRayCastMapper prepares its own inputs, uploading textures and tabulating transfer functions, and then offers them to the coordinator of the renderer it is drawing into. Once the opaque geometry has been rasterized, the coordinator marches one set of rays through everything it was offered and composites the result over the frame a single time.

Nothing has to be assembled by hand for this to happen. Adding several vtkVolume props to a renderer is enough, whether they overlap or not, and whether they came from one mapper with several inputs or from a mapper each. A vtkMultiVolume still works but is no longer needed.

There is one coordinator per renderer, created on demand and released with the renderer.

See also
vtkWebGPUVolumeRayCastMapper
Examples:
vtkWebGPUVolumeRayCastCoordinator (Examples)
Tests:
vtkWebGPUVolumeRayCastCoordinator (Tests)

Definition at line 49 of file vtkWebGPUVolumeRayCastCoordinator.h.

Inheritance diagram for vtkWebGPUVolumeRayCastCoordinator:
[legend]
Collaboration diagram for vtkWebGPUVolumeRayCastCoordinator:
[legend]

Classes

class  vtkInternals

Public Types

typedef vtkObject Superclass

Public Member Functions

virtual vtkTypeBool IsA (const char *type)
 Return 1 if this class is the same type of (or a subclass of) the named class.
vtkWebGPUVolumeRayCastCoordinator * NewInstance () const
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses.
virtual int GetNumberOfVolumes ()
 How many inputs were gathered for the frame being drawn.
virtual bool GetComplete ()
 Whether the bricks the last frame asked for were all resident.
vtkInternals * GetInternals ()
virtual void SetPoolBrickSize (int)
 Edge length, in voxels, of the bricks every volume of this renderer is cut into.
virtual int GetPoolBrickSize ()
 Edge length, in voxels, of the bricks every volume of this renderer is cut into.
virtual void SetBrickPoolSizeMB (int)
 How much device memory the shared brick pool may take, in megabytes, and how many bricks may be brought in per frame.
virtual int GetBrickPoolSizeMB ()
 How much device memory the shared brick pool may take, in megabytes, and how many bricks may be brought in per frame.
virtual void SetMaximumBricksPerFrame (int)
 How much device memory the shared brick pool may take, in megabytes, and how many bricks may be brought in per frame.
virtual int GetMaximumBricksPerFrame ()
 How much device memory the shared brick pool may take, in megabytes, and how many bricks may be brought in per frame.
void Render (vtkRenderer *renderer)
 Called by vtkWebGPUVolumeRayCastMapper as it moves through the stages of a frame.
void ReleaseGraphicsResources (vtkWebGPUVolumeRayCastMapper *mapper)
 Called by vtkWebGPUVolumeRayCastMapper as it moves through the stages of a frame.
bool GetImageColor (vtkImageData *output)
 Copy what the last render to image produced into output.
bool GetImageDepth (int scalarType, vtkImageData *output)
 Copy what the last render to image produced into output.
Public Member Functions inherited from vtkObject
 vtkBaseTypeMacro (vtkObject, vtkObjectBase)
virtual void DebugOn ()
 Turn debugging output on.
virtual void DebugOff ()
 Turn debugging output off.
bool GetDebug ()
 Get the value of the debug flag.
void SetDebug (bool debugFlag)
 Set the value of the debug flag.
virtual void Modified ()
 Update the modification time for this object.
virtual vtkMTimeType GetMTime ()
 Return this object's modified time.
void RemoveObserver (unsigned long tag)
void RemoveObservers (unsigned long event)
void RemoveObservers (const char *event)
void RemoveAllObservers ()
vtkTypeBool HasObserver (unsigned long event)
vtkTypeBool HasObserver (const char *event)
vtkTypeBool InvokeEvent (unsigned long event)
vtkTypeBool InvokeEvent (const char *event)
std::string GetObjectDescription () const override
 The object description printed in messages and PrintSelf output.
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
vtkCommand * GetCommand (unsigned long tag)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
void RemoveObserver (vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
void RemoveObservers (unsigned long event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
void RemoveObservers (const char *event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
vtkTypeBool HasObserver (unsigned long event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
vtkTypeBool HasObserver (const char *event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
template<class U, class T>
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 Overloads to AddObserver that allow developers to add class member functions as callbacks for events.
template<class U, class T>
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 Overloads to AddObserver that allow developers to add class member functions as callbacks for events.
template<class U, class T>
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 Allow user to set the AbortFlagOn() with the return value of the callback method.
vtkTypeBool InvokeEvent (unsigned long event, void *callData)
 This method invokes an event and return whether the event was aborted or not.
vtkTypeBool InvokeEvent (const char *event, void *callData)
 This method invokes an event and return whether the event was aborted or not.
virtual void SetObjectName (const std::string &objectName)
 Set/get the name of this object for reporting purposes.
virtual std::string GetObjectName () const
 Set/get the name of this object for reporting purposes.
Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 Return the class name as a string.
virtual vtkIdType GetNumberOfGenerationsFromBase (const char *name)
 Given the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class).
virtual void Delete ()
 Delete a VTK object.
virtual void FastDelete ()
 Delete a reference to this object.
void InitializeObjectBase ()
void Print (ostream &os)
 Print an object to an ostream.
void Register (vtkObjectBase *o)
 Increase the reference count (mark as used by another object).
virtual void UnRegister (vtkObjectBase *o)
 Decrease the reference count (release by another object).
int GetReferenceCount ()
 Return the current reference count of this object.
void SetReferenceCount (int)
 Sets the reference count.
bool GetIsInMemkind () const
 A local state flag that remembers whether this object lives in the normal or extended memory space.
virtual void PrintHeader (ostream &os, vtkIndent indent)
 Methods invoked by print to print information about the object including superclasses.
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 Methods invoked by print to print information about the object including superclasses.
virtual bool UsesGarbageCollector () const
 Indicate whether the class uses vtkGarbageCollector or not.

Static Public Member Functions

static vtkWebGPUVolumeRayCastCoordinator * New ()
static vtkTypeBool IsTypeOf (const char *type)
static vtkWebGPUVolumeRayCastCoordinator * SafeDownCast (vtkObjectBase *o)
static vtkWebGPUVolumeRayCastCoordinator * GetForRenderer (vtkRenderer *renderer)
 The coordinator of renderer, created the first time it is asked for and released when the renderer goes away.
static void ReleaseAll ()
 Forget the coordinators of every renderer.
Static Public Member Functions inherited from vtkObject
static vtkObject * New ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
static void BreakOnError ()
 This method is called when vtkErrorMacro executes.
static void SetGlobalWarningDisplay (vtkTypeBool val)
 This is a global flag that controls whether any debug, warning or error messages are displayed.
static void GlobalWarningDisplayOn ()
 This is a global flag that controls whether any debug, warning or error messages are displayed.
static void GlobalWarningDisplayOff ()
 This is a global flag that controls whether any debug, warning or error messages are displayed.
static vtkTypeBool GetGlobalWarningDisplay ()
 This is a global flag that controls whether any debug, warning or error messages are displayed.
Static Public Member Functions inherited from vtkObjectBase
static vtkTypeBool IsTypeOf (const char *name)
 Return 1 if this class type is the same type of (or a subclass of) the named class.
static vtkIdType GetNumberOfGenerationsFromBaseType (const char *name)
 Given a the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class).
static vtkObjectBase * New ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
static void SetMemkindDirectory (const char *directoryname)
 The name of a directory, ideally mounted -o dax, to memory map an extended memory space within.
static bool GetUsingMemkind ()
 A global state flag that controls whether vtkObjects are constructed in the usual way (the default) or within the extended memory space.

Static Public Attributes

static constexpr int MaximumNumberOfVolumes = 12
 The largest number of inputs that can share a pass.

Protected Member Functions

virtual vtkObjectBase * NewInstanceInternal () const
 vtkWebGPUVolumeRayCastCoordinator ()
 ~vtkWebGPUVolumeRayCastCoordinator () override
Protected Member Functions inherited from vtkObject
 vtkObject ()
 ~vtkObject () override
void RegisterInternal (vtkObjectBase *, vtkTypeBool check) override
void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) override
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
 These methods allow a command to exclusively grab all events.
void InternalReleaseFocus ()
 These methods allow a command to exclusively grab all events.
Protected Member Functions inherited from vtkObjectBase
 vtkObjectBase ()
virtual ~vtkObjectBase ()
virtual void ReportReferences (vtkGarbageCollector *)
 vtkObjectBase (const vtkObjectBase &)
void operator= (const vtkObjectBase &)

Protected Attributes

int NumberOfVolumes = 0
int PoolBrickSize = 32
int BrickPoolSizeMB = 512
int MaximumBricksPerFrame = 16384
bool Complete = true
Protected Attributes inherited from vtkObject
bool Debug
vtkTimeStamp MTime
vtkSubjectHelper * SubjectHelper
std::string ObjectName
Protected Attributes inherited from vtkObjectBase
std::atomic< int32_t > ReferenceCount
vtkWeakPointerBase ** WeakPointers

Additional Inherited Members

Static Protected Member Functions inherited from vtkObjectBase
static vtkMallocingFunction GetCurrentMallocFunction ()
static vtkReallocingFunction GetCurrentReallocFunction ()
static vtkFreeingFunction GetCurrentFreeFunction ()
static vtkFreeingFunction GetAlternateFreeFunction ()

Member Typedef Documentation

◆ Superclass

Constructor & Destructor Documentation

◆ vtkWebGPUVolumeRayCastCoordinator()

vtkWebGPUVolumeRayCastCoordinator::vtkWebGPUVolumeRayCastCoordinator ( )
protected

◆ ~vtkWebGPUVolumeRayCastCoordinator()

vtkWebGPUVolumeRayCastCoordinator::~vtkWebGPUVolumeRayCastCoordinator ( )
overrideprotected

Member Function Documentation

◆ New()

vtkWebGPUVolumeRayCastCoordinator * vtkWebGPUVolumeRayCastCoordinator::New ( )
static

◆ IsTypeOf()

vtkTypeBool vtkWebGPUVolumeRayCastCoordinator::IsTypeOf ( const char * type)
static

◆ IsA()

virtual vtkTypeBool vtkWebGPUVolumeRayCastCoordinator::IsA ( const char * name)
virtual

Return 1 if this class is the same type of (or a subclass of) the named class.

Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkObjectBase.

◆ SafeDownCast()

vtkWebGPUVolumeRayCastCoordinator * vtkWebGPUVolumeRayCastCoordinator::SafeDownCast ( vtkObjectBase * o)
static

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkWebGPUVolumeRayCastCoordinator::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkWebGPUVolumeRayCastCoordinator * vtkWebGPUVolumeRayCastCoordinator::NewInstance ( ) const

◆ PrintSelf()

void vtkWebGPUVolumeRayCastCoordinator::PrintSelf ( ostream & os,
vtkIndent indent )
overridevirtual

Methods invoked by print to print information about the object including superclasses.

Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkObject.

◆ GetForRenderer()

vtkWebGPUVolumeRayCastCoordinator * vtkWebGPUVolumeRayCastCoordinator::GetForRenderer ( vtkRenderer * renderer)
static

The coordinator of renderer, created the first time it is asked for and released when the renderer goes away.

Returns nullptr for a renderer that is not a vtkWebGPURenderer.

◆ ReleaseAll()

void vtkWebGPUVolumeRayCastCoordinator::ReleaseAll ( )
static

Forget the coordinators of every renderer.

Only useful when tearing down.

◆ GetNumberOfVolumes()

virtual int vtkWebGPUVolumeRayCastCoordinator::GetNumberOfVolumes ( )
virtual

How many inputs were gathered for the frame being drawn.

◆ SetPoolBrickSize()

virtual void vtkWebGPUVolumeRayCastCoordinator::SetPoolBrickSize ( int )
virtual

Edge length, in voxels, of the bricks every volume of this renderer is cut into.

Bricks are the unit of residency: what the pool holds, what it evicts and what it fetches. Larger ones spend less on each brick's one voxel apron, smaller ones stream more finely.

This is not the granularity at which empty space is found, which is the mapper's BrickSize.

◆ GetPoolBrickSize()

virtual int vtkWebGPUVolumeRayCastCoordinator::GetPoolBrickSize ( )
virtual

Edge length, in voxels, of the bricks every volume of this renderer is cut into.

Bricks are the unit of residency: what the pool holds, what it evicts and what it fetches. Larger ones spend less on each brick's one voxel apron, smaller ones stream more finely.

This is not the granularity at which empty space is found, which is the mapper's BrickSize.

◆ SetBrickPoolSizeMB()

virtual void vtkWebGPUVolumeRayCastCoordinator::SetBrickPoolSizeMB ( int )
virtual

How much device memory the shared brick pool may take, in megabytes, and how many bricks may be brought in per frame.

Volumes larger than the pool still draw: the bricks the rays reach first are kept and the rest arrive over the frames that follow.

The default is high enough that a volume which fits is complete in one frame. Lower it to spread the cost of a volume read from disk rather than stalling on any one frame.

◆ GetBrickPoolSizeMB()

virtual int vtkWebGPUVolumeRayCastCoordinator::GetBrickPoolSizeMB ( )
virtual

How much device memory the shared brick pool may take, in megabytes, and how many bricks may be brought in per frame.

Volumes larger than the pool still draw: the bricks the rays reach first are kept and the rest arrive over the frames that follow.

The default is high enough that a volume which fits is complete in one frame. Lower it to spread the cost of a volume read from disk rather than stalling on any one frame.

◆ SetMaximumBricksPerFrame()

virtual void vtkWebGPUVolumeRayCastCoordinator::SetMaximumBricksPerFrame ( int )
virtual

How much device memory the shared brick pool may take, in megabytes, and how many bricks may be brought in per frame.

Volumes larger than the pool still draw: the bricks the rays reach first are kept and the rest arrive over the frames that follow.

The default is high enough that a volume which fits is complete in one frame. Lower it to spread the cost of a volume read from disk rather than stalling on any one frame.

◆ GetMaximumBricksPerFrame()

virtual int vtkWebGPUVolumeRayCastCoordinator::GetMaximumBricksPerFrame ( )
virtual

How much device memory the shared brick pool may take, in megabytes, and how many bricks may be brought in per frame.

Volumes larger than the pool still draw: the bricks the rays reach first are kept and the rest arrive over the frames that follow.

The default is high enough that a volume which fits is complete in one frame. Lower it to spread the cost of a volume read from disk rather than stalling on any one frame.

◆ GetComplete()

virtual bool vtkWebGPUVolumeRayCastCoordinator::GetComplete ( )
virtual

Whether the bricks the last frame asked for were all resident.

False means the pool is too small, or that bricks are still arriving, and that the next frame will look better.

◆ Render()

void vtkWebGPUVolumeRayCastCoordinator::Render ( vtkRenderer * renderer)

Called by vtkWebGPUVolumeRayCastMapper as it moves through the stages of a frame.

Not meant to be called from anywhere else.

◆ ReleaseGraphicsResources()

void vtkWebGPUVolumeRayCastCoordinator::ReleaseGraphicsResources ( vtkWebGPUVolumeRayCastMapper * mapper)

Called by vtkWebGPUVolumeRayCastMapper as it moves through the stages of a frame.

Not meant to be called from anywhere else.

◆ GetImageColor()

bool vtkWebGPUVolumeRayCastCoordinator::GetImageColor ( vtkImageData * output)

Copy what the last render to image produced into output.

The colour is RGBA bytes and the depth is one component of scalarType, holding the window space depth of the first sample the ray found visible. Return false when the pass has not been drawn in that mode.

◆ GetImageDepth()

bool vtkWebGPUVolumeRayCastCoordinator::GetImageDepth ( int scalarType,
vtkImageData * output )

Copy what the last render to image produced into output.

The colour is RGBA bytes and the depth is one component of scalarType, holding the window space depth of the first sample the ray found visible. Return false when the pass has not been drawn in that mode.

◆ GetInternals()

vtkInternals * vtkWebGPUVolumeRayCastCoordinator::GetInternals ( )
inline

Definition at line 134 of file vtkWebGPUVolumeRayCastCoordinator.h.

Member Data Documentation

◆ MaximumNumberOfVolumes

int vtkWebGPUVolumeRayCastCoordinator::MaximumNumberOfVolumes = 12
staticconstexpr

The largest number of inputs that can share a pass.

Anything beyond this is dropped with a warning; the limit is on how many volumes one uniform buffer describes, not on how much data they hold - the bricks of every volume share one pool.

Definition at line 77 of file vtkWebGPUVolumeRayCastCoordinator.h.

◆ NumberOfVolumes

int vtkWebGPUVolumeRayCastCoordinator::NumberOfVolumes = 0
protected

Definition at line 141 of file vtkWebGPUVolumeRayCastCoordinator.h.

◆ PoolBrickSize

int vtkWebGPUVolumeRayCastCoordinator::PoolBrickSize = 32
protected

Definition at line 142 of file vtkWebGPUVolumeRayCastCoordinator.h.

◆ BrickPoolSizeMB

int vtkWebGPUVolumeRayCastCoordinator::BrickPoolSizeMB = 512
protected

Definition at line 143 of file vtkWebGPUVolumeRayCastCoordinator.h.

◆ MaximumBricksPerFrame

int vtkWebGPUVolumeRayCastCoordinator::MaximumBricksPerFrame = 16384
protected

Definition at line 144 of file vtkWebGPUVolumeRayCastCoordinator.h.

◆ Complete

bool vtkWebGPUVolumeRayCastCoordinator::Complete = true
protected

Definition at line 145 of file vtkWebGPUVolumeRayCastCoordinator.h.


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