Rendering Overrides

 
 
 

This section describes the new rendering interface. The term pass is not used on purpose to avoid confusion with the existing Mental Ray based “render passes” system. This is not a wrapper for that system. This is instead intended to subsume the existing hardware “multi-pass” interface which is exposed in MPx3dModelView.

Main Features of the New Interface

Key Differences in the New Interface

Key Concepts and Constructs

Render Override

There is a formal notion of a rendering override. An override will override all rendering per refresh for interactive rendering or per frame output for batch rendering. An override is composed of a set of rendering operations. The key class for this is MRenderOverride.

Render Operation

An operation can be loosely thought of as being equivalent to a “pass” in the MPx3dModelView pass based system, except that they are explicitly defined. The key class for this is MRenderOperation. There can be predefined operations as well as custom user operations. The basic operation set includes:

Render Target Overrides

Render targets are now formalized. This is so that there is a managed and recognized set of resources that both the renderer and the plugin writer can use. Being formalized also means that the resource can be defined in a draw API agnostic way (e.g. for OpenGL and DirectX). The interface presented is a render target description, MRenderTargetDescription. The descriptions are used to describe desired render target inputs or outputs for rendering operations.

  • An access to the device level resource is provided so that users can write their own custom code which accesses targets.
  • It is still possible to use user defined render targets but device state must be restored or the renderer’s render target state will be corrupted. This is not a new restriction.

Shader Overrides

The MShaderManager interface allows access to some simple stock shaders as well as access to file based effects. These shaders can then be applied as overrides in one of two places:

  • As per object shader overrides for 3d scene renders.
  • As per quad render shader for quad blits.

State Overrides

State setting has been formalized and is managed by the renderer. State setting can be performed per render operation.

General Scene and User Operation Overrides

Basic overrides formally presented include:

  • Camera specification
  • World or scene filtering
  • Object type filtering
  • Draw mode filtering (e.g. filled, wire, component)
  • Access to M3dView for interactive rendering which will allow the user to use other existing overrides.
  • For batch rendering, the user also has access to hardware and common render globals.
  • As custom user operations are available, users are still free to perform their own direct drawing with the restriction that they restore the previous device level state. The same restriction currently applies for all existing hardware rendering interfaces, including MPx3dModelView overrides.

Render Logic Building

The main steps for defining a render override are:

  1. Derive a custom render override.
  2. Register the override with the renderer. Any number of overrides can be registered.
  3. Set the active override for a viewport or for batch rendering.
  4. Set up a set of render operations and overrides as an ordered list. If the render logic is a graph, then this can be broken down into a series of render operations.
  5. Provide the list of operations when queried and update parameters per operation as required.
  6. Custom operations and custom overrides have the ability to intercept intermediate and final render targets and may do so to use the resources as required (e.g. to save to disk, or to route to custom rendering code).

Key Restrictions