Closed Neo-Zhixing closed 11 months ago
What is the input range for the normal vector in
NRD_FrontEnd_PackNormalAndRoughness
?
N
is world-space normal, so [-1; 1]
(unit length).
What is the input range for the normal vector in
NRD_FrontEnd_UnpackNormalAndRoughness
?
It should not bother you, since normal encoding & Pack
tandem make it transparent for you. You just must use texture format defined by enum class NormalEncoding
. Each normal encoding variant has the only one texture format and the only one encoding to avoid misunderstanding.
Am I missing anything here? Or is this just a sneaky bug?
No bugs. p.xy = _NRD_EncodeUnitVector( N, false );
says that p.xy
stores encoding vector in [0; 1]
range, since the underlying storage is UNORM
.
What is the input range for the normal vector in
NRD_FrontEnd_PackNormalAndRoughness
andNRD_FrontEnd_UnpackNormalAndRoughness
?This line seems to indicate that when
NORMAL_ROUGHNESS_ENCODING
is RGBA8_UNORM or RGBA16_UNORM, the input range is -1.0 - 1.0. Therefore we convert that into the 0.0 - 1.0 range accepted by the UNORM texture format.https://github.com/NVIDIAGameWorks/RayTracingDenoiser/blob/c20d25ae223bd3f1deae35cadd9d0912f79f7895/Shaders/Include/NRD.hlsli#L546-L548
However, in the same function, when
NORMAL_ROUGHNESS_ENCODING
isR10G10B10A2_UNORM
, we passbSigned = false
into_NRD_EncodeUnitVector
, indicating an input range of 0.0 - 1.0.https://github.com/NVIDIAGameWorks/RayTracingDenoiser/blob/c20d25ae223bd3f1deae35cadd9d0912f79f7895/Shaders/Include/NRD.hlsli#L538-L542
https://github.com/NVIDIAGameWorks/RayTracingDenoiser/blob/c20d25ae223bd3f1deae35cadd9d0912f79f7895/Shaders/Include/NRD.hlsli#L255
Am I missing anything here? Or is this just a sneaky bug?