Browse Source

Made HDR into an explicit toggle that can be set by the application, rather than a best guess based on the camera settings

mac-autoexp
Nico de Poel 3 years ago
parent
commit
b1a7f48abb
  1. 2
      Assets/Scenes/SampleScene.unity
  2. 2
      Assets/Scenes/SampleScenePPV2Post.unity
  3. 1
      Assets/Scenes/SampleSceneTwoCamera.unity
  4. 6
      Assets/Scripts/Fsr2ImageEffect.cs

2
Assets/Scenes/SampleScene.unity

@ -319,6 +319,7 @@ MonoBehaviour:
qualityMode: 2
performSharpenPass: 1
sharpness: 0.8
enableHDR: 0
enableFP16: 0
enableAutoExposure: 1
preExposure: 1
@ -331,6 +332,7 @@ MonoBehaviour:
cutoffThreshold: 0.2
binaryValue: 0.9
flags: 13
outputMotionVectors: {fileID: 0}
--- !u!114 &963194230
MonoBehaviour:
m_ObjectHideFlags: 0

2
Assets/Scenes/SampleScenePPV2Post.unity

@ -322,6 +322,7 @@ MonoBehaviour:
qualityMode: 3
performSharpenPass: 1
sharpness: 0.8
enableHDR: 0
enableFP16: 0
enableAutoExposure: 1
preExposure: 1
@ -334,6 +335,7 @@ MonoBehaviour:
cutoffThreshold: 0.2
binaryValue: 0.9
flags: 13
outputMotionVectors: {fileID: 0}
--- !u!114 &963194230
MonoBehaviour:
m_ObjectHideFlags: 0

1
Assets/Scenes/SampleSceneTwoCamera.unity

@ -491,6 +491,7 @@ MonoBehaviour:
qualityMode: 3
performSharpenPass: 1
sharpness: 0.8
enableHDR: 0
enableFP16: 0
enableAutoExposure: 1
preExposure: 1

6
Assets/Scripts/Fsr2ImageEffect.cs

@ -44,6 +44,8 @@ namespace FidelityFX
[Tooltip("Strength of the sharpening effect.")]
[Range(0, 1)] public float sharpness = 0.8f;
[Tooltip("Enable this if you're passing a pre-tonemapping HDR image to the upscaler.")]
public bool enableHDR = false;
[Tooltip("Allow the use of half precision compute operations, potentially improving performance if the platform supports it.")]
public bool enableFP16 = false;
@ -132,7 +134,7 @@ namespace FidelityFX
// Initialize FSR2 context
Fsr2.InitializationFlags flags = 0;
if (_renderCamera.allowHDR) flags |= Fsr2.InitializationFlags.EnableHighDynamicRange;
if (enableHDR) flags |= Fsr2.InitializationFlags.EnableHighDynamicRange;
if (enableFP16) flags |= Fsr2.InitializationFlags.EnableFP16Usage;
if (enableAutoExposure) flags |= Fsr2.InitializationFlags.EnableAutoExposure;
@ -352,7 +354,7 @@ namespace FidelityFX
RenderTexture.active = dest;
}
private RenderTextureFormat GetDefaultFormat() => _renderCamera.allowHDR ? RenderTextureFormat.DefaultHDR : RenderTextureFormat.Default;
private RenderTextureFormat GetDefaultFormat() => enableHDR ? RenderTextureFormat.DefaultHDR : RenderTextureFormat.Default;
private Vector2Int GetDisplaySize()
{

Loading…
Cancel
Save