Skip to content

Commit

Permalink
Upgraded to FSR 3.1 Upscaler
Browse files Browse the repository at this point in the history
- Moved FSR core classes and shaders into their own package
- Added FSR 2.2 implementation side-by-side with FSR 3.1
- Updated BiRP and PPV2 integrations for FSR 3.1
- Added experimental HDRP 17 integration
  • Loading branch information
ndepoel committed Jul 21, 2024
1 parent 29e2ec9 commit 5e98dac
Show file tree
Hide file tree
Showing 929 changed files with 8,133 additions and 18,754 deletions.
26 changes: 26 additions & 0 deletions Assets/FSR3 Upscaler Assets.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2dbcc608a4754d049a14a0bcce2eb40b, type: 3}
m_Name: FSR3 Upscaler Assets
m_EditorClassIdentifier:
shaders:
prepareInputsPass: {fileID: 7200000, guid: 4f59e5b9179d74844ae06a30ae1e0629, type: 3}
lumaPyramidPass: {fileID: 7200000, guid: d253be05abcdc80428503d3e4cce3a36, type: 3}
shadingChangePyramidPass: {fileID: 7200000, guid: 251e663738905fa4d8817001682d802f, type: 3}
shadingChangePass: {fileID: 7200000, guid: 9a2bff2f97619ed4989d9b0577ba0641, type: 3}
prepareReactivityPass: {fileID: 7200000, guid: 20e44016ed34b0d4b8de499d1b566c69, type: 3}
lumaInstabilityPass: {fileID: 7200000, guid: a135306e6d1857e43a86ef20db2a47fe, type: 3}
accumulatePass: {fileID: 7200000, guid: c9b45f0ae7673694ba57a4aadfe212e9, type: 3}
sharpenPass: {fileID: 7200000, guid: 7aaf5cfff022de2499e9b0412f947f6c, type: 3}
autoGenReactivePass: {fileID: 7200000, guid: 5716b91fdaa4e9e439df6b96a796fe6e, type: 3}
tcrAutoGenPass: {fileID: 7200000, guid: 75cdc6ef23f08ed498d4da511923fcea, type: 3}
debugViewPass: {fileID: 7200000, guid: cb24a71d54164c54eb5e86839acd48c5, type: 3}
File renamed without changes.
23 changes: 0 additions & 23 deletions Assets/Fsr3UpscalerAssets.asset

This file was deleted.

74 changes: 25 additions & 49 deletions Assets/Scenes/SampleScenePPV2.unity
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,8 @@ GameObject:
- component: {fileID: 963194228}
- component: {fileID: 963194227}
- component: {fileID: 963194226}
- component: {fileID: 963194234}
- component: {fileID: 963194232}
- component: {fileID: 963194233}
- component: {fileID: 963194229}
m_Layer: 6
m_Name: Main Camera
m_TagString: MainCamera
Expand Down Expand Up @@ -305,40 +303,6 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 9.931, y: 109.145, z: 0}
--- !u!114 &963194229
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 955cb66a9ecc20441a7e32934c9b4690, type: 3}
m_Name:
m_EditorClassIdentifier:
qualityMode: 2
performSharpenPass: 1
sharpness: 0.8
enableFP16: 0
enableAutoExposure: 1
preExposure: 1
exposure: {fileID: 0}
reactiveMask: {fileID: 0}
transparencyAndCompositionMask: {fileID: 0}
autoGenerateReactiveMask: 1
generateReactiveParameters:
scale: 0.5
cutoffThreshold: 0.2
binaryValue: 0.9
flags: 13
autoGenerateTransparencyAndComposition: 0
generateTransparencyAndCompositionParameters:
autoTcThreshold: 0.05
autoTcScale: 1
autoReactiveScale: 5
autoReactiveMax: 0.9
assets: {fileID: 11400000, guid: 4151befafd86e8740ab09463b4f1bdbb, type: 2}
--- !u!114 &963194232
MonoBehaviour:
m_ObjectHideFlags: 0
Expand All @@ -357,12 +321,35 @@ MonoBehaviour:
m_Bits: 64
stopNaNPropagation: 0
finalBlitToCameraTarget: 0
antialiasingMode: 0
antialiasingMode: 4
temporalAntialiasing:
jitterSpread: 0.75
sharpness: 0.25
stationaryBlending: 0.95
motionBlending: 0.85
superResolution:
qualityMode: 2
performSharpenPass: 1
sharpness: 0.8
enableFP16: 0
exposureSource: 1
preExposure: 1
exposure: {fileID: 0}
enableDebugView: 0
reactiveMask: {fileID: 0}
transparencyAndCompositionMask: {fileID: 0}
autoGenerateReactiveMask: 1
generateReactiveParameters:
scale: 0.5
cutoffThreshold: 0.2
binaryValue: 0.9
flags: 13
autoGenerateTransparencyAndComposition: 0
generateTransparencyAndCompositionParameters:
autoTcThreshold: 0.05
autoTcScale: 1
autoReactiveScale: 5
autoReactiveMax: 0.9
subpixelMorphologicalAntialiasing:
quality: 2
fastApproximateAntialiasing:
Expand Down Expand Up @@ -397,6 +384,7 @@ MonoBehaviour:
m_ShowCustomSorter: 0
breakBeforeColorGrading: 0
m_BeforeTransparentBundles: []
m_BeforeUpscalingBundles: []
m_BeforeStackBundles: []
m_AfterStackBundles: []
--- !u!114 &963194233
Expand All @@ -416,18 +404,6 @@ MonoBehaviour:
blendDistance: 0
weight: 1
priority: 1
--- !u!114 &963194234
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 56db3edb28006274aab71644ef3e4f35, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &1313173313
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down
80 changes: 0 additions & 80 deletions Assets/Scripts/Core/Fsr3ShaderIDs.cs

