Skip to content

Renderer Plugin API

Ben Heasly edited this page Oct 19, 2013 · 4 revisions

As of version 1.1, RenderToolbox3 invokes renderers using a Renderer Plugin API. This means that any renderer can work with RenderToolbox3, as long as there's a plugin for that renderer.

Currently, RenderToolbox3 defines plugins for three renderers:

  • PBRT -- this plugin provides the same PBRT functionality that RenderToolbox3 had before version 1.1
  • Mitsuba -- this plugin provides the same Mitsuba functionality that RenderToolbox3 had before version 1.1
  • SampleRenderer -- this plugin provides no rendering functionality, but it can be used as a placeholder for a real renderer. It will print statements whenever parts of the Renderer Plugin API are invoked. It can serve as a template for writing new renderer plugins. It contains detailed documentation for how the Renderer Plugin API works.

Overview of a Plugin

A renderer plugin is really just a set of five functions. Each function name must conform to a specific pattern, which allows RenderToolbox3 to locate and invoke the function when needed. For example, the function RTB_ImportCollada_Mitsuba() is part of the Mitsuba renderer plugin. RenderToolbox3 invokes this function whenever it's time to import a Collada scene into Mitsuba's native scene file file format.

Each of the five functions in a renderer plugin deals with a specific part of the RenderToolbox3 workflow:

  • VersionInfo functions gather information about what version of a renderer is being used. This information is saved along with renderings.
  • ApplyMappings are invoked repeatedly during scene file generation. They must accept mappings data that RenderToolbox3 reads from the mappings file, and collect it in a renderer-native format.
  • ImportCollada functions are invoked at the end of scene file generation. They must combine a Collada parent scene file with mappings data that was collected by the ApplyMappings function, and produce a renderer-native scene description.
  • Render functions must accept a renderer-native scene description that was produced by the ImportCollada function, invoke a renderer, and produce a rendering.
  • DataToRadiance functions must accept a rendering produced by the Render function and convert the rendered data to units of physical radiance.

Plugin Details

Please see the code and documentation of the SampleRenderer for details about the precise syntax and behavior of Renderer Plugin API functions. The code can be found in the RenderToolbox3 source code at (path-to-RenderToolbox3)/RendererPlugins/SampleRenderer. The documentation can be found in the RenderToolbox3 function reference.

New Plugins

You can write plugins for your own renderer. Hopefully, the existing plugins for the SampleRenderer, PBRT, and Mitsuba will provide helpful templates and working examples from which you can generalize.

Each of your plugin functions must have a name that matches a specific pattern (see the function reference). Each function must also accept specific inputs and return specific outputs. That's the contract of the Renderer Plugin API.

But internally, your plugin can do anything you want.