NVIDIAGameWorks/RayTracingDenoiser

Some questions about texture

dogJ-1005 opened this issue · 1 comments

Hi there. I feel a little confused about how to use NRD to do denoise. Here are some questions I summarized based on the README.md and 09_RayTracing_NRD.cpp:

  1. I want to use nrd to denoise an image, so the input is " image_path ", how to convert an image to nri::Texture?

    At the beginning, I referred to the steps of 09_RayTracing_NRD.cpp. By the function utils::LoadTexture(), I converted image to utils::Texture textureData , and when I wanted to use nri::createTexture() to convert utils::Texture to nri::Texture, I found that the createTexture() function's parameters were format, height, width and mipnum. It seemed that I just created a blank texture.

    Maybe I should refer to the method "STEP 4 - WRAP NATIVE POINTERS" in README.md, but I have never contacted DirectX before, so it is a little difficult for me to understand.

  2. How can I get the image after denoising? From the userpool's output slot?

  3. What should I do about unused slots? If I use {nullptr, nullptr, nri::Format::UNKNOWN} ,this error will be generated :

    An exception was thrown: Read access permission conflict. state is nullptr.

    The error occurred in the Nrd::Dispatch() function:

    bool isStateChanged = nextAccess != state->nextAccess || nextLayout != state->nextLayout

Could you give me some advice?

NRD has been designed to denoise real-time raytracing outputs, not static images:

  • NRD denoises images progressively (at least due to temporal accumulation). It means, you can't apply NRD as a Photoshop-like filter;
  • NRD requires "guides" - motion vectors, normal & roughness of primary hits, linearized depth, hit distance and others. It means, you are not allowed to nullify expected inputs, which, seems, you don't have.

How to convert an image to nri::Texture?

HDD to CPU memory:
Utils.cpp - search for "LoadTexture"
CPU memory to GPU:
Sample::UploadStaticData()

It doesn't include state transitions, shader resource view creation...