Progressive rendering
Progressive rendering modes, updates and termination
Iray Photoreal can render progressively into a render target. On each render call the image will be refined more so that over time the image converges to very good quality. The intermediate images can be displayed to the user thus giving a good early impression about the final lighting and material look of the scene. Note that Iray Photoreal does not use any final gathering or photon map based techniques so any changes to the lighting will be visible very fast. Progressive rendering works only if the same render context is reused for subsequent images.
There are a number of termination criteria that control when an image is considered completed. Unless an error is encountered, mi::neuraylib::IRender_context::render() will return 0 until the image is completed, at which point the call returns 1.
For each render request, the renderer will automatically check if the parameters for the requested image (for example image resolution or camera position) fit to the last rendered image. Also the scene will be checked for changes. If any changes are found that would result in visible changes in the image the render context will be reset and the progressive rendering starts from the beginning.
The following key-value pairs, shown here with their default settings, control rendering when passed to mi::neuraylib::IRender_context::set_option() :
- const char* scheduler_mode = "interactive"
-
Controls the rendering mode, which is by default interactive. Setting this option to "batch" switches to the non-interactive rendering mode.
- mi::Uint32 min_samples_per_update = 1
-
Controls the minimum number of samples that need to be rendered per render call in the progressive render loop.
- mi::Float32 interactive_update_interval = 1.f/60.f
-
The update interval time in seconds is compared to the rendering time since the beginning of this interactive render call. This acts as a hint to the renderer. Longer times will generally increase rendering efficiency, while shorter times yield more frequent updates.
- mi::Float32 batch_update_interval = 1e36f
-
The update interval time in seconds is compared to the rendering time since the beginning of this batch render call. This acts as a hint to the renderer. Longer times will generally increase rendering efficiency, while shorter times yield more frequent updates.
The update interval options control how frequently the render call returns to the caller. At the default settings, mi::neuraylib::IRender_context::render() will return after each update in interactive mode, and after finishing the image in batch mode. Decreasing the "batch_update_interval" will allow the call to return before completing the image. The image is considered completed when either the maximum number of samples or the maximum time is exceeded, or if the error falls below a given threshold (see below), but not before the minimum number of samples have been computed.
All these termination criteria are checked after each progression step. The size of the steps is controlled internally and increased over time to improve efficiency when quick updates would no longer add significant information to the resulting image.
The following attributes on the mi::IOptions class, shown here with their default settings, control progressive rendering:
- mi::Sint32 progressive_rendering_min_samples = 4
-
Controls the minimum number of samples that need to be rendered before the progressive render loop is allowed to terminate by any of the termination criteria.
- mi::Sint32 progressive_rendering_max_samples = 100
-
The maximum number of samples is compared to the number of samples since the beginning of this progression. The render call will return 1 if the rendering loop is terminated by this termination criteria.
- mi::Sint32 progressive_rendering_max_time = 3600
-
The maximum time in seconds is compared to the rendering time since the beginning of this progression. The render call will return 1 if the rendering loop is terminated by this termination criteria.
The non-interactive mode can be used to reduce overhead and thus to increase scalability for large render tasks, since the result is written to the canvas (and potentially transferred over the network) less frequently.
When the scheduler mode is switched from interactive to batch, Iray Photoreal will continue refining the image in batch mode at the next render call. When switching from batch mode to interactive mode, all pogress will be lost and rendering will restart from scratch.
Convergence quality estimate
At some point the progressive rendering will have reached a quality where subsequent frames will not have any visible effect on the rendering quality anymore. At this point rendering may stop. This can be based on a convergence quality estimate that can be computed in the non-interactive rendering mode. This estimate can be controlled with the following parameters: a quality parameter that determines when a pixel is considered converged, and an overall converged pixel ratio.
The following attributes on the mi::IOptions class, shown here with their default settings, control the convergence quality estimate:
- bool progressive_rendering_quality_enabled = true
-
The convergence quality estimate is only available in the non-interactive render mode and can, in addition, be enabled and disabled with this attribute. If disabled, rendering will not stop based on the convergence quality and no progress messages will be issued for the current convergence quality.
- mi::Float32 progressive_rendering_quality = 1
-
A convergence estimate for a pixel has to reach a certain threshhold before a pixel is considered converged. This attribute is a relative quality factor for this threshhold. A higher quality setting asks for better converged pixels, which means a longer rendering time. Render times will change roughly linearly with the given value, i.e., doubling the quality roughly doubles the render time.
- mi::Float32 progressive_rendering_converged_pixel_ratio = 0.95
-
If the progressive rendering quality is enabled, this attribute specifies a threshold that controls the stopping criterion for progressive rendering. As soon as the ratio of converged pixels of the entire image is above this given threshhold, Iray Photoreal returns the final result for forthcoming render requests. Additionally, the render call will return 1 in this case indicating to the application that further render calls will have no more effect.
The convergence quality estimate has some computational cost. It is only computed after some initial number of samples to ensure a reasonably meaningful estimate. Furthermore, the estimate is only updated from time to time.
Deprecated attributes
- mi::Float32 progressive_rendering_error_threshold = 0.05
-
Use "progressive_rendering_quality" , "progressive_rendering_quality_enabled" , and "progressive_rendering_converged_pixel_ratio" instead. In particular, "progressive_rendering_converged_pixel_ratio" can be set to one minus this value for the same effect.