Browse Source

Removed the separate output color/depth render texture parameter, as it was very much redundant.

Added help tooltips to each of the input parameters.
mac-autoexp
Nico de Poel 3 years ago
parent
commit
0837aa50cb
  1. 28
      Assets/Scripts/Fsr2ImageEffect.cs

28
Assets/Scripts/Fsr2ImageEffect.cs

@ -36,23 +36,33 @@ namespace FidelityFX
{
public IFsr2Callbacks Callbacks { get; set; } = new Fsr2CallbacksBase();
[Tooltip("Standard scaling ratio presets.")]
public Fsr2.QualityMode qualityMode = Fsr2.QualityMode.Quality;
[Tooltip("Apply RCAS sharpening to the image after upscaling.")]
public bool performSharpenPass = true;
[Tooltip("Strength of the sharpening effect.")]
[Range(0, 1)] public float sharpness = 0.8f;
[Tooltip("Allow the use of half precision compute operations, potentially improving performance")]
[Tooltip("Allow the use of half precision compute operations, potentially improving performance if the platform supports it.")]
public bool enableFP16 = false;
[Header("Exposure")]
[Tooltip("Allow an exposure value to be computed internally. When set to false, either the provided exposure texture or a default exposure value will be used.")]
public bool enableAutoExposure = true;
[Tooltip("Value by which the input signal will be divided, to get back to the original signal produced by the game.")]
public float preExposure = 1.0f;
[Tooltip("Optional 1x1 texture containing the exposure value for the current frame.")]
public Texture exposure = null;
[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;
[Tooltip("Optional texture for marking areas of specialist rendering which should be accounted for during the upscaling process. If unset, a default cleared mask will be used.")]
public Texture transparencyAndCompositionMask = null;
[Tooltip("Automatically generate a reactive mask based on the difference between opaque-only render output and the final render output including alpha transparencies.")]
public bool autoGenerateReactiveMask = true;
[Tooltip("Parameters to control the process of auto-generating a reactive mask.")]
[SerializeField] private GenerateReactiveParameters generateReactiveParameters = new GenerateReactiveParameters();
public GenerateReactiveParameters GenerateReactiveParams => generateReactiveParameters;
@ -65,8 +75,8 @@ namespace FidelityFX
public Fsr2.GenerateReactiveFlags flags = Fsr2.GenerateReactiveFlags.ApplyTonemap | Fsr2.GenerateReactiveFlags.ApplyThreshold | Fsr2.GenerateReactiveFlags.UseComponentsMax;
}
[Header("Output resources")]
public RenderTexture outputColorDepth;
[Header("Output resources")]
[Tooltip("Optional render texture to copy motion vector data to, for additional post-processing after upscaling.")]
public RenderTexture outputMotionVectors;
private Fsr2Context _context;
@ -323,12 +333,11 @@ namespace FidelityFX
_context.Dispatch(_dispatchDescription, _dispatchCommandBuffer);
// Output the upscaled image
var outputTexture = GetOutputTexture();
if (outputTexture != null)
if (_originalRenderTarget != null)
{
// Output to the camera target texture, passing through depth and motion vectors
_dispatchCommandBuffer.SetGlobalTexture("_DepthTex", BuiltinRenderTextureType.CameraTarget, RenderTextureSubElement.Depth);
_dispatchCommandBuffer.Blit(Fsr2ShaderIDs.UavUpscaledOutput, outputTexture, _copyWithDepthMaterial);
_dispatchCommandBuffer.Blit(Fsr2ShaderIDs.UavUpscaledOutput, _originalRenderTarget, _copyWithDepthMaterial);
if (outputMotionVectors != null)
_dispatchCommandBuffer.Blit(BuiltinRenderTextureType.MotionVectors, outputMotionVectors);
}
@ -351,15 +360,12 @@ namespace FidelityFX
RenderTexture.active = dest;
}
private RenderTexture GetOutputTexture() => outputColorDepth != null ? outputColorDepth : _originalRenderTarget;
private RenderTextureFormat GetDefaultFormat() => _renderCamera.allowHDR ? RenderTextureFormat.DefaultHDR : RenderTextureFormat.Default;
private Vector2Int GetDisplaySize()
{
var outputTexture = GetOutputTexture();
if (outputTexture != null)
return new Vector2Int(outputTexture.width, outputTexture.height);
if (_originalRenderTarget != null)
return new Vector2Int(_originalRenderTarget.width, _originalRenderTarget.height);
return new Vector2Int(_renderCamera.pixelWidth, _renderCamera.pixelHeight);
}

Loading…
Cancel
Save