Class HDAdditionalCameraData
Additional component that holds HDRP specific parameters for Cameras.
Inherited Members
Namespace: UnityEngine.Rendering.HighDefinition
Assembly: Unity.RenderPipelines.HighDefinition.Runtime.dll
Syntax
[AddComponentMenu("")]
[DisallowMultipleComponent]
[ExecuteAlways]
[RequireComponent(typeof(Camera))]
public class HDAdditionalCameraData : MonoBehaviour, IVersionable<HDAdditionalCameraData.Version>, IDebugData, IAdditionalData
Fields
SMAAQuality
Quality of the anti-aliasing when using SMAA.
Declaration
public HDAdditionalCameraData.SMAAQualityLevel SMAAQuality
Field Value
Type | Description |
---|---|
HDAdditionalCameraData.SMAAQualityLevel |
TAAQuality
Quality of the anti-aliasing when using TAA.
Declaration
public HDAdditionalCameraData.TAAQualityLevel TAAQuality
Field Value
Type | Description |
---|---|
HDAdditionalCameraData.TAAQualityLevel |
allowDeepLearningSuperSampling
Allow NVIDIA Deep Learning Super Sampling (DLSS) on this camera.
Declaration
[Tooltip("Allow NVIDIA Deep Learning Super Sampling (DLSS) on this camera")]
public bool allowDeepLearningSuperSampling
Field Value
Type | Description |
---|---|
bool |
allowDynamicResolution
Allows dynamic resolution on buffers linked to this camera.
Declaration
[Tooltip("Allows dynamic resolution on buffers linked to this camera.")]
public bool allowDynamicResolution
Field Value
Type | Description |
---|---|
bool |
antialiasing
Anti-aliasing mode.
Declaration
public HDAdditionalCameraData.AntialiasingMode antialiasing
Field Value
Type | Description |
---|---|
HDAdditionalCameraData.AntialiasingMode |
backgroundColorHDR
HDR color used for clearing the camera background.
Declaration
[ColorUsage(true, true)]
public Color backgroundColorHDR
Field Value
Type | Description |
---|---|
Color |
clearColorMode
Clear mode for the camera background.
Declaration
public HDAdditionalCameraData.ClearColorMode clearColorMode
Field Value
Type | Description |
---|---|
HDAdditionalCameraData.ClearColorMode |
clearDepth
Clear depth as well as color.
Declaration
public bool clearDepth
Field Value
Type | Description |
---|---|
bool |
customRenderingSettings
Allows you to override the default frame settings for this camera.
Declaration
[Tooltip("Allows you to override the default settings for this camera.")]
public bool customRenderingSettings
Field Value
Type | Description |
---|---|
bool |
deepLearningSuperSamplingQuality
Selects a performance quality setting for NVIDIA Deep Learning Super Sampling (DLSS) for this camera of this project.
Declaration
[Tooltip("Selects a performance quality setting for NVIDIA Deep Learning Super Sampling (DLSS) for this camera of this project.")]
public uint deepLearningSuperSamplingQuality
Field Value
Type | Description |
---|---|
uint |
deepLearningSuperSamplingSharpening
Sets the Sharpening value for NVIDIA Deep Learning Super Sampling (DLSS) for this camera.
Declaration
[Tooltip("Sets the Sharpening value for NVIDIA Deep Learning Super Sampling (DLSS) for this camera.")]
[Range(0, 1)]
public float deepLearningSuperSamplingSharpening
Field Value
Type | Description |
---|---|
float |
deepLearningSuperSamplingUseCustomAttributes
If set to true, NVIDIA Deep Learning Super Sampling (DLSS) will utilize the Quality setting set on this camera instead of the one specified in the quality asset of this project.
Declaration
[Tooltip("If set to true, NVIDIA Deep Learning Super Sampling (DLSS) will utilize the attributes (Optimal Settings and Sharpness) specified on this camera, instead of the ones specified in the quality asset of this project.")]
public bool deepLearningSuperSamplingUseCustomAttributes
Field Value
Type | Description |
---|---|
bool |
deepLearningSuperSamplingUseCustomQualitySettings
If set to true, NVIDIA Deep Learning Super Sampling (DLSS) will utilize the Quality setting set on this camera instead of the one specified in the quality asset.
Declaration
[Tooltip("If set to true, NVIDIA Deep Learning Super Sampling (DLSS) will utilize the Quality setting set on this camera instead of the one specified in the quality asset.")]
public bool deepLearningSuperSamplingUseCustomQualitySettings
Field Value
Type | Description |
---|---|
bool |
deepLearningSuperSamplingUseOptimalSettings
Sets the sharpness and scale automatically for NVIDIA Deep Learning Super Sampling (DLSS) for this camera, depending on the values of quality settings.
Declaration
[Tooltip("Sets the sharpness and scale automatically for NVIDIA Deep Learning Super Sampling (DLSS) for this camera, depending on the values of quality settings.")]
public bool deepLearningSuperSamplingUseOptimalSettings
Field Value
Type | Description |
---|---|
bool |
defaultFrameSettings
When using default frame settings, specify which type of frame settings to use.
Declaration
public FrameSettingsRenderType defaultFrameSettings
Field Value
Type | Description |
---|---|
FrameSettingsRenderType |
dithering
Use dithering to filter out minor banding.
Declaration
public bool dithering
Field Value
Type | Description |
---|---|
bool |
exposureTarget
The object used as a target for centering the Exposure's Procedural Mask metering mode when target object option is set (See Exposure Volume Component).
Declaration
public GameObject exposureTarget
Field Value
Type | Description |
---|---|
GameObject |
flipYMode
Vertical flip mode.
Declaration
public HDAdditionalCameraData.FlipYMode flipYMode
Field Value
Type | Description |
---|---|
HDAdditionalCameraData.FlipYMode |
fsrOverrideSharpness
If set to true, AMD FidelityFX Super Resolution (FSR) will utilize the sharpness setting set on this camera instead of the one specified in the quality asset.
Declaration
[Tooltip("If set to true, AMD FidelityFX Super Resolution (FSR) will utilize the sharpness setting set on this camera instead of the one specified in the quality asset.")]
public bool fsrOverrideSharpness
Field Value
Type | Description |
---|---|
bool |
fsrSharpness
Sets this camera's sharpness value for AMD FidelityFX Super Resolution.
Declaration
[Tooltip("Sets this camera's sharpness value for AMD FidelityFX Super Resolution 1.0 (FSR).")]
[Range(0, 1)]
public float fsrSharpness
Field Value
Type | Description |
---|---|
float |
fullscreenPassthrough
Skips rendering settings to directly render in fullscreen (Useful for video).
Declaration
[Tooltip("Skips rendering settings to directly render in fullscreen (Useful for video).")]
public bool fullscreenPassthrough
Field Value
Type | Description |
---|---|
bool |
hasPersistentHistory
Enable to retain history buffers even if the camera is disabled.
Declaration
public bool hasPersistentHistory
Field Value
Type | Description |
---|---|
bool |
invertFaceCulling
Invert face culling.
Declaration
public bool invertFaceCulling
Field Value
Type | Description |
---|---|
bool |
materialMipBias
Mip bias used on texture samplers during material rendering
Declaration
public float materialMipBias
Field Value
Type | Description |
---|---|
float |
nonObliqueProjectionGetter
Specify a custom getter for non oblique projection matrix.
Declaration
public HDAdditionalCameraData.NonObliqueProjectionGetter nonObliqueProjectionGetter
Field Value
Type | Description |
---|---|
HDAdditionalCameraData.NonObliqueProjectionGetter |
physicalParameters
Physical camera parameters.
Declaration
[Obsolete("Physical camera properties have been migrated to Camera.", false)]
public HDPhysicalCamera physicalParameters
Field Value
Type | Description |
---|---|
HDPhysicalCamera |
probeLayerMask
Probe layer mask.
Declaration
public LayerMask probeLayerMask
Field Value
Type | Description |
---|---|
LayerMask |
renderingPathCustomFrameSettingsOverrideMask
Mask specifying which frame settings are overridden when using custom frame settings.
Declaration
public FrameSettingsOverrideMask renderingPathCustomFrameSettingsOverrideMask
Field Value
Type | Description |
---|---|
FrameSettingsOverrideMask |
screenCoordScaleBias
Transform used when Screen Coordinates Override is active.
Declaration
public Vector4 screenCoordScaleBias
Field Value
Type | Description |
---|---|
Vector4 |
screenSizeOverride
Screen size used when Screen Coordinates Override is active.
Declaration
public Vector4 screenSizeOverride
Field Value
Type | Description |
---|---|
Vector4 |
stopNaNs
Use a pass to eliminate NaNs contained in the color buffer before post-processing.
Declaration
public bool stopNaNs
Field Value
Type | Description |
---|---|
bool |
taaAntiFlicker
Drive the anti-flicker mechanism. With high values flickering might be reduced, but it can lead to more ghosting or disocclusion artifacts.
Declaration
[Range(0, 1)]
public float taaAntiFlicker
Field Value
Type | Description |
---|---|
float |
taaAntiHistoryRinging
When enabled, ringing artifacts (dark or strangely saturated edges) caused by history sharpening will be improved. This comes at a potential loss of sharpness upon motion.
Declaration
public bool taaAntiHistoryRinging
Field Value
Type | Description |
---|---|
bool |
taaBaseBlendFactor
Determines how much the history buffer is blended together with current frame result. Higher values means more history contribution.
Declaration
[Range(0.6, 0.95)]
public float taaBaseBlendFactor
Field Value
Type | Description |
---|---|
float |
taaHistorySharpening
Strength of the sharpening of the history sampled for TAA.
Declaration
[Range(0, 1)]
public float taaHistorySharpening
Field Value
Type | Description |
---|---|
float |
taaJitterScale
Scale to apply to the jittering applied when TAA is enabled.
Declaration
[Range(0.1, 1)]
public float taaJitterScale
Field Value
Type | Description |
---|---|
float |
taaMotionVectorRejection
Larger is this value, more likely history will be rejected when current and reprojected history motion vector differ by a substantial amount. Larger values can decrease ghosting but will also reintroduce aliasing on the aforementioned cases.
Declaration
[Range(0, 1)]
public float taaMotionVectorRejection
Field Value
Type | Description |
---|---|
float |
taaSharpenStrength
Strength of the sharpening component of temporal anti-aliasing.
Declaration
[Range(0, 2)]
public float taaSharpenStrength
Field Value
Type | Description |
---|---|
float |
volumeAnchorOverride
Optional transform override for the position where volumes are interpolated.
Declaration
public Transform volumeAnchorOverride
Field Value
Type | Description |
---|---|
Transform |
volumeLayerMask
Layer mask used to select which volumes will influence this camera.
Declaration
[Tooltip("LayerMask HDRP uses for Volume interpolation for this Camera.")]
public LayerMask volumeLayerMask
Field Value
Type | Description |
---|---|
LayerMask |
xrRendering
Enable XR rendering.
Declaration
public bool xrRendering
Field Value
Type | Description |
---|---|
bool |
Properties
aovRequests
Use this property to get the aov requests.
It is never null.
Declaration
public IEnumerable<AOVRequestData> aovRequests { get; }
Property Value
Type | Description |
---|---|
IEnumerable<AOVRequestData> |
hasCustomRender
True if any Custom Render event is registered for this camera.
Declaration
public bool hasCustomRender { get; }
Property Value
Type | Description |
---|---|
bool |
isEditorCameraPreview
Unity support two type of preview: Camera preview and material preview. This property allow to know that we are an editor camera preview when the type is preview.
Declaration
public bool isEditorCameraPreview { get; }
Property Value
Type | Description |
---|---|
bool |
renderingPathCustomFrameSettings
Custom frame settings.
Declaration
public ref FrameSettings renderingPathCustomFrameSettings { get; }
Property Value
Type | Description |
---|---|
FrameSettings |
Methods
CopyTo(HDAdditionalCameraData)
Copy HDAdditionalCameraData.
Declaration
public void CopyTo(HDAdditionalCameraData data)
Parameters
Type | Name | Description |
---|---|---|
HDAdditionalCameraData | data | Component to copy to. |
GetGraphicsBuffer(BufferAccessType)
Returns the requested graphics buffer. Users should use the requestGraphicsBuffer event to make sure that the required buffers are requested first. Note that depending on the current frame settings some buffers may not be available.
Declaration
public RTHandle GetGraphicsBuffer(HDAdditionalCameraData.BufferAccessType type)
Parameters
Type | Name | Description |
---|---|---|
HDAdditionalCameraData.BufferAccessType | type | Type of the requested buffer. |
Returns
Type | Description |
---|---|
RTHandle | Requested buffer as a RTHandle. Can be null if the buffer is not available. |
GetNonObliqueProjection(Camera)
Returns the non oblique projection matrix for this camera.
Declaration
public Matrix4x4 GetNonObliqueProjection(Camera camera)
Parameters
Type | Name | Description |
---|---|---|
Camera | camera | Requested camera. |
Returns
Type | Description |
---|---|
Matrix4x4 | The non oblique projection matrix for this camera. |
SetAOVRequests(AOVRequestDataCollection)
Set AOV requests to use.
Declaration
public void SetAOVRequests(AOVRequestDataCollection aovRequests)
Parameters
Type | Name | Description |
---|---|---|
AOVRequestDataCollection | aovRequests | Describes the requests to execute. |
Examples
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.Rendering.HighDefinition.Attributes;
[ExecuteAlways]
[RequireComponent(typeof(Camera))]
[RequireComponent(typeof(HDAdditionalCameraData))]
public class SetupAOVCallbacks : MonoBehaviour
{
private static RTHandle m_ColorRT;
[SerializeField] private Texture m_Target;
[SerializeField] private DebugFullScreen m_DebugFullScreen;
[SerializeField] private DebugLightFilterMode m_DebugLightFilter;
[SerializeField] private MaterialSharedProperty m_MaterialSharedProperty;
[SerializeField] private LightingProperty m_LightingProperty;
[SerializeField] private AOVBuffers m_BuffersToCopy;
[SerializeField] private List<GameObject> m_IncludedLights;
void OnEnable()
{
var aovRequest = new AOVRequest(AOVRequest.NewDefault())
.SetLightFilter(m_DebugLightFilter);
if (m_DebugFullScreen != DebugFullScreen.None)
aovRequest = aovRequest.SetFullscreenOutput(m_DebugFullScreen);
if (m_MaterialSharedProperty != MaterialSharedProperty.None)
aovRequest = aovRequest.SetFullscreenOutput(m_MaterialSharedProperty);
if (m_LightingProperty != LightingProperty.None)
aovRequest = aovRequest.SetFullscreenOutput(m_LightingProperty);
var add = GetComponent<HDAdditionalCameraData>();
add.SetAOVRequests(
new AOVRequestBuilder()
.Add(
aovRequest,
bufferId => m_ColorRT ?? (m_ColorRT = RTHandles.Alloc(512, 512)),
m_IncludedLights.Count > 0 ? m_IncludedLights : null,
new []{ m_BuffersToCopy },
(cmd, textures, properties) =>
{
if (m_Target != null)
cmd.Blit(textures[0], m_Target);
})
.Build()
);
}
private void OnGUI()
{
GUI.DrawTexture(new Rect(10, 10, 512, 256), m_Target);
}
void OnDisable()
{
var add = GetComponent<HDAdditionalCameraData>();
add.SetAOVRequests(null);
}
void OnValidate()
{
OnDisable();
OnEnable();
}
}
Example use case:
- Export Normals: use MaterialSharedProperty.Normals and AOVBuffers.Color
- Export Color before post processing: use AOVBuffers.Color
- Export Color after post processing: use AOVBuffers.Output
- Export Depth stencil: use AOVBuffers.DepthStencil
- Export AO: use MaterialSharedProperty.AmbientOcclusion and AOVBuffers.Color
Events
customRender
Event used to override HDRP rendering for this particular camera.
Declaration
public event Action<ScriptableRenderContext, HDCamera> customRender
Event Type
Type | Description |
---|---|
Action<ScriptableRenderContext, HDCamera> |
requestGraphicsBuffer
RequestAccessDelegate used to request access to various buffers of this camera.
Declaration
public event HDAdditionalCameraData.RequestAccessDelegate requestGraphicsBuffer
Event Type
Type | Description |
---|---|
HDAdditionalCameraData.RequestAccessDelegate |