Normals for OptiX 7 Denoiser


I read this topic Grid-like patterns in denoiser where this is being said:
“[…] Normal buffers must be null vector for misses and normalized vectors in camera space otherwise[…]”

In my OptiX miss program kernels (using an environment map) yet I used as input for normal buffer for the denoiser:
-normalize(CameraRayDirection) // instead of (0,0,0)
to simulate the directions as in a skydome.
Should I change that back to 0,0,0 because of performance reason (or other reason) ?

Thank you.

That should work as well for most cases.
I probably should have said “can be” instead of “must be”. I’ll change that in the original post.

It’s important to know that the denoiser actually can handle null vectors, otherwise I would have also used the negative ray direction in camera space.

In the end, the denoiser uses the normal buffer to identify edges between image areas for different geometries which helps with high frequency geometry changes.
Using the negative ray direction for the sky dome might result in some cases where similarly oriented geometry wouldn’t produce the same strong normal gradient along the geometry edge, e.g. when looking from the inside of a cut-away sphere or any other geometry viewed exactly perpendicular near the edges (far away building walls etc.).

I don’t know if there is a difference for the denoiser performance between these cases. I doubt it.
That should be very easy to try and benchmark in your own application.

1 Like