3ds Max C++ API Reference
IRenderSessionContext Class Referenceabstract

Encapsulates all that a render session needs to render a frame. More...

#include <IRenderSessionContext.h>

Classes

class  IChangeNotifier
 Notification callback interface for IRenderSessionContext. More...
 

Public Member Functions

Scene Definition

Returns the scene container, which wraps the set of objects to be rendered.

virtual const ISceneContainerGetScene () const =0
 Returns the camera container, which abstracts the attributes of the camera to be rendered. More...
 
virtual const ICameraContainerGetCamera () const =0
 Returns the camera container, which abstracts the attributes of the camera to be rendered. More...
 
virtual IEnvironmentContainerGetEnvironment () const =0
 Returns the environment object, which encapsulates the definition of background and environment maps and colors. More...
 
virtual const IRenderSettingsContainerGetRenderSettings () const =0
 Returns the render settings container, which encapsulates the options that affect the translation and rendering processes. More...
 
Default Lighting

Default lighting is used when there are no other sources of light in the scene.

virtual bool GetDefaultLightingEnabled (const bool considerEnvironmentLighting, const TimeValue t, Interval &validity) const =0
 Helper method for determining whether default lighting should be enabled. More...
 
virtual std::vector< DefaultLightGetDefaultLights () const =0
 Returns the set of default lights to be used if there is no other source of lighting in the scene. More...
 
Process Management and Message Logging

Returns the interface used for reporting rendering/translation events and progress, as well as to executes jobs from the main thread.

virtual IRenderingProcessGetRenderingProcess () const =0
 Returns the interface used for logging messages. More...
 
virtual IRenderingLoggerGetLogger () const =0
 Returns the interface used for logging messages. More...
 
RenderBegin() / RenderEnd()

Animatable::RenderBegin() must be called on scene objects before they are translated.

virtual void CallRenderBegin (ReferenceMaker &refMaker, const TimeValue t)=0
 Calls RenderBegin() on the given object and its entire reference sub-hierarchy. More...
 
virtual void CallRenderEnd (const TimeValue t)=0
 Calls RenderEnd() on every object for which CallRenderBegin() was called. More...
 
Frame Buffer Processing
virtual IFrameBufferProcessorGetMainFrameBufferProcessor ()=0
 Returns the interface used to store data into the main frame buffer. More...
 
virtual void UpdateBitmapDisplay ()=0
 Refreshes the frame buffer window, after the frame buffer bitmap has been updated. More...
 
Node Evaluation

Provides methods to help evaluate node transforms, taking into account motion blur.

virtual MotionTransforms EvaluateMotionTransforms (INode &node, const TimeValue t, Interval &validity, const MotionBlurSettings *node_motion_blur_settings=nullptr) const =0
 Evaluates the transforms of the given node, taking motion blur into account. More...
 
virtual MotionBlurSettings GetMotionBlurSettingsForNode (INode &node, const TimeValue t, Interval &validity, const MotionBlurSettings *global_motion_blur_settings=nullptr) const =0
 Evaluates the motion blur settings associated with this node. More...
 
Miscellaneous
virtual std::vector< IRenderElement * > GetRenderElements () const =0
 Returns the set of render elements to be used by this session. More...
 
virtual std::vector< Atmospheric * > GetAtmospherics () const =0
 Returns the set of atmospherics to be used by this render session. More...
 
virtual EffectGetEffect () const =0
 Returns the top-level render effect currently being used. More...
 
virtual IRenderSessionGetRenderSession () const =0
 Returns the render session to which this context is associated. More...
 
virtual NotificationAPI::IImmediateInteractiveRenderingClientGetNotificationClient () const =0
 Returns the notification client to be used for monitoring scene changes. More...
 
virtual TranslationHelpers::INodeInstancingPool::IManagerGetNodeInstancingManager () const =0
 Returns the node instancing manager. More...
 
virtual ITranslationManagerGetTranslationManager () const =0
 Returns the translation manager. More...
 
virtual IPoint2 SetDownResolutionFactor (const unsigned int factor)=0
 Sets the down-resolution factor. More...
 
Notification

Registers a notifier callback, to be called when interactive changes occur.

virtual void RegisterChangeNotifier (IChangeNotifier &notifier) const =0
 Unregisters a notification callback, previously registered with RegisterChangeNotifier(). More...
 
virtual void UnregisterChangeNotifier (IChangeNotifier &notifier) const =0
 Unregisters a notification callback, previously registered with RegisterChangeNotifier(). More...
 

Protected Member Functions

virtual ~IRenderSessionContext ()
 Protected destructor prevents deletion through this interface. More...
 

Detailed Description

Encapsulates all that a render session needs to render a frame.