This file was deleted.

12 changes: 8 additions & 4 deletions Assets/Scripts/Fsr3UpscalerImageEffect.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023 Nico de Poel
// Copyright (c) 2024 Nico de Poel
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand All @@ -22,6 +22,7 @@
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Rendering;
using FidelityFX.FSR3;

namespace FidelityFX
{
Expand Down Expand Up @@ -54,6 +55,10 @@ public class Fsr3UpscalerImageEffect : MonoBehaviour
[Tooltip("Optional 1x1 texture containing the exposure value for the current frame.")]
public Texture exposure = null;

[Header("Debug")]
[Tooltip("Enable a debug view to analyze the upscaling process.")]
public bool enableDebugView = false;

[Header("Reactivity, Transparency & Composition")]
[Tooltip("Optional texture to control the influence of the current frame on the reconstructed output. If unset, either an auto-generated or a default cleared reactive mask will be used.")]
public Texture reactiveMask = null;
Expand Down Expand Up @@ -326,12 +331,14 @@ private void SetupDispatchDescription()
_dispatchDescription.MotionVectorScale.x = -scaledRenderSize.x;
_dispatchDescription.MotionVectorScale.y = -scaledRenderSize.y;
_dispatchDescription.RenderSize = scaledRenderSize;
_dispatchDescription.UpscaleSize = _displaySize;
_dispatchDescription.FrameTimeDelta = Time.unscaledDeltaTime;
_dispatchDescription.CameraNear = _renderCamera.nearClipPlane;
_dispatchDescription.CameraFar = _renderCamera.farClipPlane;
_dispatchDescription.CameraFovAngleVertical = _renderCamera.fieldOfView * Mathf.Deg2Rad;
_dispatchDescription.ViewSpaceToMetersFactor = 1.0f; // 1 unit is 1 meter in Unity
_dispatchDescription.Reset = _resetHistory;
_dispatchDescription.Flags = enableDebugView ? Fsr3Upscaler.DispatchFlags.DrawDebugView : 0;
_resetHistory = false;

// Set up the parameters for the optional experimental auto-TCR feature
Expand Down Expand Up @@ -390,9 +397,6 @@ private void OnRenderImage(RenderTexture src, RenderTexture dest)
_renderCamera.rect = _originalRect;
_renderCamera.ResetProjectionMatrix();

// Update the input resource descriptions
_dispatchDescription.InputResourceSize = new Vector2Int(src.width, src.height);

_dispatchCommandBuffer.Clear();

if (autoGenerateReactiveMask)
Expand Down
1 change: 1 addition & 0 deletions Assets/Scripts/Fsr3UpscalerImageEffectHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

using System.Collections;
using UnityEngine;
using FidelityFX.FSR3;

namespace FidelityFX
{
Expand Down

This file was deleted.

Loading

0 comments on commit 5e98dac

Please sign in to comment.