Radeon ProRender

Basics of Using the Radeon ProRender SDK

RPR Object Types

The various Radeon ProRender object types are listed here. In general, every usage of Radeon ProRender will have as a minimum:

  • rpr_context ― the context controls the following: which hardware devices to use; other global options; and starting a render.
  • rpr_scene ― contains all the things that go into the rendered image, such as mesh geometry, lights, cameras, etc. Note that you can have multiple scenes, but only one can be active per context for rendering at any time.
  • rpr_camera ― a camera from which the image will be created. Cameras are attached to scene(s).
  • rpr_shape ― mesh geometry, needs to be attached to a scene.
  • rpr_light ― lights of various types.
  • rpr_framebuffer ― an image framebuffer to which to render with the context.

Working with RPR Objects

Radeon ProRender is a standard C-style API. This means that the code using the API should manage objects when both creating pointers in memory for the objects and when deleting these pointers. The various data types are listed here. Creating, inspecting, manipulating, and deleting the objects can all be done by passing the pointer for an object to calls in the API.

Some examples:

RPR Object Lifetime

In general, the lifetime of an object is:

  1. Creation
  2. Attaching to a scene or setting active (if a scene is used)
  3. Manipulation
  4. Detachment
  5. Deletion

Note that when rendering occurs, the current scene and state of objects in the scene is used. So any changes to the scene or objects attached to it will be reflected the next time rprContextRender is called.

Error Handling

Errors, of course, can sometimes happen when using the Radeon ProRender SDK. These can be due to coding errors, bugs or unhandled situations. Every call to the API returns an rpr_status value. These can range from 0 (RPR_SUCCESS or no error) to various error messages, as specified on the rpr_status page.

We recommend developers to wrap each Radeon ProRender call with some sort of error handling function. For example, in the tutorial code included we use:

#define CHECK(x) { if ( (x) != RPR_SUCCESS ) { ErrorManager(x,__FILE__,__LINE__); } }

And then each call we use, for example:

CHECK( rprContextSetActivePlugin(context, plugins[0]) );

Code Examples

Many examples of code are included in the Tutorials folder of this SDK. They are also discussed at length in our tutorials. Please log any issues or questions on this GitHub page.