NVIDIAGameWorks/RayTracingDenoiser

Issue during camera translation

kvnnap opened this issue · 2 comments

Hi,

I am having an issue when using the ReBLUR denoiser. I am rendering a scene (Cornell Box) and producing only a diffuse signal which I am passing over to ReBLUR using only the REBLUR_DIFFUSE method. When I translate the camera, there are artefacts in the scene however if I simply rotate it, everything looks ok. There are two videos below showing the correct rotation behaviour and the broken translation behaviour.

I am using the NRD integration code and have compiled NRD (3.7.0.0) and NRI (1.86.0.0) DLLs for use with my renderer (running on 2080 Ti). Currently I am passing the IN_MV texture as a texture filled with zeros since I am dealing with a simple static scene. All the inputs are listed below:

IN_MV = 0 (static scene)
IN_NORMAL_ROUGHNESS - xyz - normal, w = 0
IN_VIEWZ - Linear view depth
IN_DIFF_RADIANCE_HITDIST = xyz = radiance (without albedo), w = hit distance (1st to 2nd bounce)

I am using DirectX 12 for rendering and using the denoiser as a black box. I use the right-handed coordinate system and matrices are stored in row-major (DirectX Math Library). I use the XMMatrixLookToRH function to build the view matrix and XMMatrixPerspectiveRH for the clip matrix. I am converting any matrices to column-major before passing them in the CommonSettings structure. Previously I had a similar issue (visual-wise) with rotation, but the problem was that I passed the matrix incorrectly. I suspect this issue might still be matrix related but I really can't tell. Is the view matrix format same as the one used in OpenGL?

image

I am not sure why these strange artefacts appear during camera translation and I hope someone can help. Please do let me know should you require any further information.

rotation.mp4
translation.mp4

Currently I am passing the IN_MV texture as a texture filled with zeros since I am dealing with a simple static scene

It's only valid if 3D world-space motion is assumed and enabled via isMotionVectorInWorldSpace.

Sorry, it's hard to debug individual integrations, especially when I don't see the full picture. Matrix layout is explained in CommonSettings. Passing transposed matrices is a valid "no brain" experiment. Please, compare your layout with layout in the sample. Keep in mind that RH assumes - viewZ, LH space assumes + viewZ.

Solved, the issue was the format of VIEWZ.

I somehow assumed that, while linear, it has to be normalized and this is not the case. So basically, I was inputting a linear value between near and far - 0 being near and 1 being far; this turns out to be incorrect.