This interface encapsulates the definition of the scene which is to be rendered by a render session. It also exposes functionality related to evaluating the scene and processing the frame buffer.

Constructor & Destructor Documentation

◆ ~IRenderSessionContext()

virtual ~IRenderSessionContext ( )
inlineprotectedvirtual

Protected destructor prevents deletion through this interface.

220 {}

Member Function Documentation

◆ GetScene()

virtual const ISceneContainer& GetScene ( ) const
pure virtual

Returns the camera container, which abstracts the attributes of the camera to be rendered.

◆ GetCamera()

virtual const ICameraContainer& GetCamera ( ) const
pure virtual

Returns the camera container, which abstracts the attributes of the camera to be rendered.

◆ GetEnvironment()

virtual IEnvironmentContainer* GetEnvironment ( ) const
pure virtual

Returns the environment object, which encapsulates the definition of background and environment maps and colors.

◆ GetRenderSettings()

virtual const IRenderSettingsContainer& GetRenderSettings ( ) const
pure virtual

Returns the render settings container, which encapsulates the options that affect the translation and rendering processes.

◆ GetDefaultLightingEnabled()

virtual bool GetDefaultLightingEnabled ( const bool  considerEnvironmentLighting,
const TimeValue  t,
Interval validity 
) const
pure virtual

Helper method for determining whether default lighting should be enabled.

This method returns true if and only there are no sources of lighting in the scene (i.e. no light nodes). It may optionally consider the environment to be a source of illumination.

Parameters
considerEnvironmentLightingSet to true to consider a non-black environment to be a source of light.
tThe TimeValue at which to determine whether lighting should be enabled.
validity[in, out] The validity of the returned value is intersected into the input value of this parameter.
Returns
True if and only if default lights should be enabled.

◆ GetDefaultLights()

virtual std::vector<DefaultLight> GetDefaultLights ( ) const
pure virtual

Returns the set of default lights to be used if there is no other source of lighting in the scene.

Remarks
It is up to the renderer integration to decide whether to use the default lights or not, as each renderer may have its own set of criteria. For example, some (but not all) renderers consider an environment map to be a source of lighting.

◆ GetRenderingProcess()

virtual IRenderingProcess& GetRenderingProcess ( ) const
pure virtual

Returns the interface used for logging messages.

◆ GetLogger()

virtual IRenderingLogger& GetLogger ( ) const
pure virtual

Returns the interface used for logging messages.

◆ CallRenderBegin()

virtual void CallRenderBegin ( ReferenceMaker refMaker,
const TimeValue  t 
)
pure virtual

Calls RenderBegin() on the given object and its entire reference sub-hierarchy.

It's important to call this method on any Animatable before it's accessed for translation or rendering. The standard set of objects on which RenderBegin() should be called includes:

  • scene nodes (geometric, light, helper)
  • render elements
  • atmospherics
  • render effects
  • environment
Remarks
This method keeps track of all objects for which it has called RenderBegin(), and will never call it more than once for a given object.
Parameters
refMakerThe object on which to call RenderBegin().
tThe time at which the scene is being translated / rendered. If rendering multiple frames, this is the time of the first frame.

◆ CallRenderEnd()

virtual void CallRenderEnd ( const TimeValue  t)
pure virtual

Calls RenderEnd() on every object for which CallRenderBegin() was called.

This is called automatically by the system under the following conditions:

If needed - generally, if not using ITranslationManager for interactive rendering - the renderer may call this explicitly.

Parameters
tThe time at which the scene has been last translated / rendered. If rendering multiple frames, this is the time of the last frame.

◆ GetMainFrameBufferProcessor()

virtual IFrameBufferProcessor& GetMainFrameBufferProcessor ( )
pure virtual

Returns the interface used to store data into the main frame buffer.

This interface provides functionality for efficiently transferring the renderer's own frame buffer into the 3ds Max frame buffer, optionally process the active ToneOperator.

Remarks
This method thread safe; it may be called from any thread. Doing so enables the ToneOperator to be processed in that thread, which avoids blocking the main thread. Interactive renderers should thus call this from their separate update thread.
The render Bitmap should not be modified or accessed in parallel to this call.

◆ UpdateBitmapDisplay()

virtual void UpdateBitmapDisplay ( )
pure virtual

Refreshes the frame buffer window, after the frame buffer bitmap has been updated.

This method abstracts the different mechanism for updating the bitmap of an offline or interactive renderer.

Remarks
This method thread safe: it may be called from any thread.
The render Bitmap should not be modified or accessed in parallel to this call.

◆ EvaluateMotionTransforms()

virtual MotionTransforms EvaluateMotionTransforms ( INode node,
const TimeValue  t,
Interval validity,
const MotionBlurSettings node_motion_blur_settings = nullptr 
) const
pure virtual

Evaluates the transforms of the given node, taking motion blur into account.

