|
|
|
@ -1,6 +1,7 @@ |
|
|
|
using System; |
|
|
|
using System.Collections; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.IO; |
|
|
|
using FidelityFX; |
|
|
|
using UnityEngine; |
|
|
|
|
|
|
|
@ -84,6 +85,13 @@ public class SubsampleTest : MonoBehaviour |
|
|
|
|
|
|
|
private void Update() |
|
|
|
{ |
|
|
|
if (Input.GetKeyDown(KeyCode.F12)) |
|
|
|
{ |
|
|
|
string path = Path.Combine(Directory.GetCurrentDirectory(), $"screenshot-{DateTime.Now:yyyyMMdd-HHmmss}.png"); |
|
|
|
ScreenCapture.CaptureScreenshot(path); |
|
|
|
Debug.Log($"Screenshot saved to: {path}"); |
|
|
|
} |
|
|
|
|
|
|
|
outputCamera.enabled = gameCamera.enabled; |
|
|
|
//outputCamera.CopyFrom(gameCamera);
|
|
|
|
|
|
|
|
@ -105,14 +113,14 @@ public class SubsampleTest : MonoBehaviour |
|
|
|
// Unity already does jittering behind the scenes for certain post-effects, so can we perhaps integrate with that?
|
|
|
|
int jitterPhaseCount = Fsr2.GetJitterPhaseCount(gameCamera.targetTexture.width, Screen.width); |
|
|
|
Fsr2.GetJitterOffset(out float jitterX, out float jitterY, Time.frameCount, jitterPhaseCount); |
|
|
|
|
|
|
|
jitterX = 2.0f * jitterX / gameCamera.targetTexture.width; |
|
|
|
|
|
|
|
_fsr2Controller.SetJitterOffset(new Vector2(jitterX, jitterY)); |
|
|
|
|
|
|
|
jitterX = -2.0f * jitterX / gameCamera.targetTexture.width; |
|
|
|
jitterY = -2.0f * jitterY / gameCamera.targetTexture.height; |
|
|
|
|
|
|
|
var jitterTranslationMatrix = Matrix4x4.Translate(new Vector3(jitterX, jitterY, 0)); |
|
|
|
gameCamera.projectionMatrix = jitterTranslationMatrix * gameCamera.nonJitteredProjectionMatrix; |
|
|
|
|
|
|
|
_fsr2Controller.SetJitterOffset(new Vector2(jitterX, jitterY)); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
|