Browse Source

Set non-jittered projection matrix before applying jittering, making motion vector jitter cancellation unnecessary.

This should make outputting non-jittered upscaled depth and motion vectors for subsequent render passes a lot easier.
mac-autoexp
Nico de Poel 3 years ago
parent
commit
84b52c8853
  1. 6
      Assets/Scripts/Fsr2Controller.cs

6
Assets/Scripts/Fsr2Controller.cs

@ -47,7 +47,7 @@ namespace FidelityFX
private void OnEnable()
{
Fsr2.InitializationFlags flags = Fsr2.InitializationFlags.EnableMotionVectorsJitterCancellation;
Fsr2.InitializationFlags flags = 0;
if (enableFP16)
flags |= Fsr2.InitializationFlags.EnableFP16Usage;
@ -191,7 +191,7 @@ namespace FidelityFX
_dispatchDescription.Reset = _reset;
_reset = false;
// Perform custom jittering of the camera's projection matrix according to FSR2's instructions
// Perform custom jittering of the camera's projection matrix according to FSR2's documentation
int jitterPhaseCount = Fsr2.GetJitterPhaseCount(_renderSize.x, _displaySize.x);
Fsr2.GetJitterOffset(out float jitterX, out float jitterY, Time.frameCount, jitterPhaseCount);
@ -201,7 +201,9 @@ namespace FidelityFX
jitterY = 2.0f * jitterY / _renderSize.y;
var jitterTranslationMatrix = Matrix4x4.Translate(new Vector3(jitterX, jitterY, 0));
_renderCamera.nonJitteredProjectionMatrix = _renderCamera.projectionMatrix;
_renderCamera.projectionMatrix = jitterTranslationMatrix * _renderCamera.nonJitteredProjectionMatrix;
_renderCamera.useJitteredProjectionMatrixForTransparentRendering = false;
}
private void OnRenderImage(RenderTexture src, RenderTexture dest)

Loading…
Cancel
Save