From 85829949f867dc3313438a1d4f34ecc520b1cbfc Mon Sep 17 00:00:00 2001 From: Nico de Poel Date: Sat, 4 Mar 2023 11:14:27 +0100 Subject: [PATCH] Made all inspector fields public, so that they can be easily accessed programmatically. There's really not much reason to keep these private, as we otherwise would have added public properties that directly access them anyway. --- Assets/Scripts/Fsr2Callbacks.cs | 8 ++++++++ Assets/Scripts/Fsr2Controller.cs | 15 ++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/Assets/Scripts/Fsr2Callbacks.cs b/Assets/Scripts/Fsr2Callbacks.cs index 70bb61e..e43347b 100644 --- a/Assets/Scripts/Fsr2Callbacks.cs +++ b/Assets/Scripts/Fsr2Callbacks.cs @@ -36,6 +36,14 @@ namespace FidelityFX Resources.UnloadAsset(shader); } + /// + /// Apply a mipmap bias to in-game textures to prevent them from becoming blurry as the internal rendering resolution lowers. + /// This will need to be customized on a per-game basis, as there is no clear universal way to determine what are "in-game" textures. + /// The default implementation will simply apply a mipmap bias to all 2D textures, which will include things like UI textures and which might miss things like terrain texture arrays. + /// + /// Depending on how your game organizes its assets, you will want to create a filter that more specifically selects the textures that need to have this mipmap bias applied. + /// You may also want to store the bias offset value and apply it to any assets that are loaded in on demand. + /// public virtual void ApplyMipmapBias(float biasOffset) { foreach (var texture in Resources.FindObjectsOfTypeAll()) diff --git a/Assets/Scripts/Fsr2Controller.cs b/Assets/Scripts/Fsr2Controller.cs index e98dabd..2a81528 100644 --- a/Assets/Scripts/Fsr2Controller.cs +++ b/Assets/Scripts/Fsr2Controller.cs @@ -13,19 +13,20 @@ namespace FidelityFX [RequireComponent(typeof(Camera))] public class Fsr2Controller : MonoBehaviour { - [SerializeField] private Fsr2.QualityMode qualityMode = Fsr2.QualityMode.Quality; + public Fsr2.QualityMode qualityMode = Fsr2.QualityMode.Quality; - [SerializeField] private bool performSharpenPass = true; - [SerializeField, Range(0, 1)] private float sharpness = 0.8f; + public bool performSharpenPass = true; + [Range(0, 1)] public float sharpness = 0.8f; [Tooltip("Allow the use of half precision compute operations, potentially improving performance")] - [SerializeField] private bool enableFP16 = false; + public bool enableFP16 = false; [Header("Reactivity, Transparency & Composition")] - [SerializeField] private Texture reactiveMask = null; - [SerializeField] private Texture transparencyAndCompositionMask = null; - [SerializeField] private bool autoGenerateReactiveMask = true; + public Texture reactiveMask = null; + public Texture transparencyAndCompositionMask = null; + public bool autoGenerateReactiveMask = true; [SerializeField] private GenerateReactiveParameters generateReactiveParameters = new GenerateReactiveParameters(); + public GenerateReactiveParameters GenerateReactiveParams => generateReactiveParameters; [System.Serializable] public class GenerateReactiveParameters