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:
- Create the OIDN device, it reports as being CUDA.
- Create my lightmaps as
R16G16B16A16_FLOAT
in aD3D12_HEAP_FLAG_SHARED
heap (alpha wont contain anything). - Use
ID3D12Device::CreateSharedHandle()
to get a NT handle. - Create a OIDN buffer with
oidnNewSharedBufferFromWin32Handle
- Setup a simple
RT
filter of format HALF3, but I manually specify thepixelByteStride
as 8 androwByteStride
asSizeX * 8
to skip the alpha channel. I tried both in-place and regular and both work the same. - Render the lightmap
- 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.
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