RenderKit / oidn

Intel® Open Image Denoise library

Home Page:https://www.openimagedenoise.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Need help denoising R16G16B16A16_FLOAT images using CUDA

BleuBleu opened this issue · comments

Hi!

I am trying to use the GPU (CUDA) denoiser to directly denoise lightmaps without having to do any CPU readbacks. The CPU denoiser using FLOAT3 works beautifully, but I am seeing some strange blocky artefacts when trying to use CUDA + HALF3 as input. I wanted to check with you if what I am trying to do is even possible!

Here is what I do currently as a quick test:

  1. Create the OIDN device, it reports as being CUDA.
  2. Create my lightmaps as R16G16B16A16_FLOAT in a D3D12_HEAP_FLAG_SHARED heap (alpha wont contain anything).
  3. Use ID3D12Device::CreateSharedHandle() to get a NT handle.
  4. Create a OIDN buffer with oidnNewSharedBufferFromWin32Handle
  5. Setup a simple RT filter of format HALF3, but I manually specify the pixelByteStride as 8 and rowByteStride as SizeX * 8 to skip the alpha channel. I tried both in-place and regular and both work the same.
  6. Render the lightmap
  7. Execute the filter.

As you can see, the bottom (denoised) result contains some blocky artefact that leads me to believe there is some texture tiling or format issue. I understand the edges need to be dilated to prevent artefacts near "unused" pixels of the lightmaps, I still need to work on that so let's ignore edges for now, also ignore the pink pixels.

image

I didnt include a CPU/FLOAT3 image but its very nice and smooth.

Is what im trying to do possible? Anything that comes to mind I should investigate?

-Mat

Hi!

I ended up switching to a buffer instead of a texture and everything works super well. Textures must have some proprietary tiling/swizzling that doesn't get undone when CUDA reads from them.

-Mat