Share

The Unified Renderer

The Unified Renderer is the entry point to the renderer plugin. It is attached to and lives in the 3ds Max scene.

Unified Renderer

The Unified Renderer, implemented as class UnifiedRenderer, serves as the base class for a renderer plugin. It replaces classes Renderer and IInteractiveRenderer from the legacy API, and also integrates functionality from various extension classes. Its responsibilities are:

  • It is the entry point for the renderer plugin, meaning that:
  • It encapsulates the render settings (ideally through parameter blocks).
  • It manages the UI for the render settings.
  • It manages file I/O for the render settings (usually automatically through parameter blocks).
  • It manages maxscript exposure of the render settings (usually automatically through parameter blocks).
  • It publishes its set of capabilities, e.g. which material plugins are compatible with the renderer.
  • It manages the creation and destruction of render session (both offline and interactive).
  • It aggregated and abstracts the contents of the scene to be rendered, re-purposing the data normally passed to Renderer::Open() and Renderer::Render().
  • It manages the contents of the Render Session Context (to be presented in a following section), which encapsulates all communication between the render session and the system.

Implementing a Renderer Plugin

The plugin developer would start by creating a class that derives from UnifiedRenderer. All important methods have been made pure virtual in UnifiedRenderer, including core methods inherited from Animatable, ReferenceMaker, etc. The most important methods, defined by class UnifiedRenderer, which the plugin developer must implement, are:

virtual std::unique_ptr<IOfflineRenderSession> CreateOfflineSession(
    IRenderSessionContext& sessionContext) = 0;
virtual std::unique_ptr<IInteractiveRenderSession> CreateInteractiveSession(
    IRenderSessionContext& sessionContext) = 0;

These govern the creation of the offline and interactive render sessions, with which the actual rendering work is performed. The destruction of a render session is managed through the unique_ptr returned by these methods. The other important parts of the functionality (render settings, UI, file I/O, etc.) all use the standard mechanisms - generally the parameter block system.

Class Descriptor

Class UnifiedRenderer::ClassDescriptor is the base class from which the class descriptor of a UnifiedRenderer plugin must derive. Internally, it implements functionality related to filtering of compatible material and texture plugins.

Was this information helpful?