3ds Max C++ API Reference
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
MaxSDK::RenderTimeInstancing Namespace Reference

This API is meant to be implemented by plugins and used by renderers to instantiate objects at render-time. More...

Classes

struct  ChannelInfo
 
struct  InstanceMatIDInfo
 Material ID overrides. More...
 
struct  InstanceUVWInfo
 UVW channel override data. More...
 
struct  MotionBlurInfo
 Motion blur information struct. More...
 
class  RenderInstanceSource
 Information about a given source, to be instanced multiple times. More...
 
class  RenderInstanceTarget
 Information about a given instance of a RenderInstanceSource. More...
 
class  RenderTimeInstancingInterface
 The RenderTimeInstancingInterface allows a renderer to access an object's instancing information so that it can do efficient instancing at render-time. More...
 

Typedefs

typedef int ChannelID
 A data channel ID.
 

Enumerations

enum  DataFlags : signed int { df_none = 0 , df_mesh = 1 << 0 , df_inode = 1 << 1 , df_pluginMustDelete = 1 << 31 }
 Defines what the RenderInstanceSource::GetData() method returns and how to treat it. More...
 

Functions

RenderTimeInstancingInterfaceGetRenderTimeInstancingInterface (BaseObject *obj)
 

Detailed Description

This API is meant to be implemented by plugins and used by renderers to instantiate objects at render-time.

As an example, let's say that you write an object plugin that allows users to create a new geometric primitive called SuperTeapot. If you implemented this API in your object plugin, and if your renderer used it, you could do things like have a single SuperTeapot in your scene that's rendered as 1000 teapots, each with unique transformation matrices, materials, material IDs, UVWs, etc.

This API consists of three classes:

It's easier to understand how those classes are related by starting with the last one and moving up the list:

  • A RenderInstanceTarget is an instance of an INode or a Mesh. It stores all the information that describes an instance (e.g. its transform matrices, material override, material ID overrides, UVW overrides, etc.) except for its INode or Mesh. You will see why below.
  • A RenderInstanceSource stores an INode or a Mesh and all the RenderInstanceTargets for that particular INode or Mesh. In other words, a RenderInstanceSource is a container of RenderInstanceTargets (instances) that all share the same INode or Mesh.
  • A RenderTimeInstancingInterface is a container of RenderInstanceSources. This interface is implemented by a plugin (e.g. object, particle system, etc.) so that a renderer can access its instancing information to render it.

If you, for example, wanted to instantiate a teapot 100 times and a box 200 times in your plugin, then:

  • Your implementation of the RenderTimeInstancingInterface would contain 2 RenderInstanceSources: one for the teapot and one for the box.
  • The RenderInstanceSource of the teapot would store a pointer to the teapot's INode and 100 RenderInstanceTargets.
  • The RenderInstanceSource of the box would store a pointer to the box's INode and 200 RenderInstanceTargets.
  • Each of the 100 RenderInstanceTargets of the teapot would contain its own transform matrices, material overrides, material ID overrides, UVW overrides, etc.
  • Each of the 200 RenderInstanceTargets of the box would contain its own transform matrices, material overrides, material ID overrides, UVW overrides, etc.

For an example of how to implement this API in an object plugin, see the RenderTimeInstancedObject sample project. For an example of how to use this API in a renderer, see the description of the RenderTimeInstancingInterface class.

Typedef Documentation

◆ ChannelID

typedef int ChannelID

A data channel ID.

An opaque integer token that represents a data channel. Used to actually retrieve the channel's data.

Enumeration Type Documentation

◆ DataFlags

enum DataFlags : signed int

Defines what the RenderInstanceSource::GetData() method returns and how to treat it.

Enumerator
df_none 
df_mesh 

The RenderInstanceSource::GetData() method returns a pointer to a Mesh.

df_inode 

The RenderInstanceSource::GetData() method returns a pointer to an INode.

df_pluginMustDelete 

Set if the renderer is expected to delete the data pointer after it's done using it.

360 {
361 df_none = 0,
362 df_mesh = 1 << 0,
363 df_inode = 1 << 1,
364 df_pluginMustDelete = 1 << 31
365 };
@ df_mesh
The RenderInstanceSource::GetData() method returns a pointer to a Mesh.
Definition: RenderTimeInstancing.h:362
@ df_inode
The RenderInstanceSource::GetData() method returns a pointer to an INode.
Definition: RenderTimeInstancing.h:363
@ df_none
Definition: RenderTimeInstancing.h:361
@ df_pluginMustDelete
Set if the renderer is expected to delete the data pointer after it's done using it.
Definition: RenderTimeInstancing.h:364

Function Documentation

◆ GetRenderTimeInstancingInterface()

RenderTimeInstancingInterface * GetRenderTimeInstancingInterface ( BaseObject obj)
inline
606 {
608 }
#define RENDERTIME_INSTANCING_INTERFACE
Definition: RenderTimeInstancing.h:17
virtual CoreExport void * GetInterface(ULONG id) override
The RenderTimeInstancingInterface allows a renderer to access an object's instancing information so t...
Definition: RenderTimeInstancing.h:158