NVIDIAGameWorks / RayTracingDenoiser

NVIDIA Ray Tracing Denoiser
Other
515 stars 46 forks source link

Understanding some of the NRD denoiser inputs #82

Closed StudenteChamp2 closed 1 month ago

StudenteChamp2 commented 1 month ago

Hello :) I need more information about the mandatory denoiser inputs:

IN_NORMAL_ROUGHNESS, : When a primary ray doesnt it anything what should this be? Zero normal and roughness?

IN_VIEWZ : linear view space Z for primary rays. How do you linearize a Z value for a ray?

HITDIST: When no intersection what it should be? Zero?

Thank you very much :)

dzhdanNV commented 1 month ago

When a primary ray doesnt it anything what should this be? Zero normal and roughness?

Don't care. NRD ignores any user provided values outside of the denoising range (in common settings).

How do you linearize a Z value for a ray?

Just do tracing in world space.

When no intersection what it should be? Zero?

Infinity (better a big value).

StudenteChamp2 commented 1 month ago

Not sure to understand.

1) IN_NORMAL_ROUGHNESS:The denoising range seems to be linked to the scene bounds. What is the connection with normals and roughness?

2) IN_VIEWZ: So providing worldspace Z value is fine?

3) HITDIST.:I get this one thank you <3

dzhdanNV commented 1 month ago

The denoising range seems to be linked to the scene bounds. What is the connection with normals and roughness?

IN_NORMAL_ROUGHNESS is not a standalone input in vacuum. It is used in conjunction with other inputs, like IN_VIEWZ, which has information about the view/world space positions.

So providing worldspace Z value is fine?

IN_VIEWZ is mul( worldToViewMatrix, worldPos ).z, aka linearized HW depth.

StudenteChamp2 commented 1 month ago

That's sound good. Thank you for taking the time to help me :)

StudenteChamp2 commented 1 month ago

@dzhdanNV Why is view Z called linearized here? I would have expected something like this: https://stackoverflow.com/questions/51108596/linearize-depth

dzhdanNV commented 1 month ago

Why is view Z called linearized here?:

Sorry, nothing to add to:

IN_VIEWZ is mul( worldToViewMatrix, worldPos ).z, aka linearized HW depth

I would have expected something like this...?

If you already have rasterized primary rays (aka g-buffer + HW depth). Then, yes, you need to linearize HW depth first, using a code similar to the provided code.

StudenteChamp2 commented 1 month ago

Nope i do not use rasterization. Right know i take world position from primary rays and multiply it with the formula you gave: mul( worldToViewMatrix, worldPos ).z

But the linear naming stuff was confusing to me :)