Using Denoiser in cycles_standalone.cpp sample

I was trying to update that sample but no denoise is performed

cycles_standalone.cpp
it uses --denoiser [NONE/NLM/OPTIX/INTEL] as parameter (being NONE the default value)

Also in my own implementation of Cycles I tried to retrieve the denoised buffer by

session->buffers->get_denoising_pass_rect(0, 1, 1, 3, rawpixels);
but I get a black buffer, changing the first parameter I managed to get something like the normals buffer.

Any tip to complete the sample and/or getting that buffer?

I think the most expert in these theme is @brecht
I hope can help you…
Cheers…

To get the denoised buffer you shouldn’t have to do anything special. It is written to the same combined pass as when denoising is disabled. get_denoising_pass_rect is for denoising utility passes, to perform denoising at a later point.

I’m guessing Cycles standalone is missing a call to device.add_denoising_devices(), to create the appropriate devices for performing the denoising.

Thank you @brecht I’ve tried it but if I add it in options_parse();

if (denoiser == "INTEL") {
    printf("Using Intel Open Image Denoiser\n");
    options.session_params.denoising.type = ccl::DENOISER_OPENIMAGEDENOISE;
    options.session->device->info.add_denoising_devices(ccl::DENOISER_OPENIMAGEDENOISE);
    options.session_params.denoising.store_passes = true;
    options.session_params.denoising.input_passes = ccl::DENOISER_INPUT_RGB_ALBEDO_NORMAL;
    options.session_params.denoising.clamp_input = false;
    options.session_params.denoising.strength = 1.0;
    options.session_params.denoising.use = true;
  }

I get a crash, but if I add it in session_init():

if (options.session_params.denoising.type == ccl::DENOISER_OPENIMAGEDENOISE ||
      options.session_params.denoising.type == ccl::DENOISER_OPTIX ||
      options.session_params.denoising.type == ccl::DENOISER_NLM) {
    options.session_params.denoising.store_passes = true;
    options.session_params.denoising.input_passes = ccl::DENOISER_INPUT_RGB_ALBEDO_NORMAL;
    options.session->device->info.add_denoising_devices(options.session_params.denoising.type);
  }

It doesn’t crash but it seems to have no effect.

Thank you in advance for your help.

You need to use options.session_params.device.add_denoising_devices, not options.session->device->info.add_denoising_devices.

Thank you but unfortunately I had the same issue:

  • In options_parse() crash
  • In session_init() no effect, also I’ve tried to place it in several positions before/after reset, start and so.

Thank you for your time.

It should be in options_parse(), if that crashes you’ll need to explain where the crash is exactly.

My bad I pasted options.session->device->info.add_denoising_devices . again but now with options.session_params.device.add_denoising_devices

It has no effect in INTEL and NLM but in OPTIX an error is shown in the CyclesXML viewport: Denoiser type not supported by compute device Obviously it happens since I’ve used CPU rendering but Why is not possible to use Optix denoiser with CPU rendering? I mean that I do not thing that there is any technological limit about that and it could have sense for big scenes that takes high amount of memory (more than the GPU room) but it could be denoised via GPU, anyway this is only just speaking since I’m mostly interested on Intel’s one.

The OptiX denoiser is part of the NVIDIA driver and is only supported on NVIDIA GPUs, we have no control over that.

Probably the problem is on my side then, the coding computer has no updated drivers. Listing the devices only the CPU and CUDA GPU appears, not optix.

Concerning the denoising still I’m having the same issue in options_parse()

if (denoiser == "INTEL") {
    printf("Using Intel Open Image Denoiser\n");
    options.session_params.device.add_denoising_devices(ccl::DENOISER_OPENIMAGEDENOISE);
    options.session_params.device.denoisers = ccl::DENOISER_OPENIMAGEDENOISE;
    options.session_params.denoising.type = ccl::DENOISER_OPENIMAGEDENOISE;
    options.session_params.denoising.store_passes = true;
    options.session_params.denoising.input_passes = ccl::DENOISER_INPUT_RGB_ALBEDO_NORMAL;
    options.session_params.denoising.clamp_input = false;
    options.session_params.denoising.strength = 1.0;
    options.session_params.denoising.use = true;
  }

Has no effect yet, btw could have sense to push these changes once is working to the Cycles repo? I mean updating the sample.

@brecht any thought on this?
I already owe you some beers!

@Victor.Feliz Have you solved this problem? I Have the same problem.