neuray API Programmer's Manual

Overview: Rendering

[Previous] [Up]

The neuray rendering system supports several different renderers including a ray tracer with global illumination features, a GPU renderer and a sketch renderer. If the GPU renderer cannot be started, because for example an appropriate graphics card was not found, it will not be available. The sketch renderer is also a GPU renderer and will not be available in that case as well. The other neuray renderers do not require a GPU.

You can render from different application threads at the same time using the same or a different renderer and the same or different scenes or even different versions of the same scene at the same time.

To render an image you start with a render context that you obtain from the method INVALID_DOXYREFmi::neuraylib::IScene::get_render_context() of an neuray Scene object. The neuray Scene object is a normal scene database element that you create and edit through a transaction. You initialize the scene by setting the rootgroup, the camera instance, and the render options of the Scene object.

You can use the render context to render multiple frames. The rendered pixels will be written to a render target object, which is an implementation of an abstract C++ interface class. You can provide your application specific implementation of this interface class and pass it as a pointer to one of the render functions of the render context. This concept allows you for example to render to files, to render directly to the screen, or to render to textures. It also allows you to do progressive rendering. An example for a render target implementation is provided with the neuray release.

The render context is bound to one scene. You can use a render context to render from a single thread. The render call will return after the full image has been rendered or after rendering has been aborted. You can abort a rendering operation from a different thread using the render context object. However, aborting might not necessarily be instantaneous.

Progress Reports

To obtain information on how a rendering is progressing, you can pass a progress object to a render call. A progress object implements an abstract C++ interface class which has only one method which is used by the neuray system to signal progress. This method can be called from any thread in the neuray system including the thread which initiated the render call. It will get a string which describes the rendering phase, and a number between 0 and 1 which specifies how much progress has been made in this phase.

[Previous] [Up]