Browse Source

Went back to HDR being derived from camera HDR settings. Maybe not entirely correct, but definitely less error prone.

mac-autoexp
Nico de Poel 3 years ago
parent
commit
fad865f8bc
  1. 1
      Assets/Scenes/SampleScene.unity
  2. 1
      Assets/Scenes/SampleScenePPV2Post.unity
  3. 14
      Assets/Scripts/Fsr2ImageEffect.cs

1
Assets/Scenes/SampleScene.unity

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

1
Assets/Scenes/SampleScenePPV2Post.unity

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

14
Assets/Scripts/Fsr2ImageEffect.cs

@ -44,8 +44,6 @@ namespace FidelityFX
[Tooltip("Strength of the sharpening effect.")]
[Range(0, 1)] public float sharpness = 0.8f;
[Tooltip("Make use of high-dynamic range render texture formats and tonemapping adjustment during upscaling.")]
public bool enableHDR = true;
[Tooltip("Allow the use of half precision compute operations, potentially improving performance if the platform supports it.")]
public bool enableFP16 = false;
@ -144,7 +142,7 @@ namespace FidelityFX
// Initialize FSR2 context
Fsr2.InitializationFlags flags = 0;
if (enableHDR) flags |= Fsr2.InitializationFlags.EnableHighDynamicRange;
if (_renderCamera.allowHDR) flags |= Fsr2.InitializationFlags.EnableHighDynamicRange;
if (enableFP16) flags |= Fsr2.InitializationFlags.EnableFP16Usage;
if (enableAutoExposure) flags |= Fsr2.InitializationFlags.EnableAutoExposure;
@ -366,8 +364,14 @@ namespace FidelityFX
// Shut up the Unity warning about not writing to the destination texture
RenderTexture.active = dest;
}
private RenderTextureFormat GetDefaultFormat() => enableHDR ? RenderTextureFormat.DefaultHDR : RenderTextureFormat.Default;
private RenderTextureFormat GetDefaultFormat()
{
if (_originalRenderTarget != null)
return _originalRenderTarget.format;
return _renderCamera.allowHDR ? RenderTextureFormat.DefaultHDR : RenderTextureFormat.Default;
}
private Vector2Int GetDisplaySize()
{

Loading…
Cancel
Save