Simple tone mapper in Optix 7.x

There is the Simple tone mapper on Optix 6.5. What tone mapper operator does it uses? and
How can I use this on Optix 7.x. The link uses rtPostProcessingStageCreateBuiltin method which I couldn’t find it in Optix 7.x

Is there an example for performing tone mapping(no denoising) using optix 7 on an hdr image ?

Setting up a post-processing pipeline in OptiX SDK 6.5.0 is explained in the chapter before your link.
https://raytracing-docs.nvidia.com/optix6/guide_6_5/index.html#post_processing_framework#built-in-post-processing-stages

The SDK example optixDenoiser contains a code path where only the simple tone-mapper is applied.
Look for commandListWithoutDenoiser inside that example’s source code.

There was at least one issue with that not being invertible because apart from gamma and exposure, a tone-mapper step was always applied.
https://forums.developer.nvidia.com/t/tonemapper-doing-weird-things/57181

It should be based on the same paper from Reinhard as described here:
https://raytracing-docs.nvidia.com/optix7/guide/index.html#ai_denoiser#calculating-the-hdr-intensity-parameter

I was never a fan of the post-processing framework in OptiX 5 and 6 and never used the built-in tone-mapper in my own examples.
Instead I either used a tone-mapper which runs as GLSL shader on the final display to the window which doesn’t require to re-render the whole image when just changing tone-mapper parameters, or the same tone-mapper as ray generation kernel only.
That could also be done as last step in the ray generation program doing the actual rendering, but since I do not display every image when doing progressive accumulation, that would have been a waste of time.

Anyway, here are some examples implementing a simple tone-mapper, which is not actually looking at the contents of the image but just has some parameters:

OptiX 5.1.0 based examples:
Custom tone-mapper launch in the post processing pipeline:
https://github.com/nvpro-samples/optix_advanced_samples/blob/master/src/optixIntroduction/optixIntro_09/src/Application.cpp#L257
Custom tone-mapper ray generation program:
https://github.com/nvpro-samples/optix_advanced_samples/blob/master/src/optixIntroduction/optixIntro_09/shaders/raygeneration.cu#L277

OptiX 7.x based examples:
GLSL shaders (this code is independent of OptiX once the rendered buffer is inside the display texture):
https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/intro_runtime/src/Application.cpp#L943
Display with a full client window texture blit:
https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/intro_runtime/src/Application.cpp#L883
More elaborate setup of the vertex attribute arrays, when the rendering resolution is independent of the client window size:
https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/rtigo3/src/Rasterizer.cpp#L736

Thank you for the answer.

Either Reinhard or other operator there is normally a pass that loops over the image to calculate the white point. I think in your code the white point is an user option rather than being computed on the fly, is that right? If yes then my problem is how to efficiently apply the operator? Could it be done during the kernel run(by using a second buffer) or has to be a post process ?

I think in your code the white point is an user option rather than being computed on the fly, is that right?

Yes, as I said, “it’s not actually looking at the contents of the image but just has some parameters”.
Inside my examples both the white point and the brightness GUI settings affect the white point.

If yes then my problem is how to efficiently apply the operator?
Could it be done during the kernel run(by using a second buffer) or has to be a post process ?

Have a search for parallel reduction kernel on the web.
The hits for that describe the basic idea of how to quickly sum values in a grid and how to write that in CUDA most efficiently.
There is also a thrust::reduce() function which does that. (Never used myself.)

That said, if you read the OptiX 7.2 Programming Guide link I posted above again, that doesn’t only link to the paper from Eric Reinhard, it also explains how the HDR intensity is calculated in OptiX using optixDenoiserComputeIntensity

There is also the optixDenoiserComputeAverageColor function in the programming guide chapter directly above it.

Thanks Detlef, perfect like always.