NVIDIAGameWorks/RayTracingDenoiser

[REBLUR] Potential bug with transforming Xprev to view space

nuno-cardoso opened this issue · 2 comments

Hello,
I am integrating Reblur denoiser, using only the shaders, so not using the C++ code side.
While debugging the denoiser code i found the following.

In the shader REBLUR_DiffuseSpecular_TemporalAccumulation.hlsli, line 250, i see Xprev is transformed to view space using affine transform, so it includes translation:
float3 Xvprev = STL::Geometry::AffineTransform( gWorldToViewPrev, Xprev );

But before, the variable Xprev gets its value from variable X which is transformed by rotating only Xv, so no translation included in the transformation.
// Current position
float3 Xv = STL::Geometry::ReconstructViewPosition( pixelUv, gFrustum, viewZ, gOrthoMode );
float3 X = STL::Geometry::RotateVector( gViewToWorld, Xv );
...
float3 Xprev = X;
...

It seems the algorithm is doing transformations between world and view spaces assuming only rotations.
If am not missing anything, shouldn't the AffineTransform of Xprev in line 250 be a rotation (code below)?
float3 Xvprev = STL::Geometry::RotateVector( gWorldToViewPrev, Xprev );

Hi,
I missed the detail matrices in reblur are camera relative.
Apologies for the wrong post.

Right. "Prev" transform includes movement "delta", this is why "affine" transform is needed. In the current frame internal matrices always have 0 translation.