In order to allow 3ds Max to redraw the viewports as quickly as possible, an option is provided in the 3ds Max user interface to allow the user to use dual planes. If dual plane mode is enabled, there is an extra buffer in memory that holds what is referred to as The Background. The background contains an entire image buffer and Z buffer (if Z buffering is turned on). Consider the following example to understand how the background buffer is used to speed up screen redraws:
Say there is a scene with two items: a small sphere that the user is interactively moving around, and a 500,000 polygon model that is not changing at all -- simply a static model. The large model could be rendered once into the background plane. The sphere that is changing is flagged as being in the foreground. The next time 3ds Max needs to redraw the screen, instead of re-rendering both models, it can copy the background image (which has the large model already rendered) into the actual image buffer and only render those nodes that are flagged as being in the foreground (the moving sphere) on top of this background image. This provides the same visual result as rendering both models but is much quicker.
The key to making this system work is to figure out what items need to be in the foreground and what items may be put in the background. The system does this in almost all cases (the plug-in developer does not normally need to worry about this). If the user is moving a selected item in the scene, then the selected items (and all their dependents) go in the foreground. All other items may go in the background. For example, if the user selects a parent node to move, the children nodes must have to go in the foreground as well since they will move along with the parent. However everything else may go to the background. When the user plays back an animation any items that are animated go into the foreground and non-animated items may go in the background. When the user is in the Modify branch, any items that are dependent on the item being edited are put in the foreground, the others go into the background. Also, when a camera is being moved, all objects in the camera's viewport are tagged as being in the foreground, since they all must be redrawn.
For specialized plugins, APIs are provided to allow the plug-in to control which nodes are put in the foreground when these plugins have created their own command mode. There is a method of the CommandMode class named CommandMode::ChangeFGProc() that can be used to specify a custom callback to process nodes that should be placed in the foreground. For example, if a utility plug-in needs to specify an additional set of nodes to go into the foreground plane along with the one it is currently working on, it could derive a class from ChangeForegroundCallback and implement the callback() method. In this method it could flag any nodes required (using a method of INode named INode::FlagForeground()). In almost all cases, however, plugins that use a custom command mode can simply specify one of the two predefined values in their implementation of ChangeFGProc(). These are CHANGE_FG_SELECTED and CHANGE_FG_ANIMATED. See the CommandMode class documentation for more details.
As a final note, if the user has turned off the Use Dual Plane toggle, there is still a notion of foreground/background objects -- only with dual planes off, some background objects end up being rendered. 3ds Max uses a simple bounding box check: If a background object's bounding box intersects the foreground object's bounding box (at either the old or new position), then that background object is re-rendered. Otherwise, it isn't redrawn.
To see this dramatically, consider the example presented above: a small sphere and a large 500K polygon object. If the object is off to the right of the viewport, and the sphere is to the left (all by itself) then the sphere can be moved very quickly. But once it gets near enough to the large object that the bounding boxes intersect, interactivity drops dramatically because the large object must now be redrawn.