Class HDAdditionalCameraData
Additional component that holds HDRP specific parameters for Cameras.
Namespace: UnityEngine.Rendering.HighDefinition
Syntax
public class HDAdditionalCameraData : MonoBehaviour, IFrameSettingsHistoryContainer, IDebugData, IVersionable<HDAdditionalCameraData.Version>
Fields
allowDynamicResolution
Allows dynamic resolution on buffers linked to this camera.
Declaration
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
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
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 |
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
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 |
taaSharpenStrength
Strength of the sharpening component of temporal anti-aliasing.
Declaration
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
public LayerMask volumeLayerMask
Field Value
| Type | Description |
|---|---|
| LayerMask |
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 |
|---|---|
| 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 |