Class UniversalCameraData
Class that holds settings related to camera.
Inherited Members
Namespace: UnityEngine.Rendering.Universal
Assembly: Unity.RenderPipelines.Universal.Runtime.dll
Syntax
public class UniversalCameraData : ContextItem
Fields
allowHDROutput
True if this camera allow color conversion and encoding for high dynamic range displays.
Declaration
public bool allowHDROutput
Field Value
Type | Description |
---|---|
bool |
antialiasing
Controls the anti-aliasing mode used by the integrated post-processing stack.
When any other value other than AntialiasingMode.None
is chosen, a final post-processing pass will be applied to apply anti-aliasing.
This pass can be combined with dithering.
AntialiasingMode
isDitheringEnabled
Declaration
public AntialiasingMode antialiasing
Field Value
Type | Description |
---|---|
AntialiasingMode |
antialiasingQuality
Controls the anti-alising quality of the anti-aliasing mode. antialiasingQuality AntialiasingMode
Declaration
public AntialiasingQuality antialiasingQuality
Field Value
Type | Description |
---|---|
AntialiasingQuality |
backgroundColor
Final background color in the active color space.
Declaration
public Color backgroundColor
Field Value
Type | Description |
---|---|
Color |
baseCamera
Camera at the top of the overlay camera stack
Declaration
public Camera baseCamera
Field Value
Type | Description |
---|---|
Camera |
camera
The camera component.
Declaration
public Camera camera
Field Value
Type | Description |
---|---|
Camera |
cameraTargetDescriptor
Render texture settings used to create intermediate camera textures for rendering.
Declaration
public RenderTextureDescriptor cameraTargetDescriptor
Field Value
Type | Description |
---|---|
RenderTextureDescriptor |
cameraType
The camera type. CameraType
Declaration
public CameraType cameraType
Field Value
Type | Description |
---|---|
CameraType |
captureActions
Provides set actions to the renderer to be triggered at the end of the render loop for camera capture.
Declaration
public IEnumerator<Action<RenderTargetIdentifier, CommandBuffer>> captureActions
Field Value
Type | Description |
---|---|
IEnumerator<Action<RenderTargetIdentifier, CommandBuffer>> |
clearDepth
True if this camera should clear depth buffer. This setting only applies to cameras of type CameraRenderType.Overlay
CameraRenderType
Declaration
public bool clearDepth
Field Value
Type | Description |
---|---|
bool |
defaultOpaqueSortFlags
The sorting criteria used when drawing opaque objects by the internal URP render passes. When a GPU supports hidden surface removal, URP will rely on that information to avoid sorting opaque objects front to back and benefit for more optimal static batching.
Declaration
public SortingCriteria defaultOpaqueSortFlags
Field Value
Type | Description |
---|---|
SortingCriteria |
See Also
isAlphaOutputEnabled
True if this camera can write the alpha channel. Post-processing uses this. Requires the color target to have an alpha channel.
Declaration
public bool isAlphaOutputEnabled
Field Value
Type | Description |
---|---|
bool |
isDefaultViewport
True if this camera is drawing to a viewport that maps to the entire screen.
Declaration
public bool isDefaultViewport
Field Value
Type | Description |
---|---|
bool |
isDitheringEnabled
If set to true a final post-processing pass will be applied to apply dithering. This can be combined with post-processing antialiasing. antialiasing
Declaration
public bool isDitheringEnabled
Field Value
Type | Description |
---|---|
bool |
isHdrEnabled
True if this camera should render to high dynamic range color targets.
Declaration
public bool isHdrEnabled
Field Value
Type | Description |
---|---|
bool |
isStopNaNEnabled
If set to true, the integrated post-processing stack will replace any NaNs generated by render passes prior to post-processing with black/zero. Enabling this option will cause a noticeable performance impact. It should be used while in development mode to identify NaN issues.
Declaration
public bool isStopNaNEnabled
Field Value
Type | Description |
---|---|
bool |
maxShadowDistance
Maximum shadow distance visible to the camera. When set to zero shadows will be disable for that camera.
Declaration
public float maxShadowDistance
Field Value
Type | Description |
---|---|
float |
postProcessEnabled
True if post-processing is enabled for this camera.
Declaration
public bool postProcessEnabled
Field Value
Type | Description |
---|---|
bool |
postProcessingRequiresDepthTexture
Returns true if post processing passes require depth texture.
Declaration
public bool postProcessingRequiresDepthTexture
Field Value
Type | Description |
---|---|
bool |
renderScale
Render scale to apply when creating camera textures. Scaled extents are rounded down to integers.
Declaration
public float renderScale
Field Value
Type | Description |
---|---|
float |
renderType
The camera render type used for camera stacking. CameraRenderType
Declaration
public CameraRenderType renderType
Field Value
Type | Description |
---|---|
CameraRenderType |
renderer
Returns the current renderer used by this camera. ScriptableRenderer
Declaration
public ScriptableRenderer renderer
Field Value
Type | Description |
---|---|
ScriptableRenderer |
requiresDepthTexture
True if this camera requires to write _CameraDepthTexture.
Declaration
public bool requiresDepthTexture
Field Value
Type | Description |
---|---|
bool |
requiresOpaqueTexture
True if this camera requires to copy camera color texture to _CameraOpaqueTexture.
Declaration
public bool requiresOpaqueTexture
Field Value
Type | Description |
---|---|
bool |
resolveFinalTarget
True if this camera is resolving rendering to the final camera render target. When rendering a stack of cameras only the last camera in the stack will resolve to camera target.
Declaration
public bool resolveFinalTarget
Field Value
Type | Description |
---|---|
bool |
targetTexture
Controls the final target texture for a camera. If null camera will resolve rendering to screen.
Declaration
public RenderTexture targetTexture
Field Value
Type | Description |
---|---|
RenderTexture |
volumeLayerMask
The camera volume layer mask.
Declaration
public LayerMask volumeLayerMask
Field Value
Type | Description |
---|---|
LayerMask |
volumeTrigger
The camera volume trigger.
Declaration
public Transform volumeTrigger
Field Value
Type | Description |
---|---|
Transform |
worldSpaceCameraPos
Camera position in world space.
Declaration
public Vector3 worldSpaceCameraPos
Field Value
Type | Description |
---|---|
Vector3 |
xrRendering
Returns true if XR rendering is enabled.
Declaration
public bool xrRendering
Field Value
Type | Description |
---|---|
bool |
Properties
hdrDisplayColorGamut
HDR Display Color Gamut
Declaration
public ColorGamut hdrDisplayColorGamut { get; }
Property Value
Type | Description |
---|---|
ColorGamut |
hdrDisplayInformation
HDR Display information about the current display this camera is rendering to.
Declaration
public HDROutputUtils.HDRDisplayInformation hdrDisplayInformation { get; }
Property Value
Type | Description |
---|---|
HDROutputUtils.HDRDisplayInformation |
historyManager
The camera history texture manager. Used to access camera history from a ScriptableRenderPass.
Declaration
public UniversalCameraHistory historyManager { get; set; }
Property Value
Type | Description |
---|---|
UniversalCameraHistory |
See Also
isGameCamera
True if the camera rendering is for regular in-game.
Declaration
public bool isGameCamera { get; }
Property Value
Type | Description |
---|---|
bool |
isHDROutputActive
True if the Camera should output to an HDR display.
Declaration
public bool isHDROutputActive { get; }
Property Value
Type | Description |
---|---|
bool |
isPreviewCamera
True if the camera rendering is for the preview window in the editor.
Declaration
public bool isPreviewCamera { get; }
Property Value
Type | Description |
---|---|
bool |
isSceneViewCamera
True if the camera rendering is for the scene window in the editor.
Declaration
public bool isSceneViewCamera { get; }
Property Value
Type | Description |
---|---|
bool |
rendersOverlayUI
True if the Camera should render overlay UI.
Declaration
public bool rendersOverlayUI { get; }
Property Value
Type | Description |
---|---|
bool |
scaledHeight
Returns the scaled height of the Camera By obtaining the pixelHeight of the camera and taking into account the render scale The min dimension is 1.
Declaration
public int scaledHeight { get; }
Property Value
Type | Description |
---|---|
int |
scaledWidth
Returns the scaled width of the Camera By obtaining the pixelWidth of the camera and taking into account the render scale The min dimension is 1.
Declaration
public int scaledWidth { get; }
Property Value
Type | Description |
---|---|
int |
xr
XRPass holds the render target information and a list of XRView. XRView contains the parameters required to render (projection and view matrices, viewport, etc)
Declaration
public XRPass xr { get; }
Property Value
Type | Description |
---|---|
XRPass |
Methods
GetGPUProjectionMatrix(int)
Returns the camera GPU projection matrix. This contains platform specific changes to handle y-flip and reverse z. Includes camera jitter if required by active features.
Similar to GL.GetGPUProjectionMatrix
but queries URP internal state to know if the pipeline is rendering to render texture.
For more info on platform differences regarding camera projection check: https://docs.unity3d.com/Manual/SL-PlatformDifferences.html
Declaration
public Matrix4x4 GetGPUProjectionMatrix(int viewIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
int | viewIndex | View index in case of stereo rendering. By default |
Returns
Type | Description |
---|---|
Matrix4x4 |
See Also
GetGPUProjectionMatrixNoJitter(int)
Returns the camera GPU projection matrix. This contains platform specific changes to handle y-flip and reverse z. Does not include any camera jitter.
Similar to GL.GetGPUProjectionMatrix
but queries URP internal state to know if the pipeline is rendering to render texture.
For more info on platform differences regarding camera projection check: https://docs.unity3d.com/Manual/SL-PlatformDifferences.html
Declaration
public Matrix4x4 GetGPUProjectionMatrixNoJitter(int viewIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
int | viewIndex | View index in case of stereo rendering. By default |
Returns
Type | Description |
---|---|
Matrix4x4 |
See Also
GetProjectionMatrix(int)
Returns the camera projection matrix. Might be jittered for temporal features.
Declaration
public Matrix4x4 GetProjectionMatrix(int viewIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
int | viewIndex | View index in case of stereo rendering. By default |
Returns
Type | Description |
---|---|
Matrix4x4 | The camera projection matrix. |
GetViewMatrix(int)
Returns the camera view matrix.
Declaration
public Matrix4x4 GetViewMatrix(int viewIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
int | viewIndex | View index in case of stereo rendering. By default |
Returns
Type | Description |
---|---|
Matrix4x4 | The camera view matrix. |
IsCameraProjectionMatrixFlipped()
True if the camera device projection matrix is flipped. This happens when the pipeline is rendering to a render texture in non OpenGL platforms. If you are doing a custom Blit pass to copy camera textures (_CameraColorTexture, _CameraDepthAttachment) you need to check this flag to know if you should flip the matrix when rendering with for cmd.Draw* and reading from camera textures.
Declaration
public bool IsCameraProjectionMatrixFlipped()
Returns
Type | Description |
---|---|
bool | True if the camera device projection matrix is flipped. |
IsHandleYFlipped(RTHandle)
True is the handle has its content flipped on the y axis. This happens only with certain rendering APIs. On those platforms, any handle will have its content flipped unless rendering to a backbuffer, however, the scene view will always be flipped. When transitioning from a flipped space to a non-flipped space - or vice-versa - the content must be flipped in the shader: shouldPerformYFlip = IsHandleYFlipped(source) != IsHandleYFlipped(target)
Declaration
public bool IsHandleYFlipped(RTHandle handle)
Parameters
Type | Name | Description |
---|---|---|
RTHandle | handle | Handle to check the flipped status on. |
Returns
Type | Description |
---|---|
bool | True is the content is flipped in y. |
IsRenderTargetProjectionMatrixFlipped(RTHandle, RTHandle)
True if the render target's projection matrix is flipped. This happens when the pipeline is rendering to a render texture in non OpenGL platforms. If you are doing a custom Blit pass to copy camera textures (_CameraColorTexture, _CameraDepthAttachment) you need to check this flag to know if you should flip the matrix when rendering with for cmd.Draw* and reading from camera textures.
Declaration
public bool IsRenderTargetProjectionMatrixFlipped(RTHandle color, RTHandle depth = null)
Parameters
Type | Name | Description |
---|---|---|
RTHandle | color | Color render target to check whether the matrix is flipped. |
RTHandle | depth | Depth render target which is used if color is null. By default |
Returns
Type | Description |
---|---|
bool | True if the render target's projection matrix is flipped. |
Reset()
Resets the object so it can be used as a new instance next time it is created. To avoid memory allocations and generating garbage, the system reuses objects. This function should clear the object so it can be reused without leaking any information (e.g. pointers to objects that will no longer be valid to access). So it is important the implementation carefully clears all relevant members. Note that this is different from a Dispose or Destructor as the object in not freed but reset. This can be useful when havin large sub-allocated objects like arrays or lists which can be cleared and reused without re-allocating.
Declaration
public override void Reset()