Tonemapping
Tonemapping is a native feature of neuray Services and users can implement and install their own tonemap operators in addition
to the
ones natively supported:
- mia_exposure_photographic
- mia_exposure_simple
- max_tone_op_log
attribute string "tm_tonemapper" "operator_name"
where "operator_name" is the name that the tonemap implementation is registered as. Tonemapping is then triggered between the first and second phase of the post render event.
Implementation
Tonemap operators can be split into two general types, locally adaptive or independent. The difference between the two is
that independent
operators can tonemap each pixel without reference to the entire image. Locally adaptive tonemappers require access to the
area surrounding
a pixel (or the entire image) to operate. neuray Services supports both types.
- Locally adaptive
- A locally adaptive tonemap operator will return true when mi::nservices::ITonemap_operator::full_control is called. In this mode mi::nservices::ITonemap_operator::process is called to perform tonemapping and must be implemented. This method must iterate over the supplied canvas and tonemap each pixel.
- Independent
- An independent tonemap operator will return false when mi::nservices::ITonemap_operator::full_control is called. In this mode mi::nservices::ITonemap_operator::process_pixel is called for each pixel in the canvas and must be implemented.
In either mode tonemap execution proceeds in the same manner:
- Call mi::nservices::ITonemap_operator::init to initialize the operator.
- Call mi::nservices::ITonemap_operator::full_control to discover which mode to operate in.
- Call either mi::nservices::ITonemap_operator::process once or mi::nservices::ITonemap_operator::process_pixel for each pixel.
- Call mi::nservices::ITonemap_operator::finish.
Tonemap execution
Execution of tonemapping is generally automatically performed by neuray Services. There are two major exceptions to this.
- iray
- Since iray and its associated renderers have built in support for the "mia_exposure_photographic" tonemapper the neuray Services tonemapping is not called if the iray tonemapper is executed.
- sketch
- As the sketch renderer always renders in the 0->1 range tonemapping is never performed if this renderer is used.
This execution behaviour can be controlled by using the "tm_override" attribute on the camera:
attribute string "tm_override" "value"
Where "value" is one of:
- "auto" - toneamp execution is controlled as described above (the default)
- "on" - neuray Services tonemapping is always applied
- "off" - neuray Services tonemapping is never applied