Class HDAdditionalCameraData
Additional component that holds HDRP specific parameters for Cameras.
Inherited Members
Namespace: UnityEngine.Rendering.HighDefinition
Syntax
[HelpURL("https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@10.3/manual/HDRP-Camera.html")]
[AddComponentMenu("")]
[DisallowMultipleComponent]
[ExecuteAlways]
[RequireComponent(typeof(Camera))]
public class HDAdditionalCameraData : MonoBehaviour, IFrameSettingsHistoryContainer, IDebugData, IVersionable<HDAdditionalCameraData.Version>
Fields
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 |
---|---|
Boolean |
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 |
---|---|
Boolean |
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 |
---|---|
Boolean |
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 |
---|---|
Boolean |
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 |
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 |
---|---|
Boolean |
hasPersistentHistory
Enable to retain history buffers even if the camera is disabled.
Declaration
public bool hasPersistentHistory
Field Value
Type | Description |
---|---|
Boolean |
invertFaceCulling
Invert face culling.
Declaration
public bool invertFaceCulling
Field Value
Type | Description |
---|---|
Boolean |
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
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 |
SMAAQuality
Quality of the anti-aliasing when using SMAA.
Declaration
public HDAdditionalCameraData.SMAAQualityLevel SMAAQuality
Field Value
Type | Description |
---|---|
HDAdditionalCameraData.SMAAQualityLevel |
stopNaNs
Use a pass to eliminate NaNs contained in the color buffer before post-processing.
Declaration
public bool stopNaNs
Field Value
Type | Description |
---|---|
Boolean |
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(0F, 1F)]
public float taaAntiFlicker
Field Value
Type | Description |
---|---|
Single |
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 |
---|---|
Boolean |
taaHistorySharpening
Strength of the sharpening of the history sampled for TAA.
Declaration
[Range(0F, 1F)]
public float taaHistorySharpening
Field Value
Type | Description |
---|---|
Single |
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(0F, 1F)]
public float taaMotionVectorRejection
Field Value
Type | Description |
---|---|
Single |
TAAQuality
Quality of the anti-aliasing when using TAA.
Declaration
public HDAdditionalCameraData.TAAQualityLevel TAAQuality
Field Value
Type | Description |
---|---|
HDAdditionalCameraData.TAAQualityLevel |
taaSharpenStrength
Strength of the sharpening component of temporal anti-aliasing.
Declaration
[Range(0F, 2F)]
public float taaSharpenStrength
Field Value
Type | Description |
---|---|
Single |
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 |
---|---|
Boolean |
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 |
---|---|
Boolean |
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 |
---|---|
Boolean |
renderingPathCustomFrameSettings
Custom frame settings.
Declaration
public 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(HDAdditionalCameraData.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 |
---|---|
UnityEngine.Rendering.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 |
Explicit Interface Implementations
IVersionable<HDAdditionalCameraData.Version>.version
Declaration
HDAdditionalCameraData.Version IVersionable<HDAdditionalCameraData.Version>.version { get; set; }
Returns
Type | Description |
---|---|
HDAdditionalCameraData.Version |