Class IMultiPassCameraEffect
See Also: Class ReferenceTarget, Class CameraObject.
class IMultiPassCameraEffect : public ReferenceTarget
Description:
This class is available in release 4.0 and later only.
The multipass camera effect allows modification of viewpoints & view directions or time for each pass of a multipass rendering. Algorithms such as Depth of Field, Scene motion blur can be implemented using multipass techniques.
Basically, a multipass camera effect is a plug-in to camera objects. It allows the renderer to query the camera for the view params for each pass of the rendering, & provides a dithered combining function to combine the bitmaps produced by each pass into the final bitmap. It also allows time to be manipulated for each rendering pass, providing effects such as motion blur.
Methods:
public:
Prototype:
virtual bool IsCompatible(CameraObject *pCameraObject) = 0;
Remarks:
Some cameras are not compatible with some render effects, this method allows cameras to list compatible effects in the UI and as such allows the effect to declare its compatibility with the current camera object.
Parameters:
CameraObject *pCameraObject
A pointer to a camera object.
Return Value:
TRUE if compatible, otherwise FALSE.
Prototype:
virtual bool DisplayPasses(TimeValue renderTime) = 0;
Remarks:
There is a UI option on multipass effects that indicates whether the renderer should display each pass as it is rendered. Note this is not used by viewport renderer, because of the hardware involvement. This method returns whether to display individual passes as they are computed.
Parameters:
TimeValue renderTime
The rendertime at which to check the display passes.
Return Value:
TRUE if display is on, otherwise FALSE.
Prototype:
virtual int TotalPasses(TimeValue renderTime) = 0;
Remarks:
The multipass effect also has a variable number of passes. This method tells the renderer how many passes to render per final output frame and as such returns the total number of passes to be rendered
Parameters:
TimeValue renderTime
The rendertime at which to check the display passes.
Prototype:
virtual ViewParams *Apply(INode *pCameraNode, CameraObject *pCameraObject, int passNum, TimeValue &overrideRenderTime) = 0;
Remarks:
This method will modify the camera, camera node, or time value to affect each pass.
This is the modify function called for each pass of the frame. The effect can alter the camera node, camera object, or override the render time in the course of this call. 3ds max renderers take an optional parameter viewParams* that when not NULL overrides the normal rendering camera. When this is called the override render time will be set to the current frame time. If the value is changed, this will be the time value used for the pass. Note that at the time that apply is called, the renderer has not yet been called, hence it is possible, with care, to alter the scene in a general way, not just the camera & time parameters. Apply should return NULL if the normal unmodified camera is to be used.
Parameters:
INode *pCameraNode
A pointer to the node of the camera.
CameraObject *pCameraObject
A pointer to the camera object.
int passNum
The number of the pass.
TimeValue &overrideRenderTime
The time if you wish to override the render time.
Return Value:
The viewparams returned by apply which are supplied to the renderer.
Prototype:
virtual void AccumulateBitmap(Bitmap *pDest, Bitmap *pSrc, int passNum, TimeValue renderTime) = 0;
Remarks:
This method will blend each pass (src) into the final accumulator (dest).
After each pass is rendered, it needs to be combined into the final output bitmap. The current multipass effects use a dithered combiner, so that hard edges from the passes are more smoothly blended. There are many ways to do this, with varying quality, so this method allows different future implementations. Note that this is not used by the viewport renderer, as there’s no way to tell the hardware to do this. Hardware is for fast & edgy, software is for slow & smooth.
Parameters:
Bitmap *pDest
The destination bitmap.
Bitmap *pSrc
The source bitmap.
int passNum
The number of the pass.
TimeValue renderTime
The render time.
Prototype:
virtual void PostRenderFrame() = 0;
Remarks:
This method is called after all passes have been rendered.
After all passes have been rendered & accumulated, this method will be called so that the effect can do any final cleanup. Currently unused, it can be ignored by multipass effects if they wish.
Prototype:
virtual RefResult NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message);
Remarks:
This method is implemented to receive and respond to messages broadcast by all the dependants in the entire system.
Parameters:
Interval changeInt
This is the interval of time over which the message is active.
RefTargetHandle hTarget
This is the handle of the reference target the message was sent by. The reference maker uses this handle to know specifically which reference target sent the message.
PartID& partID
This contains information specific to the message passed in. Some messages don't use the partID at all. See the section List of Reference Messages for more information about the meaning of the partID for some common messages.
RefMessage message
The msg parameters passed into this method is the specific message which needs to be handled. See List of Reference Messages.
Return Value:
The return value from this method is of type RefResult. This is usually REF_SUCCEED indicating the message was processed. Sometimes, the return value may be REF_STOP. This return value is used to stop the message from being propagated to the dependents of the item.
Default Implementation:
{ return REF_SUCCEED; }
Prototype:
virtual SClass_ID SuperClassID();
Remarks:
This method returns the super class ID of the creator of the clip object.
Default Implementation:
{ return MPASS_CAM_EFFECT_CLASS_ID; }