Remarks
To evaluate a node's transform without taking motion blur into account, pass custom motion blur settings that explicitly disable motion blur.
Parameters
nodeThe node for which to evaluate the transforms.
tThe time at which to evaluate the node.
[in,out]validityThe validity of the evaluated transforms is intersected into this. The validity of both transforms is taken into account correctly.
node_motion_blur_settingsOptional, custom motion blur settings to be used when evaluating the node transforms. If null, the settings are obtained by calling GetMotionBlurSettingsForNode().
Returns
The motion transforms, as evaluated for the provided node.

◆ GetMotionBlurSettingsForNode()

virtual MotionBlurSettings GetMotionBlurSettingsForNode ( INode node,
const TimeValue  t,
Interval validity,
const MotionBlurSettings global_motion_blur_settings = nullptr 
) const
pure virtual

Evaluates the motion blur settings associated with this node.

This method takes the global motion blur settings as input, modifies them according to the node's object properties, and returns the result. If, for example, the node's object properties disable motion blur, then motion blur will be disabled in the node's settings.

Parameters
nodeThe node for which the motion blur settings are to be evaluated.
tThe time at which to evaluate the motion blur settings.
validity[in, out] The validity of the evaluated settings is intersected into this.
global_motion_blur_settingsOptional, global motion blur settings which are to be modified by the node's properties. If null, the global settings are obtained from ICameraContainer.
Returns
The motion blur settings to be used for the given node.
See also
UnifiedRenderer::MotionBlurIgnoresNodeProperties()

◆ GetRenderElements()

virtual std::vector<IRenderElement*> GetRenderElements ( ) const
pure virtual

Returns the set of render elements to be used by this session.

Remarks
This method only returns those elements that are enabled; the caller therefore does not need to check for IRenderElementMgr::GetElementsActive() or IRenderElement::IsEnabled().
The system calls RenderBegin() on all render elements before translation begins.

◆ GetAtmospherics()

virtual std::vector<Atmospheric*> GetAtmospherics ( ) const
pure virtual

Returns the set of atmospherics to be used by this render session.

Remarks
The system calls RenderBegin() on all atmospherics before translation begins.

◆ GetEffect()

virtual Effect* GetEffect ( ) const
pure virtual

Returns the top-level render effect currently being used.

In most cases this can be cast to a IRenderEffectsMgr, which wraps and manages the actual collection of render effects to be used.

Remarks
The system calls RenderBegin() on all effects before translation begins.

◆ GetRenderSession()

virtual IRenderSession* GetRenderSession ( ) const
pure virtual

Returns the render session to which this context is associated.

◆ GetNotificationClient()

virtual NotificationAPI::IImmediateInteractiveRenderingClient* GetNotificationClient ( ) const
pure virtual

Returns the notification client to be used for monitoring scene changes.

Remarks
Will return null if scene changes need not be monitored, for example when performing offline (non-interactive) rendering.

◆ GetNodeInstancingManager()

virtual TranslationHelpers::INodeInstancingPool::IManager& GetNodeInstancingManager ( ) const
pure virtual

Returns the node instancing manager.

The node instancing manager is used for collecting those nodes which are all instances of the same geometric object. The complex logic, required to handle instancing correctly, is fully encapsulated by this interface.

◆ GetTranslationManager()

virtual ITranslationManager& GetTranslationManager ( ) const
pure virtual

Returns the translation manager.

The translation manager is an optional component which may be used to manage the scene translation graph.

◆ SetDownResolutionFactor()

virtual IPoint2 SetDownResolutionFactor ( const unsigned int  factor)
pure virtual

Sets the down-resolution factor.

The renderer plugin may decide that it wishes to lower the resolution at which the scene is rendered, e.g. to improve the performance of interactive renders in an adaptive manner. This method will set the factor at which the resolution is lowered, ensuring that all related scene properties are correctly affected - including the resolution, render region, image plane offset, etc.

Remarks
This method is thread safe and may thus be called from the interactive rendering thread.
This method will trigger change notifications as necessary. For example, the camera will broadcast notifications if its resolution changes.
Parameters
factorThe factor by which the resolution is to be reduced. The internal default is 1, meaning that the resolution is not reduced. A value of 0 is not valid. A value greater than the resolution will be clamped.
Returns
The full render resolution, unaffected by the down-res factor.

◆ RegisterChangeNotifier()

virtual void RegisterChangeNotifier ( IChangeNotifier notifier) const
pure virtual

Unregisters a notification callback, previously registered with RegisterChangeNotifier().

◆ UnregisterChangeNotifier()

virtual void UnregisterChangeNotifier ( IChangeNotifier notifier) const
pure virtual

Unregisters a notification callback, previously registered with RegisterChangeNotifier().