OptiX 7 Denoiser: unsigned char pixel format not supported

Hi,

I followed OptiX 7 documentation and made a quick test code for the Denoiser.
However, it didn’t work with error: unsigned char pixel format not supported.
Did I do something wrong?

The code is below:

class DenoiserRenderPass
    {
    public:
        void init(OptixDeviceContext context, unsigned int width, unsigned int height)
        {
            _options.inputKind = OPTIX_DENOISER_INPUT_RGB;
            _options.pixelFormat = OPTIX_PIXEL_FORMAT_UCHAR4;

            optixDenoiserCreate(context, &_options, &_denoiser);
            optixDenoiserSetModel(_denoiser, OPTIX_DENOISER_MODEL_KIND_LDR, nullptr, 0);

            OptixDenoiserSizes sizes;
            optixDenoiserComputeMemoryResources(_denoiser, width, height, &sizes);
            _denoiserStateSizeInBytes = sizes.stateSizeInBytes;
            _scratchSizeInBytes = sizes.recommendedScratchSizeInBytes;

            cudaMalloc((void**)&_scratch, _scratchSizeInBytes);

            cudaStreamCreate(&_stream);
            cudaMalloc((void**)&_denoiserState, _denoiserStateSizeInBytes);
            optixDenoiserSetup(_denoiser, _stream, width, height, _denoiserState, _denoiserStateSizeInBytes, _scratch, _scratchSizeInBytes);
            
            cudaMalloc((void**)&_outputIntensity, width * height * sizeof(uchar4));
        }

        void launchRender(const RTBuffer2D<uchar4>& src, RTBuffer2D<uchar4>& dst)
        {
            _denoiserParams = {};
            _inputImage.width = src.width();
            _inputImage.height = src.height();
            _inputImage.rowStrideInBytes = src.pitch();
            _inputImage.pixelStrideInBytes = src.stride();
            _inputImage.data = (CUdeviceptr)src.ptr();
            _inputImage.format = OPTIX_PIXEL_FORMAT_UCHAR4;

            optixDenoiserComputeIntensity(
                    _denoiser, _stream, &_inputImage, _outputIntensity, _scratch, _scratchSizeInBytes);

            _outputImage.width = dst.width();
            _outputImage.height = dst.height();
            _outputImage.rowStrideInBytes = dst.pitch();
            _outputImage.pixelStrideInBytes = dst.stride();
            _outputImage.data = (CUdeviceptr)dst.ptr();
            _outputImage.format = OPTIX_PIXEL_FORMAT_UCHAR4;

            optixDenoiserInvoke(_denoiser, _stream, &_denoiserParams,
                _denoiserState, _denoiserStateSizeInBytes, &_inputImage, 1, 0, 0, &_outputImage, _scratch, _scratchSizeInBytes);
        }

    private:
        OptixDenoiserOptions    _options;
        OptixDenoiser           _denoiser;
        CUstream                _stream;
        CUdeviceptr             _denoiserState;
        size_t                  _denoiserStateSizeInBytes;
        OptixDenoiserParams     _denoiserParams;
        OptixImage2D            _inputImage;
        OptixImage2D            _outputImage;
        CUdeviceptr             _outputIntensity;
        CUdeviceptr             _scratch;
        size_t                  _scratchSizeInBytes;
    };

No, that’s not implemented.

Please see the OptiX 7.0.0 release notes known issues:
6. OPTIX_DENOISER_INPUT_RGB_ALBEDO_NORMAL is not currently supported in the Denoiser.
7. Pixel formats OPTIX_PIXEL_FORMAT_UCHAR3 and OPTIX_PIXEL_FORMAT_UCHAR4 are not supported by the Denoiser.

or this thread: https://devtalk.nvidia.com/default/topic/1063569/optix/building-the-ai-denoiser-dll-from-source/

I completely missed the release note.

Thank you for the response :)

Is OPTIX_DENOISER_MODEL_KIND_LDR for float4 (in [0;1]) supported?