diff --git a/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Drawers.cs b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Drawers.cs
new file mode 100644
index 00000000000..bb953c818c8
--- /dev/null
+++ b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Drawers.cs
@@ -0,0 +1,166 @@
+using System.Linq;
+using UnityEngine;
+
+namespace UnityEditor.Rendering
+{
+ /// Camera UI Shared Properties among SRP
+ public static partial class CameraUI
+ {
+ /// Enum to store know the expanded state of a expandable section on the camera inspector
+ public enum Expandable
+ {
+ /// Projection
+ Projection = 1 << 0,
+ /// Physical
+ Physical = 1 << 1,
+ /// Output
+ Output = 1 << 2,
+ /// Orthographic
+ Orthographic = 1 << 3,
+ /// RenderLoop
+ RenderLoop = 1 << 4,
+ /// Rendering
+ Rendering = 1 << 5,
+ /// Environment
+ Environment = 1 << 6,
+ }
+
+ /// Camera Projection type
+ public enum ProjectionType
+ {
+ /// Perspective
+ Perspective,
+ /// Orthographic
+ Orthographic
+ }
+
+ /// Camera Projection matrix mode
+ public enum ProjectionMatrixMode
+ {
+ /// Explicit
+ Explicit,
+ /// Implicit
+ Implicit,
+ /// PhysicalPropertiesBased
+ PhysicalPropertiesBased,
+ }
+
+ static bool s_FovChanged;
+ static float s_FovLastValue;
+
+ /// Draws projection related fields on the inspector
+ /// The serialized camera
+ /// The editor owner calling this drawer
+ public static void Drawer_Projection(ISerializedCamera p, Editor owner)
+ {
+ // Most of this is replicated from CameraEditor.DrawProjection as we don't want to draw
+ // it the same way it's done in non-SRP cameras. Unfortunately, because a lot of the
+ // code is internal, we have to copy/paste some stuff from the editor code :(
+
+ var cam = p.baseCameraSettings;
+
+ Rect perspectiveRect = EditorGUILayout.GetControlRect();
+
+ ProjectionType projectionType;
+ EditorGUI.BeginProperty(perspectiveRect, Styles.projectionContent, cam.orthographic);
+ {
+ projectionType = cam.orthographic.boolValue ? ProjectionType.Orthographic : ProjectionType.Perspective;
+
+ EditorGUI.BeginChangeCheck();
+ projectionType = (ProjectionType)EditorGUI.EnumPopup(perspectiveRect, Styles.projectionContent, projectionType);
+ if (EditorGUI.EndChangeCheck())
+ cam.orthographic.boolValue = (projectionType == ProjectionType.Orthographic);
+ }
+ EditorGUI.EndProperty();
+
+ if (cam.orthographic.hasMultipleDifferentValues)
+ return;
+
+ if (projectionType == ProjectionType.Orthographic)
+ {
+ EditorGUILayout.PropertyField(cam.orthographicSize, Styles.sizeContent);
+ }
+ else
+ {
+ float fovCurrentValue;
+ bool multipleDifferentFovValues = false;
+ bool isPhysicalCamera = p.projectionMatrixMode.intValue == (int)ProjectionMatrixMode.PhysicalPropertiesBased;
+
+ var rect = EditorGUILayout.GetControlRect();
+
+ var guiContent = EditorGUI.BeginProperty(rect, Styles.FOVAxisModeContent, cam.fovAxisMode);
+ EditorGUI.showMixedValue = cam.fovAxisMode.hasMultipleDifferentValues;
+
+ EditorGUI.BeginChangeCheck();
+ var fovAxisNewVal = (int)(Camera.FieldOfViewAxis)EditorGUI.EnumPopup(rect, guiContent, (Camera.FieldOfViewAxis)cam.fovAxisMode.intValue);
+ if (EditorGUI.EndChangeCheck())
+ cam.fovAxisMode.intValue = fovAxisNewVal;
+ EditorGUI.EndProperty();
+
+ bool fovAxisVertical = cam.fovAxisMode.intValue == 0;
+
+ if (!fovAxisVertical && !cam.fovAxisMode.hasMultipleDifferentValues)
+ {
+ var targets = p.serializedObject.targetObjects;
+ var camera0 = targets[0] as Camera;
+ float aspectRatio = isPhysicalCamera ? cam.sensorSize.vector2Value.x / cam.sensorSize.vector2Value.y : camera0.aspect;
+ // camera.aspect is not serialized so we have to check all targets.
+ fovCurrentValue = Camera.VerticalToHorizontalFieldOfView(camera0.fieldOfView, aspectRatio);
+ if (targets.Cast().Any(camera => camera.fieldOfView != fovCurrentValue))
+ multipleDifferentFovValues = true;
+ }
+ else
+ {
+ fovCurrentValue = cam.verticalFOV.floatValue;
+ multipleDifferentFovValues = cam.fovAxisMode.hasMultipleDifferentValues;
+ }
+
+ EditorGUI.showMixedValue = multipleDifferentFovValues;
+ var content = EditorGUI.BeginProperty(EditorGUILayout.BeginHorizontal(), Styles.fieldOfViewContent, cam.verticalFOV);
+ EditorGUI.BeginDisabledGroup(p.projectionMatrixMode.hasMultipleDifferentValues || isPhysicalCamera && (cam.sensorSize.hasMultipleDifferentValues || cam.fovAxisMode.hasMultipleDifferentValues));
+ EditorGUI.BeginChangeCheck();
+ s_FovLastValue = EditorGUILayout.Slider(content, fovCurrentValue, 0.00001f, 179f);
+ s_FovChanged = EditorGUI.EndChangeCheck();
+ EditorGUI.EndDisabledGroup();
+ EditorGUILayout.EndHorizontal();
+ EditorGUI.EndProperty();
+ EditorGUI.showMixedValue = false;
+
+ content = EditorGUI.BeginProperty(EditorGUILayout.BeginHorizontal(), Styles.physicalCameraContent, p.projectionMatrixMode);
+ EditorGUI.showMixedValue = p.projectionMatrixMode.hasMultipleDifferentValues;
+
+ EditorGUI.BeginChangeCheck();
+ isPhysicalCamera = EditorGUILayout.Toggle(content, isPhysicalCamera);
+ if (EditorGUI.EndChangeCheck())
+ p.projectionMatrixMode.intValue = isPhysicalCamera ? (int)ProjectionMatrixMode.PhysicalPropertiesBased : (int)ProjectionMatrixMode.Implicit;
+ EditorGUILayout.EndHorizontal();
+ EditorGUI.EndProperty();
+
+ EditorGUI.showMixedValue = false;
+ if (s_FovChanged && (!isPhysicalCamera || p.projectionMatrixMode.hasMultipleDifferentValues))
+ {
+ cam.verticalFOV.floatValue = fovAxisVertical
+ ? s_FovLastValue
+ : Camera.HorizontalToVerticalFieldOfView(s_FovLastValue, (p.serializedObject.targetObjects[0] as Camera).aspect);
+ }
+ else if (s_FovChanged && isPhysicalCamera && !p.projectionMatrixMode.hasMultipleDifferentValues)
+ {
+ cam.verticalFOV.floatValue = fovAxisVertical
+ ? s_FovLastValue
+ : Camera.HorizontalToVerticalFieldOfView(s_FovLastValue, (p.serializedObject.targetObjects[0] as Camera).aspect);
+ }
+ }
+ }
+
+ /// Draws clippling planes related fields on the inspector
+ /// The serialized camera
+ /// The editor owner calling this drawer
+ public static void Drawer_FieldClippingPlanes(ISerializedCamera p, Editor owner)
+ {
+ CoreEditorUtils.DrawMultipleFields(
+ Styles.clippingPlaneMultiFieldTitle,
+ new[] { p.baseCameraSettings.nearClippingPlane, p.baseCameraSettings.farClippingPlane },
+ new[] { Styles.nearPlaneContent, Styles.farPlaneContent });
+ }
+ }
+}
diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Skin.cs.meta b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Drawers.cs.meta
similarity index 83%
rename from com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Skin.cs.meta
rename to com.unity.render-pipelines.core/Editor/Camera/CameraUI.Drawers.cs.meta
index dcee740944b..536a110528f 100644
--- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Skin.cs.meta
+++ b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Drawers.cs.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: 97b4d7e55cbca7b4cb8bbc4d28c036f2
+guid: a0d2633fc585aec4a8a89a6014bd7640
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Environment.Drawers.cs b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Environment.Drawers.cs
new file mode 100644
index 00000000000..23a9a7051d2
--- /dev/null
+++ b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Environment.Drawers.cs
@@ -0,0 +1,20 @@
+namespace UnityEditor.Rendering
+{
+ /// Camera UI Shared Properties among SRP
+ public static partial class CameraUI
+ {
+ ///
+ /// Environment Section
+ ///
+ public static partial class Environment
+ {
+ /// Draws layer mask planes related fields on the inspector
+ /// The serialized camera
+ /// The editor owner calling this drawer
+ public static void Drawer_Environment_VolumeLayerMask(ISerializedCamera p, Editor owner)
+ {
+ EditorGUILayout.PropertyField(p.volumeLayerMask, Styles.volumeLayerMask);
+ }
+ }
+ }
+}
diff --git a/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Environment.Drawers.cs.meta b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Environment.Drawers.cs.meta
new file mode 100644
index 00000000000..767eb6a99ed
--- /dev/null
+++ b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Environment.Drawers.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 40b2b7ce6c436184b91d2d7ea4ef35ce
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Environment.Skin.cs b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Environment.Skin.cs
new file mode 100644
index 00000000000..5d810f9c6c6
--- /dev/null
+++ b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Environment.Skin.cs
@@ -0,0 +1,30 @@
+using UnityEngine;
+
+namespace UnityEditor.Rendering
+{
+ /// Camera UI Shared Properties among SRP
+ public static partial class CameraUI
+ {
+ ///
+ /// Environment section
+ ///
+ public static partial class Environment
+ {
+ ///
+ /// Styles
+ ///
+ public static class Styles
+ {
+ ///
+ /// Header of the section
+ ///
+ public static readonly GUIContent header = EditorGUIUtility.TrTextContent("Environment", "These settings control what the camera background looks like.");
+
+ ///
+ /// Volume layer mask content
+ ///
+ public static readonly GUIContent volumeLayerMask = EditorGUIUtility.TrTextContent("Volume Mask", "This camera will only be affected by volumes in the selected scene-layers.");
+ }
+ }
+ }
+}
diff --git a/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Environment.Skin.cs.meta b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Environment.Skin.cs.meta
new file mode 100644
index 00000000000..74ac3be5d2b
--- /dev/null
+++ b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Environment.Skin.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c94bc25276e67ea429b40e3228a39b05
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Output.Drawers.cs b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Output.Drawers.cs
new file mode 100644
index 00000000000..e94903a4af5
--- /dev/null
+++ b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Output.Drawers.cs
@@ -0,0 +1,45 @@
+namespace UnityEditor.Rendering
+{
+ /// Camera UI Shared Properties among SRP
+ public static partial class CameraUI
+ {
+ ///
+ /// Output Section
+ ///
+ public static partial class Output
+ {
+ /// Draws Allow Dynamic Resolution related fields on the inspector
+ /// The serialized camera
+ /// The editor owner calling this drawer
+ public static void Drawer_Output_AllowDynamicResolution(ISerializedCamera p, Editor owner)
+ {
+ EditorGUILayout.PropertyField(p.allowDynamicResolution, Styles.allowDynamicResolution);
+ p.baseCameraSettings.allowDynamicResolution.boolValue = p.allowDynamicResolution.boolValue;
+ }
+
+ /// Draws Normalized ViewPort related fields on the inspector
+ /// The serialized camera
+ /// The editor owner calling this drawer
+ public static void Drawer_Output_NormalizedViewPort(ISerializedCamera p, Editor owner)
+ {
+ EditorGUILayout.PropertyField(p.baseCameraSettings.normalizedViewPortRect, Styles.viewport);
+ }
+
+ /// Draws Depth related fields on the inspector
+ /// The serialized camera
+ /// The editor owner calling this drawer
+ public static void Drawer_Output_Depth(ISerializedCamera p, Editor owner)
+ {
+ EditorGUILayout.PropertyField(p.baseCameraSettings.depth, Styles.depth);
+ }
+
+ /// Draws Render Target related fields on the inspector
+ /// The serialized camera
+ /// The editor owner calling this drawer
+ public static void Drawer_Output_RenderTarget(ISerializedCamera p, Editor owner)
+ {
+ EditorGUILayout.PropertyField(p.baseCameraSettings.targetTexture);
+ }
+ }
+ }
+}
diff --git a/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Output.Drawers.cs.meta b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Output.Drawers.cs.meta
new file mode 100644
index 00000000000..d0cd2624e7d
--- /dev/null
+++ b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Output.Drawers.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c77d1122a4e2ed448966b1535f9f1130
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Output.Skin.cs b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Output.Skin.cs
new file mode 100644
index 00000000000..a2f160e373b
--- /dev/null
+++ b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Output.Skin.cs
@@ -0,0 +1,47 @@
+using UnityEngine;
+
+namespace UnityEditor.Rendering
+{
+ /// Camera UI Shared Properties among SRP
+ public static partial class CameraUI
+ {
+ ///
+ /// Output section
+ ///
+ public static partial class Output
+ {
+ ///
+ /// Styles
+ ///
+ public static class Styles
+ {
+ ///
+ /// Header of the section
+ ///
+ public static readonly GUIContent header = EditorGUIUtility.TrTextContent("Output", "These settings control how the camera output is formatted.");
+
+#if ENABLE_MULTIPLE_DISPLAYS
+ ///
+ /// Target display content
+ ///
+ public static readonly GUIContent targetDisplay = EditorGUIUtility.TrTextContent("Target Display");
+#endif
+
+ ///
+ /// Viewport
+ ///
+ public static readonly GUIContent viewport = EditorGUIUtility.TrTextContent("Viewport Rect", "Four values that indicate where on the screen HDRP draws this Camera view. Measured in Viewport Coordinates (values in the range of [0, 1]).");
+
+ ///
+ /// Allow dynamic resolution content
+ ///
+ public static readonly GUIContent allowDynamicResolution = EditorGUIUtility.TrTextContent("Allow Dynamic Resolution", "Whether to support dynamic resolution.");
+
+ ///
+ /// Depth content
+ ///
+ public static readonly GUIContent depth = EditorGUIUtility.TrTextContent("Depth");
+ }
+ }
+ }
+}
diff --git a/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Output.Skin.cs.meta b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Output.Skin.cs.meta
new file mode 100644
index 00000000000..ceb82e89842
--- /dev/null
+++ b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Output.Skin.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: f82f0aee4a6afa04f86310b233ea3d66
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/com.unity.render-pipelines.core/Editor/Camera/CameraUI.PhysicalCamera.Drawers.cs b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.PhysicalCamera.Drawers.cs
new file mode 100644
index 00000000000..8f211b34230
--- /dev/null
+++ b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.PhysicalCamera.Drawers.cs
@@ -0,0 +1,124 @@
+using System;
+using System.Runtime.CompilerServices;
+using UnityEngine;
+
+namespace UnityEditor.Rendering
+{
+ /// Camera UI Shared Properties among SRP
+ public static partial class CameraUI
+ {
+ ///
+ /// Physical camera related drawers
+ ///
+ public static partial class PhysicalCamera
+ {
+ // Saves the value of the sensor size when the user switches from "custom" size to a preset per camera.
+ // We use a ConditionalWeakTable instead of a Dictionary to avoid keeping alive (with strong references) deleted cameras
+ static ConditionalWeakTable s_PerCameraSensorSizeHistory = new ConditionalWeakTable();
+
+ /// Draws Body Sensor related fields on the inspector
+ /// The serialized camera
+ /// The editor owner calling this drawer
+ public static void Drawer_PhysicalCamera_CameraBody_Sensor(ISerializedCamera p, Editor owner)
+ {
+ var cam = p.baseCameraSettings;
+ EditorGUI.BeginChangeCheck();
+
+ int oldFilmGateIndex = Array.IndexOf(Styles.apertureFormatValues, new Vector2((float)Math.Round(cam.sensorSize.vector2Value.x, 3), (float)Math.Round(cam.sensorSize.vector2Value.y, 3)));
+
+ // If it is not one of the preset sizes, set it to custom
+ oldFilmGateIndex = (oldFilmGateIndex == -1) ? Styles.customPresetIndex : oldFilmGateIndex;
+
+ // Get the new user selection
+ int newFilmGateIndex = EditorGUILayout.Popup(Styles.sensorType, oldFilmGateIndex, Styles.apertureFormatNames);
+
+ if (EditorGUI.EndChangeCheck())
+ {
+ // Retrieve the previous custom size value, if one exists for this camera
+ object previousCustomValue;
+ s_PerCameraSensorSizeHistory.TryGetValue((Camera)p.serializedObject.targetObject, out previousCustomValue);
+
+ // When switching from custom to a preset, update the last custom value (to display again, in case the user switches back to custom)
+ if (oldFilmGateIndex == Styles.customPresetIndex)
+ {
+ if (previousCustomValue == null)
+ {
+ s_PerCameraSensorSizeHistory.Add((Camera)p.serializedObject.targetObject, cam.sensorSize.vector2Value);
+ }
+ else
+ {
+ previousCustomValue = cam.sensorSize.vector2Value;
+ }
+ }
+
+ if (newFilmGateIndex < Styles.customPresetIndex)
+ {
+ cam.sensorSize.vector2Value = Styles.apertureFormatValues[newFilmGateIndex];
+ }
+ else
+ {
+ // The user switched back to custom, so display by deafulr the previous custom value
+ if (previousCustomValue != null)
+ {
+ cam.sensorSize.vector2Value = (Vector2)previousCustomValue;
+ }
+ else
+ {
+ cam.sensorSize.vector2Value = new Vector2(36.0f, 24.0f); // this is the value new cameras are created with
+ }
+ }
+ }
+
+ EditorGUILayout.PropertyField(cam.sensorSize, Styles.sensorSize);
+ }
+
+ /// Draws Gate fit related fields on the inspector
+ /// The serialized camera
+ /// The editor owner calling this drawer
+ public static void Drawer_PhysicalCamera_CameraBody_GateFit(ISerializedCamera p, Editor owner)
+ {
+ var cam = p.baseCameraSettings;
+
+ using (var horizontal = new EditorGUILayout.HorizontalScope())
+ using (var propertyScope = new EditorGUI.PropertyScope(horizontal.rect, Styles.gateFit, cam.gateFit))
+ using (var checkScope = new EditorGUI.ChangeCheckScope())
+ {
+ int gateValue = (int)(Camera.GateFitMode)EditorGUILayout.EnumPopup(propertyScope.content, (Camera.GateFitMode)cam.gateFit.intValue);
+ if (checkScope.changed)
+ cam.gateFit.intValue = gateValue;
+ }
+ }
+
+ /// Draws Focal Length related fields on the inspector
+ /// The serialized camera
+ /// The editor owner calling this drawer
+ public static void Drawer_PhysicalCamera_Lens_FocalLength(ISerializedCamera p, Editor owner)
+ {
+ var cam = p.baseCameraSettings;
+
+ using (var horizontal = new EditorGUILayout.HorizontalScope())
+ using (new EditorGUI.PropertyScope(horizontal.rect, Styles.focalLength, cam.focalLength))
+ using (var checkScope = new EditorGUI.ChangeCheckScope())
+ {
+ bool isPhysical = p.projectionMatrixMode.intValue == (int)CameraUI.ProjectionMatrixMode.PhysicalPropertiesBased;
+ // We need to update the focal length if the camera is physical and the FoV has changed.
+ bool focalLengthIsDirty = (s_FovChanged && isPhysical);
+
+ float sensorLength = cam.fovAxisMode.intValue == 0 ? cam.sensorSize.vector2Value.y : cam.sensorSize.vector2Value.x;
+ float focalLengthVal = focalLengthIsDirty ? Camera.FieldOfViewToFocalLength(s_FovLastValue, sensorLength) : cam.focalLength.floatValue;
+ focalLengthVal = EditorGUILayout.FloatField(Styles.focalLength, focalLengthVal);
+ if (checkScope.changed || focalLengthIsDirty)
+ cam.focalLength.floatValue = focalLengthVal;
+ }
+ }
+
+ /// Draws Lens Shift related fields on the inspector
+ /// The serialized camera
+ /// The editor owner calling this drawer
+ public static void Drawer_PhysicalCamera_Lens_Shift(ISerializedCamera p, Editor owner)
+ {
+ EditorGUILayout.PropertyField(p.baseCameraSettings.lensShift, Styles.shift);
+ }
+ }
+ }
+}
diff --git a/com.unity.render-pipelines.core/Editor/Camera/CameraUI.PhysicalCamera.Drawers.cs.meta b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.PhysicalCamera.Drawers.cs.meta
new file mode 100644
index 00000000000..76eae2f5a58
--- /dev/null
+++ b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.PhysicalCamera.Drawers.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: b7fbad490dc4ecc46b2936be42e9c71f
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/com.unity.render-pipelines.core/Editor/Camera/CameraUI.PhysicalCamera.Skin.cs b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.PhysicalCamera.Skin.cs
new file mode 100644
index 00000000000..6ed88b18a18
--- /dev/null
+++ b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.PhysicalCamera.Skin.cs
@@ -0,0 +1,73 @@
+using System.Linq;
+using UnityEngine;
+
+namespace UnityEditor.Rendering
+{
+ /// Camera UI Shared Properties among SRP
+ public static partial class CameraUI
+ {
+ ///
+ /// Physical camera content content
+ ///
+ public static partial class PhysicalCamera
+ {
+ ///
+ /// Styles
+ ///
+ public static class Styles
+ {
+ // Camera Body
+ ///
+ /// Camera Body content
+ ///
+ public static readonly GUIContent cameraBody = EditorGUIUtility.TrTextContent("Camera Body");
+
+ ///
+ /// Sensor type content
+ ///
+ public static readonly GUIContent sensorType = EditorGUIUtility.TrTextContent("Sensor Type", "Common sensor sizes. Choose an item to set Sensor Size, or edit Sensor Size for your custom settings.");
+
+ ///
+ /// Aperture format names
+ ///
+ public static readonly string[] apertureFormatNames = CameraEditor.Settings.ApertureFormatNames.ToArray();
+
+ ///
+ /// Aperture format values
+ ///
+ public static readonly Vector2[] apertureFormatValues = CameraEditor.Settings.ApertureFormatValues.ToArray();
+
+ ///
+ /// Custom preset index
+ ///
+ public static readonly int customPresetIndex = apertureFormatNames.Length - 1;
+
+ ///
+ /// Sensor size
+ ///
+ public static readonly GUIContent sensorSize = EditorGUIUtility.TrTextContent("Sensor Size", "The size of the camera sensor in millimeters.");
+
+ ///
+ /// Gate Fit
+ ///
+ public static readonly GUIContent gateFit = EditorGUIUtility.TrTextContent("Gate Fit", "Determines how the rendered area (resolution gate) fits into the sensor area (film gate).");
+
+ // Lens
+ ///
+ /// Lens content
+ ///
+ public static readonly GUIContent lens = EditorGUIUtility.TrTextContent("Lens");
+
+ ///
+ /// Focal Length Content
+ ///
+ public static readonly GUIContent focalLength = EditorGUIUtility.TrTextContent("Focal Length", "The simulated distance between the lens and the sensor of the physical camera. Larger values give a narrower field of view.");
+
+ ///
+ /// Shift content
+ ///
+ public static readonly GUIContent shift = EditorGUIUtility.TrTextContent("Shift", "Offset from the camera sensor. Use these properties to simulate a shift lens. Measured as a multiple of the sensor size.");
+ }
+ }
+ }
+}
diff --git a/com.unity.render-pipelines.core/Editor/Camera/CameraUI.PhysicalCamera.Skin.cs.meta b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.PhysicalCamera.Skin.cs.meta
new file mode 100644
index 00000000000..f49679c9a90
--- /dev/null
+++ b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.PhysicalCamera.Skin.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 7e978521b37d51146b2cc9750ebfa16c
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Rendering.Drawers.cs b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Rendering.Drawers.cs
new file mode 100644
index 00000000000..0d72f2755d8
--- /dev/null
+++ b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Rendering.Drawers.cs
@@ -0,0 +1,41 @@
+namespace UnityEditor.Rendering
+{
+ /// Camera UI Shared Properties among SRP
+ public static partial class CameraUI
+ {
+ public static partial class Rendering
+ {
+ /// Draws Stop NaNs related fields on the inspector
+ /// The serialized camera
+ /// The editor owner calling this drawer
+ public static void Drawer_Rendering_StopNaNs(ISerializedCamera p, Editor owner)
+ {
+ EditorGUILayout.PropertyField(p.stopNaNs, Styles.stopNaNs);
+ }
+
+ /// Draws Dithering related fields on the inspector
+ /// The serialized camera
+ /// The editor owner calling this drawer
+ public static void Drawer_Rendering_Dithering(ISerializedCamera p, Editor owner)
+ {
+ EditorGUILayout.PropertyField(p.dithering, Styles.dithering);
+ }
+
+ /// Draws Culling mask related fields on the inspector
+ /// The serialized camera
+ /// The editor owner calling this drawer
+ public static void Drawer_Rendering_CullingMask(ISerializedCamera p, Editor owner)
+ {
+ EditorGUILayout.PropertyField(p.baseCameraSettings.cullingMask, Styles.cullingMask);
+ }
+
+ /// Draws occlusion Culling related fields on the inspector
+ /// The serialized camera
+ /// The editor owner calling this drawer
+ public static void Drawer_Rendering_OcclusionCulling(ISerializedCamera p, Editor owner)
+ {
+ EditorGUILayout.PropertyField(p.baseCameraSettings.occlusionCulling, Styles.occlusionCulling);
+ }
+ }
+ }
+}
diff --git a/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Rendering.Drawers.cs.meta b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Rendering.Drawers.cs.meta
new file mode 100644
index 00000000000..08a23cc6de4
--- /dev/null
+++ b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Rendering.Drawers.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 6cf20b5e989565749903509e13e351f6
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Rendering.Skin.cs b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Rendering.Skin.cs
new file mode 100644
index 00000000000..50228213e0c
--- /dev/null
+++ b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Rendering.Skin.cs
@@ -0,0 +1,60 @@
+using UnityEngine;
+
+namespace UnityEditor.Rendering
+{
+ /// Camera UI Shared Properties among SRP
+ public static partial class CameraUI
+ {
+ ///
+ /// Rendering section
+ ///
+ public static partial class Rendering
+ {
+ ///
+ /// Styles
+ ///
+ public static class Styles
+ {
+ ///
+ /// Header of the section
+ ///
+ public static readonly GUIContent header = EditorGUIUtility.TrTextContent("Rendering", "These settings control for the specific rendering features for this camera.");
+
+ ///
+ /// antialiasing content
+ ///
+ public static readonly GUIContent antialiasing = EditorGUIUtility.TrTextContent("Post Anti-aliasing", "The postprocess anti-aliasing method to use.");
+
+ ///
+ /// dithering content
+ ///
+ public static readonly GUIContent dithering = EditorGUIUtility.TrTextContent("Dithering", "Applies 8-bit dithering to the final render to reduce color banding.");
+
+ ///
+ /// stopNaNs content
+ ///
+ public static readonly GUIContent stopNaNs = EditorGUIUtility.TrTextContent("Stop NaNs", "Automatically replaces NaN/Inf in shaders by a black pixel to avoid breaking some effects. This will slightly affect performances and should only be used if you experience NaN issues that you can't fix.");
+
+ ///
+ /// cullingMask content
+ ///
+ public static readonly GUIContent cullingMask = EditorGUIUtility.TrTextContent("Culling Mask");
+
+ ///
+ /// occlusionCulling content
+ ///
+ public static readonly GUIContent occlusionCulling = EditorGUIUtility.TrTextContent("Occlusion Culling");
+
+ ///
+ /// renderingPath content
+ ///
+ public static readonly GUIContent renderingPath = EditorGUIUtility.TrTextContent("Custom Frame Settings", "Define the custom Frame Settings for this Camera to use.");
+
+ ///
+ /// exposureTarget content
+ ///
+ public static readonly GUIContent exposureTarget = EditorGUIUtility.TrTextContent("Exposure Target", "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).");
+ }
+ }
+ }
+}
diff --git a/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Rendering.Skin.cs.meta b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Rendering.Skin.cs.meta
new file mode 100644
index 00000000000..950adec6910
--- /dev/null
+++ b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Rendering.Skin.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 96acda4e859ca224986250b52266e0c9
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Skin.cs b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Skin.cs
similarity index 62%
rename from com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Skin.cs
rename to com.unity.render-pipelines.core/Editor/Camera/CameraUI.Skin.cs
index f067d241da3..f6b71b0f17c 100644
--- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Skin.cs
+++ b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Skin.cs
@@ -1,21 +1,58 @@
using UnityEngine;
-namespace UnityEditor.Rendering.HighDefinition
+namespace UnityEditor.Rendering
{
- static partial class HDCameraUI
+ /// Camera UI Shared Properties among SRP
+ public static partial class CameraUI
{
- class Styles
+ ///
+ /// Styles
+ ///
+ public static class Styles
{
+ ///
+ /// Projection section header
+ ///
public static GUIContent projectionSettingsHeaderContent { get; } = EditorGUIUtility.TrTextContent("Projection");
+ ///
+ /// Clipping planes content
+ ///
public static GUIContent clippingPlaneMultiFieldTitle = EditorGUIUtility.TrTextContent("Clipping Planes");
+ ///
+ /// Projection Content
+ ///
public static readonly GUIContent projectionContent = EditorGUIUtility.TrTextContent("Projection", "How the Camera renders perspective.\n\nChoose Perspective to render objects with perspective.\n\nChoose Orthographic to render objects uniformly, with no sense of perspective.");
+
+ ///
+ /// Size content
+ ///
public static readonly GUIContent sizeContent = EditorGUIUtility.TrTextContent("Size");
+
+ ///
+ /// FOV content
+ ///
public static readonly GUIContent fieldOfViewContent = EditorGUIUtility.TrTextContent("Field of View", "The height of the Camera’s view angle, measured in degrees along the local Y axis.");
+
+ ///
+ /// FOV Axis content
+ ///
public static readonly GUIContent FOVAxisModeContent = EditorGUIUtility.TrTextContent("Field of View Axis", "Field of view axis.");
+
+ ///
+ /// Physical camera content
+ ///
public static readonly GUIContent physicalCameraContent = EditorGUIUtility.TrTextContent("Physical Camera", "Enables Physical camera mode for FOV calculation. When checked, the field of view is calculated from properties for simulating physical attributes (focal length, sensor size, and lens shift).");
+
+ ///
+ /// Near plane content
+ ///
public static readonly GUIContent nearPlaneContent = EditorGUIUtility.TrTextContent("Near", "The closest point relative to the camera that drawing occurs.");
+
+ ///
+ /// Far plane content
+ ///
public static readonly GUIContent farPlaneContent = EditorGUIUtility.TrTextContent("Far", "The furthest point relative to the camera that drawing occurs.");
}
}
diff --git a/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Skin.cs.meta b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Skin.cs.meta
new file mode 100644
index 00000000000..8587f086a65
--- /dev/null
+++ b/com.unity.render-pipelines.core/Editor/Camera/CameraUI.Skin.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: e26c221569d1d284a9d21434b3a4b277
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Drawers.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Drawers.cs
index 6919fac1162..cb8bc20c113 100644
--- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Drawers.cs
+++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Drawers.cs
@@ -7,46 +7,19 @@ namespace UnityEditor.Rendering.HighDefinition
static partial class HDCameraUI
{
- enum Expandable
- {
- Projection = 1 << 0,
- Physical = 1 << 1,
- Output = 1 << 2,
- Orthographic = 1 << 3,
- RenderLoop = 1 << 4,
- Rendering = 1 << 5,
- Environment = 1 << 6,
- }
-
- enum ProjectionType
- {
- Perspective,
- Orthographic
- }
-
- enum ProjectionMatrixMode
- {
- Explicit,
- Implicit,
- PhysicalPropertiesBased,
- }
-
- static bool s_FovChanged;
- static float s_FovLastValue;
-
- static readonly ExpandedState k_ExpandedState = new ExpandedState(Expandable.Projection, "HDRP");
+ static readonly ExpandedState k_ExpandedState = new ExpandedState(CameraUI.Expandable.Projection, "HDRP");
public static readonly CED.IDrawer SectionProjectionSettings = CED.FoldoutGroup(
- Styles.projectionSettingsHeaderContent,
- Expandable.Projection,
+ CameraUI.Styles.projectionSettingsHeaderContent,
+ CameraUI.Expandable.Projection,
k_ExpandedState,
FoldoutOption.Indent,
CED.Group(
- Drawer_Projection
+ CameraUI.Drawer_Projection
),
PhysicalCamera.Drawer,
CED.Group(
- Drawer_FieldClippingPlanes
+ CameraUI.Drawer_FieldClippingPlanes
)
);
@@ -57,114 +30,5 @@ enum ProjectionMatrixMode
Environment.Drawer,
Output.Drawer,
};
-
- static void Drawer_Projection(SerializedHDCamera p, Editor owner)
- {
- // Most of this is replicated from CameraEditor.DrawProjection as we don't want to draw
- // it the same way it's done in non-SRP cameras. Unfortunately, because a lot of the
- // code is internal, we have to copy/paste some stuff from the editor code :(
-
- var cam = p.baseCameraSettings;
-
- Rect perspectiveRect = EditorGUILayout.GetControlRect();
-
- ProjectionType projectionType;
- EditorGUI.BeginProperty(perspectiveRect, Styles.projectionContent, cam.orthographic);
- {
- projectionType = cam.orthographic.boolValue ? ProjectionType.Orthographic : ProjectionType.Perspective;
-
- EditorGUI.BeginChangeCheck();
- projectionType = (ProjectionType)EditorGUI.EnumPopup(perspectiveRect, Styles.projectionContent, projectionType);
- if (EditorGUI.EndChangeCheck())
- cam.orthographic.boolValue = (projectionType == ProjectionType.Orthographic);
- }
- EditorGUI.EndProperty();
-
- if (cam.orthographic.hasMultipleDifferentValues)
- return;
-
- if (projectionType == ProjectionType.Orthographic)
- {
- EditorGUILayout.PropertyField(cam.orthographicSize, Styles.sizeContent);
- }
- else
- {
- float fovCurrentValue;
- bool multipleDifferentFovValues = false;
- bool isPhysicalCamera = p.projectionMatrixMode.intValue == (int)ProjectionMatrixMode.PhysicalPropertiesBased;
-
- var rect = EditorGUILayout.GetControlRect();
-
- var guiContent = EditorGUI.BeginProperty(rect, Styles.FOVAxisModeContent, cam.fovAxisMode);
- EditorGUI.showMixedValue = cam.fovAxisMode.hasMultipleDifferentValues;
-
- EditorGUI.BeginChangeCheck();
- var fovAxisNewVal = (int)(Camera.FieldOfViewAxis)EditorGUI.EnumPopup(rect, guiContent, (Camera.FieldOfViewAxis)cam.fovAxisMode.intValue);
- if (EditorGUI.EndChangeCheck())
- cam.fovAxisMode.intValue = fovAxisNewVal;
- EditorGUI.EndProperty();
-
- bool fovAxisVertical = cam.fovAxisMode.intValue == 0;
-
- if (!fovAxisVertical && !cam.fovAxisMode.hasMultipleDifferentValues)
- {
- var targets = p.serializedObject.targetObjects;
- var camera0 = targets[0] as Camera;
- float aspectRatio = isPhysicalCamera ? cam.sensorSize.vector2Value.x / cam.sensorSize.vector2Value.y : camera0.aspect;
- // camera.aspect is not serialized so we have to check all targets.
- fovCurrentValue = Camera.VerticalToHorizontalFieldOfView(camera0.fieldOfView, aspectRatio);
- if (targets.Cast().Any(camera => camera.fieldOfView != fovCurrentValue))
- multipleDifferentFovValues = true;
- }
- else
- {
- fovCurrentValue = cam.verticalFOV.floatValue;
- multipleDifferentFovValues = cam.fovAxisMode.hasMultipleDifferentValues;
- }
-
- EditorGUI.showMixedValue = multipleDifferentFovValues;
- var content = EditorGUI.BeginProperty(EditorGUILayout.BeginHorizontal(), Styles.fieldOfViewContent, cam.verticalFOV);
- EditorGUI.BeginDisabledGroup(p.projectionMatrixMode.hasMultipleDifferentValues || isPhysicalCamera && (cam.sensorSize.hasMultipleDifferentValues || cam.fovAxisMode.hasMultipleDifferentValues));
- EditorGUI.BeginChangeCheck();
- s_FovLastValue = EditorGUILayout.Slider(content, fovCurrentValue, 0.00001f, 179f);
- s_FovChanged = EditorGUI.EndChangeCheck();
- EditorGUI.EndDisabledGroup();
- EditorGUILayout.EndHorizontal();
- EditorGUI.EndProperty();
- EditorGUI.showMixedValue = false;
-
- content = EditorGUI.BeginProperty(EditorGUILayout.BeginHorizontal(), Styles.physicalCameraContent, p.projectionMatrixMode);
- EditorGUI.showMixedValue = p.projectionMatrixMode.hasMultipleDifferentValues;
-
- EditorGUI.BeginChangeCheck();
- isPhysicalCamera = EditorGUILayout.Toggle(content, isPhysicalCamera);
- if (EditorGUI.EndChangeCheck())
- p.projectionMatrixMode.intValue = isPhysicalCamera ? (int)ProjectionMatrixMode.PhysicalPropertiesBased : (int)ProjectionMatrixMode.Implicit;
- EditorGUILayout.EndHorizontal();
- EditorGUI.EndProperty();
-
- EditorGUI.showMixedValue = false;
- if (s_FovChanged && (!isPhysicalCamera || p.projectionMatrixMode.hasMultipleDifferentValues))
- {
- cam.verticalFOV.floatValue = fovAxisVertical
- ? s_FovLastValue
- : Camera.HorizontalToVerticalFieldOfView(s_FovLastValue, (p.serializedObject.targetObjects[0] as Camera).aspect);
- }
- else if (s_FovChanged && isPhysicalCamera && !p.projectionMatrixMode.hasMultipleDifferentValues)
- {
- cam.verticalFOV.floatValue = fovAxisVertical
- ? s_FovLastValue
- : Camera.HorizontalToVerticalFieldOfView(s_FovLastValue, (p.serializedObject.targetObjects[0] as Camera).aspect);
- }
- }
- }
-
- static void Drawer_FieldClippingPlanes(SerializedHDCamera p, Editor owner)
- {
- CoreEditorUtils.DrawMultipleFields(
- Styles.clippingPlaneMultiFieldTitle,
- new[] { p.baseCameraSettings.nearClippingPlane, p.baseCameraSettings.farClippingPlane },
- new[] { Styles.nearPlaneContent, Styles.farPlaneContent });
- }
}
}
diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Environment.Drawers.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Environment.Drawers.cs
index b62c0895eea..bddc6f3733a 100644
--- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Environment.Drawers.cs
+++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Environment.Drawers.cs
@@ -9,13 +9,13 @@ static partial class HDCameraUI
partial class Environment
{
public static readonly CED.IDrawer Drawer = CED.FoldoutGroup(
- Styles.header,
- Expandable.Environment,
+ CameraUI.Environment.Styles.header,
+ CameraUI.Expandable.Environment,
k_ExpandedState,
FoldoutOption.Indent,
CED.Group(
Drawer_Environment_Background,
- Drawer_Environment_VolumeLayerMask,
+ CameraUI.Environment.Drawer_Environment_VolumeLayerMask,
Drawer_Environment_VolumeAnchorOverride,
Drawer_Environment_ProbeLayerMask
)
@@ -35,11 +35,6 @@ static void Drawer_Environment_Background(SerializedHDCamera p, Editor owner)
p.clearDepth.boolValue = true;
}
- static void Drawer_Environment_VolumeLayerMask(SerializedHDCamera p, Editor owner)
- {
- EditorGUILayout.PropertyField(p.volumeLayerMask, Styles.volumeLayerMask);
- }
-
static void Drawer_Environment_VolumeAnchorOverride(SerializedHDCamera p, Editor owner)
{
EditorGUILayout.PropertyField(p.volumeAnchorOverride, Styles.volumeAnchorOverride);
diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.EnvironmentSkin.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.EnvironmentSkin.cs
index 5d13b4988ac..c5110b5dd1e 100644
--- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.EnvironmentSkin.cs
+++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.EnvironmentSkin.cs
@@ -8,9 +8,6 @@ partial class Environment
{
class Styles
{
- public static readonly GUIContent header = EditorGUIUtility.TrTextContent("Environment", "These settings control what the camera background looks like.");
-
- public static readonly GUIContent volumeLayerMask = EditorGUIUtility.TrTextContent("Volume Layer Mask");
public static readonly GUIContent backgroundType = EditorGUIUtility.TrTextContent("Background Type", "Specifies the type of background the Camera applies when it clears the screen before rendering a frame. Be aware that when setting this to None, the background is never cleared and since HDRP shares render texture between cameras, you may end up with garbage from previous rendering.");
public static readonly GUIContent backgroundColor = EditorGUIUtility.TrTextContent("Background Color", "The Background Color used to clear the screen when selecting Background Color before rendering.");
public static readonly GUIContent volumeAnchorOverride = EditorGUIUtility.TrTextContent("Volume Anchor Override");
diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Output.Drawers.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Output.Drawers.cs
index 520267b4bf3..aff9b943a4e 100644
--- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Output.Drawers.cs
+++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Output.Drawers.cs
@@ -12,8 +12,8 @@ static partial class HDCameraUI
partial class Output
{
public static readonly CED.IDrawer Drawer = CED.FoldoutGroup(
- Styles.header,
- Expandable.Output,
+ CameraUI.Output.Styles.header,
+ CameraUI.Expandable.Output,
k_ExpandedState,
FoldoutOption.Indent,
CED.Group(
@@ -23,35 +23,14 @@ partial class Output
#if ENABLE_MULTIPLE_DISPLAYS
Drawer_Output_MultiDisplay,
#endif
- Drawer_Output_RenderTarget,
+ CameraUI.Output.Drawer_Output_RenderTarget,
Drawer_Output_MSAA_Warning,
- Drawer_Output_AllowDynamicResolution,
- Drawer_Output_Depth,
- Drawer_Output_NormalizedViewPort
+ CameraUI.Output.Drawer_Output_AllowDynamicResolution,
+ CameraUI.Output.Drawer_Output_Depth,
+ CameraUI.Output.Drawer_Output_NormalizedViewPort
)
);
- static void Drawer_Output_AllowDynamicResolution(SerializedHDCamera p, Editor owner)
- {
- EditorGUILayout.PropertyField(p.allowDynamicResolution, Styles.allowDynamicResolution);
- p.baseCameraSettings.allowDynamicResolution.boolValue = p.allowDynamicResolution.boolValue;
- }
-
- static void Drawer_Output_NormalizedViewPort(SerializedHDCamera p, Editor owner)
- {
- EditorGUILayout.PropertyField(p.baseCameraSettings.normalizedViewPortRect, Styles.viewport);
- }
-
- static void Drawer_Output_Depth(SerializedHDCamera p, Editor owner)
- {
- EditorGUILayout.PropertyField(p.baseCameraSettings.depth, Styles.depth);
- }
-
- static void Drawer_Output_RenderTarget(SerializedHDCamera p, Editor owner)
- {
- EditorGUILayout.PropertyField(p.baseCameraSettings.targetTexture);
- }
-
static void Drawer_Output_MSAA_Warning(SerializedHDCamera p, Editor owner)
{
// show warning if we have deferred but manual MSAA set
diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Output.Skin.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Output.Skin.cs
index e60a3bd9cf1..b5311a7f480 100644
--- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Output.Skin.cs
+++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Output.Skin.cs
@@ -8,8 +8,6 @@ partial class Output
{
class Styles
{
- public static readonly GUIContent header = EditorGUIUtility.TrTextContent("Output", "These settings control how the camera output is formatted.");
-
#if ENABLE_MULTIPLE_DISPLAYS
public static readonly GUIContent targetDisplay = EditorGUIUtility.TrTextContent("Target Display");
#endif
@@ -18,10 +16,6 @@ class Styles
public static readonly GUIContent xrRenderingContent = EditorGUIUtility.TrTextContent("XR Rendering");
#endif
- public static readonly GUIContent depth = EditorGUIUtility.TrTextContent("Depth");
- public static readonly GUIContent viewport = EditorGUIUtility.TrTextContent("Viewport Rect", "Four values that indicate where on the screen HDRP draws this Camera view. Measured in Viewport Coordinates (values in the range of [0, 1]).");
- public static readonly GUIContent allowDynamicResolution = EditorGUIUtility.TrTextContent("Allow Dynamic Resolution", "Whether to support dynamic resolution.");
-
public const string msaaWarningMessage = "Manual MSAA target set with deferred rendering. This will lead to undefined behavior.";
}
}
diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.PhysicalCamera.Drawers.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.PhysicalCamera.Drawers.cs
index 2b571daa75c..3aa567bad0b 100644
--- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.PhysicalCamera.Drawers.cs
+++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.PhysicalCamera.Drawers.cs
@@ -12,25 +12,25 @@ static partial class HDCameraUI
partial class PhysicalCamera
{
public static readonly CED.IDrawer Drawer = CED.Conditional(
- (serialized, owner) => serialized.projectionMatrixMode.intValue == (int)ProjectionMatrixMode.PhysicalPropertiesBased,
+ (serialized, owner) => serialized.projectionMatrixMode.intValue == (int)CameraUI.ProjectionMatrixMode.PhysicalPropertiesBased,
CED.Group(
- Styles.cameraBody,
+ CameraUI.PhysicalCamera.Styles.cameraBody,
GroupOption.Indent,
CED.Group(
GroupOption.Indent,
- Drawer_PhysicalCamera_CameraBody_Sensor,
+ CameraUI.PhysicalCamera.Drawer_PhysicalCamera_CameraBody_Sensor,
Drawer_PhysicalCamera_CameraBody_ISO,
Drawer_PhysicalCamera_CameraBody_ShutterSpeed,
- Drawer_PhysicalCamera_CameraBody_GateFit
+ CameraUI.PhysicalCamera.Drawer_PhysicalCamera_CameraBody_GateFit
)
),
CED.Group(
- Styles.lens,
+ CameraUI.PhysicalCamera.Styles.lens,
GroupOption.Indent,
CED.Group(
GroupOption.Indent,
- Drawer_PhysicalCamera_Lens_FocalLength,
- Drawer_PhysicalCamera_Lens_Shift,
+ CameraUI.PhysicalCamera.Drawer_PhysicalCamera_Lens_FocalLength,
+ CameraUI.PhysicalCamera.Drawer_PhysicalCamera_Lens_Shift,
Drawer_PhysicalCamera_Lens_Aperture
)
),
@@ -44,102 +44,6 @@ partial class PhysicalCamera
)
);
- // Saves the value of the sensor size when the user switches from "custom" size to a preset per camera.
- // We use a ConditionalWeakTable instead of a Dictionary to avoid keeping alive (with strong references) deleted cameras
- static ConditionalWeakTable s_PerCameraSensorSizeHistory = new ConditionalWeakTable();
-
- static void Drawer_PhysicalCamera_CameraBody_Sensor(SerializedHDCamera p, Editor owner)
- {
- var cam = p.baseCameraSettings;
- EditorGUI.BeginChangeCheck();
-
- int oldFilmGateIndex = Array.IndexOf(Styles.apertureFormatValues, new Vector2((float)Math.Round(cam.sensorSize.vector2Value.x, 3), (float)Math.Round(cam.sensorSize.vector2Value.y, 3)));
-
- // If it is not one of the preset sizes, set it to custom
- oldFilmGateIndex = (oldFilmGateIndex == -1) ? Styles.customPresetIndex : oldFilmGateIndex;
-
- // Get the new user selection
- int newFilmGateIndex = EditorGUILayout.Popup(Styles.sensorType, oldFilmGateIndex, Styles.apertureFormatNames);
-
- if (EditorGUI.EndChangeCheck())
- {
- // Retrieve the previous custom size value, if one exists for this camera
- object previousCustomValue;
- s_PerCameraSensorSizeHistory.TryGetValue((Camera)p.serializedObject.targetObject, out previousCustomValue);
-
- // When switching from custom to a preset, update the last custom value (to display again, in case the user switches back to custom)
- if (oldFilmGateIndex == Styles.customPresetIndex)
- {
- if (previousCustomValue == null)
- {
- s_PerCameraSensorSizeHistory.Add((Camera)p.serializedObject.targetObject, cam.sensorSize.vector2Value);
- }
- else
- {
- previousCustomValue = cam.sensorSize.vector2Value;
- }
- }
-
- if (newFilmGateIndex < Styles.customPresetIndex)
- {
- cam.sensorSize.vector2Value = Styles.apertureFormatValues[newFilmGateIndex];
- }
- else
- {
- // The user switched back to custom, so display by deafulr the previous custom value
- if (previousCustomValue != null)
- {
- cam.sensorSize.vector2Value = (Vector2)previousCustomValue;
- }
- else
- {
- cam.sensorSize.vector2Value = new Vector2(36.0f, 24.0f); // this is the value new cameras are created with
- }
- }
- }
-
- EditorGUILayout.PropertyField(cam.sensorSize, Styles.sensorSize);
- }
-
- static void Drawer_PhysicalCamera_CameraBody_GateFit(SerializedHDCamera p, Editor owner)
- {
- var cam = p.baseCameraSettings;
-
- using (var horizontal = new EditorGUILayout.HorizontalScope())
- using (var propertyScope = new EditorGUI.PropertyScope(horizontal.rect, Styles.gateFit, cam.gateFit))
- using (var checkScope = new EditorGUI.ChangeCheckScope())
- {
- int gateValue = (int)(Camera.GateFitMode)EditorGUILayout.EnumPopup(propertyScope.content, (Camera.GateFitMode)cam.gateFit.intValue);
- if (checkScope.changed)
- cam.gateFit.intValue = gateValue;
- }
- }
-
- static void Drawer_PhysicalCamera_Lens_FocalLength(SerializedHDCamera p, Editor owner)
- {
- var cam = p.baseCameraSettings;
-
- using (var horizontal = new EditorGUILayout.HorizontalScope())
- using (new EditorGUI.PropertyScope(horizontal.rect, Styles.focalLength, cam.focalLength))
- using (var checkScope = new EditorGUI.ChangeCheckScope())
- {
- bool isPhysical = p.projectionMatrixMode.intValue == (int)ProjectionMatrixMode.PhysicalPropertiesBased;
- // We need to update the focal length if the camera is physical and the FoV has changed.
- bool focalLengthIsDirty = (s_FovChanged && isPhysical);
-
- float sensorLength = cam.fovAxisMode.intValue == 0 ? cam.sensorSize.vector2Value.y : cam.sensorSize.vector2Value.x;
- float focalLengthVal = focalLengthIsDirty ? Camera.FieldOfViewToFocalLength(s_FovLastValue, sensorLength) : cam.focalLength.floatValue;
- focalLengthVal = EditorGUILayout.FloatField(Styles.focalLength, focalLengthVal);
- if (checkScope.changed || focalLengthIsDirty)
- cam.focalLength.floatValue = focalLengthVal;
- }
- }
-
- static void Drawer_PhysicalCamera_Lens_Shift(SerializedHDCamera p, Editor owner)
- {
- EditorGUILayout.PropertyField(p.baseCameraSettings.lensShift, Styles.shift);
- }
-
static void Drawer_PhysicalCamera_CameraBody_ISO(SerializedHDCamera p, Editor owner)
{
EditorGUILayout.PropertyField(p.iso, Styles.ISO);
@@ -250,38 +154,35 @@ static void Drawer_PhysicalCamera_ApertureShape(SerializedHDCamera p, Editor own
{
var cam = p.baseCameraSettings;
- using (new EditorGUI.IndentLevelScope())
- {
- EditorGUILayout.PropertyField(p.bladeCount, Styles.bladeCount);
-
- using (var horizontal = new EditorGUILayout.HorizontalScope())
- using (var propertyScope = new EditorGUI.PropertyScope(horizontal.rect, Styles.curvature, p.curvature))
- {
- var v = p.curvature.vector2Value;
-
- // The layout system breaks alignment when mixing inspector fields with custom layout'd
- // fields as soon as a scrollbar is needed in the inspector, so we'll do the layout
- // manually instead
- const int kFloatFieldWidth = 50;
- const int kSeparatorWidth = 5;
- float indentOffset = EditorGUI.indentLevel * 15f;
- var lineRect = EditorGUILayout.GetControlRect();
- var labelRect = new Rect(lineRect.x, lineRect.y, EditorGUIUtility.labelWidth - indentOffset, lineRect.height);
- var floatFieldLeft = new Rect(labelRect.xMax, lineRect.y, kFloatFieldWidth + indentOffset, lineRect.height);
- var sliderRect = new Rect(floatFieldLeft.xMax + kSeparatorWidth - indentOffset, lineRect.y, lineRect.width - labelRect.width - kFloatFieldWidth * 2 - kSeparatorWidth * 2, lineRect.height);
- var floatFieldRight = new Rect(sliderRect.xMax + kSeparatorWidth - indentOffset, lineRect.y, kFloatFieldWidth + indentOffset, lineRect.height);
+ EditorGUILayout.PropertyField(p.bladeCount, Styles.bladeCount);
- EditorGUI.PrefixLabel(labelRect, propertyScope.content);
- v.x = EditorGUI.FloatField(floatFieldLeft, v.x);
- EditorGUI.MinMaxSlider(sliderRect, ref v.x, ref v.y, HDPhysicalCamera.kMinAperture, HDPhysicalCamera.kMaxAperture);
- v.y = EditorGUI.FloatField(floatFieldRight, v.y);
-
- p.curvature.vector2Value = v;
- }
-
- EditorGUILayout.PropertyField(p.barrelClipping, Styles.barrelClipping);
- EditorGUILayout.PropertyField(p.anamorphism, Styles.anamorphism);
+ using (var horizontal = new EditorGUILayout.HorizontalScope())
+ using (var propertyScope = new EditorGUI.PropertyScope(horizontal.rect, Styles.curvature, p.curvature))
+ {
+ var v = p.curvature.vector2Value;
+
+ // The layout system breaks alignment when mixing inspector fields with custom layout'd
+ // fields as soon as a scrollbar is needed in the inspector, so we'll do the layout
+ // manually instead
+ const int kFloatFieldWidth = 50;
+ const int kSeparatorWidth = 5;
+ float indentOffset = EditorGUI.indentLevel * 15f;
+ var lineRect = EditorGUILayout.GetControlRect();
+ var labelRect = new Rect(lineRect.x, lineRect.y, EditorGUIUtility.labelWidth - indentOffset, lineRect.height);
+ var floatFieldLeft = new Rect(labelRect.xMax, lineRect.y, kFloatFieldWidth + indentOffset, lineRect.height);
+ var sliderRect = new Rect(floatFieldLeft.xMax + kSeparatorWidth - indentOffset, lineRect.y, lineRect.width - labelRect.width - kFloatFieldWidth * 2 - kSeparatorWidth * 2, lineRect.height);
+ var floatFieldRight = new Rect(sliderRect.xMax + kSeparatorWidth - indentOffset, lineRect.y, kFloatFieldWidth + indentOffset, lineRect.height);
+
+ EditorGUI.PrefixLabel(labelRect, propertyScope.content);
+ v.x = EditorGUI.FloatField(floatFieldLeft, v.x);
+ EditorGUI.MinMaxSlider(sliderRect, ref v.x, ref v.y, HDPhysicalCamera.kMinAperture, HDPhysicalCamera.kMaxAperture);
+ v.y = EditorGUI.FloatField(floatFieldRight, v.y);
+
+ p.curvature.vector2Value = v;
}
+
+ EditorGUILayout.PropertyField(p.barrelClipping, Styles.barrelClipping);
+ EditorGUILayout.PropertyField(p.anamorphism, Styles.anamorphism);
}
}
}
diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.PhysicalCamera.Skin.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.PhysicalCamera.Skin.cs
index ea9e9eb2bb2..b33b9ec3a87 100644
--- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.PhysicalCamera.Skin.cs
+++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.PhysicalCamera.Skin.cs
@@ -10,21 +10,10 @@ partial class PhysicalCamera
class Styles
{
// Camera Body
- public static readonly GUIContent cameraBody = EditorGUIUtility.TrTextContent("Camera Body");
- public static readonly GUIContent sensorType = EditorGUIUtility.TrTextContent("Sensor Type", "Common sensor sizes. Choose an item to set Sensor Size, or edit Sensor Size for your custom settings.");
- public static readonly string[] apertureFormatNames = CameraEditor.Settings.ApertureFormatNames.ToArray();
- public static readonly Vector2[] apertureFormatValues = CameraEditor.Settings.ApertureFormatValues.ToArray();
- public static readonly int customPresetIndex = apertureFormatNames.Length - 1;
public static readonly GUIContent ISO = EditorGUIUtility.TrTextContent("ISO", "Sets the light sensitivity of the Camera sensor. This property affects Exposure if you set its Mode to Use Physical Camera.");
public static readonly GUIContent shutterSpeed = EditorGUIUtility.TrTextContent("Shutter Speed", "The amount of time the Camera sensor is capturing light.");
- public static readonly GUIContent sensorSize = EditorGUIUtility.TrTextContent("Sensor Size", "The size of the camera sensor in millimeters.");
- public static readonly GUIContent gateFit = EditorGUIUtility.TrTextContent("Gate Fit", "Determines how the rendered area (resolution gate) fits into the sensor area (film gate).");
-
// Lens
- public static readonly GUIContent lens = EditorGUIUtility.TrTextContent("Lens");
- public static readonly GUIContent focalLength = EditorGUIUtility.TrTextContent("Focal Length", "The simulated distance between the lens and the sensor of the physical camera. Larger values give a narrower field of view.");
- public static readonly GUIContent shift = EditorGUIUtility.TrTextContent("Shift", "Offset from the camera sensor. Use these properties to simulate a shift lens. Measured as a multiple of the sensor size.");
public static readonly GUIContent aperture = EditorGUIUtility.TrTextContent("Aperture", "The f-stop (f-number) of the lens. Lower values give a wider lens aperture.");
// Aperture Shape
diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Rendering.Drawers.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Rendering.Drawers.cs
index f5ae7d03890..a226de7373c 100644
--- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Rendering.Drawers.cs
+++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Rendering.Drawers.cs
@@ -11,8 +11,8 @@ static partial class HDCameraUI
partial class Rendering
{
public static readonly CED.IDrawer Drawer = CED.FoldoutGroup(
- Styles.header,
- Expandable.Rendering,
+ CameraUI.Rendering.Styles.header,
+ CameraUI.Expandable.Rendering,
k_ExpandedState,
FoldoutOption.Indent,
CED.Group(
@@ -25,10 +25,10 @@ partial class Rendering
HDAdditionalCameraData.AntialiasingMode.TemporalAntialiasing,
Drawer_Rendering_Antialiasing_TAA),
CED.Group(
- Drawer_Rendering_StopNaNs,
- Drawer_Rendering_Dithering,
- Drawer_Rendering_CullingMask,
- Drawer_Rendering_OcclusionCulling,
+ CameraUI.Rendering.Drawer_Rendering_StopNaNs,
+ CameraUI.Rendering.Drawer_Rendering_Dithering,
+ CameraUI.Rendering.Drawer_Rendering_CullingMask,
+ CameraUI.Rendering.Drawer_Rendering_OcclusionCulling,
Drawer_Rendering_ExposureTarget,
Drawer_Rendering_RenderingPath,
Drawer_Rendering_CameraWarnings
@@ -93,26 +93,6 @@ static void Drawer_Rendering_RenderingPath(SerializedHDCamera p, Editor owner)
EditorGUILayout.PropertyField(p.customRenderingSettings, Styles.renderingPath);
}
- static void Drawer_Rendering_Dithering(SerializedHDCamera p, Editor owner)
- {
- EditorGUILayout.PropertyField(p.dithering, Styles.dithering);
- }
-
- static void Drawer_Rendering_StopNaNs(SerializedHDCamera p, Editor owner)
- {
- EditorGUILayout.PropertyField(p.stopNaNs, Styles.stopNaNs);
- }
-
- static void Drawer_Rendering_CullingMask(SerializedHDCamera p, Editor owner)
- {
- EditorGUILayout.PropertyField(p.baseCameraSettings.cullingMask, Styles.cullingMask);
- }
-
- static void Drawer_Rendering_OcclusionCulling(SerializedHDCamera p, Editor owner)
- {
- EditorGUILayout.PropertyField(p.baseCameraSettings.occlusionCulling, Styles.occlusionCulling);
- }
-
static void Drawer_Rendering_ExposureTarget(SerializedHDCamera p, Editor owner)
{
EditorGUILayout.PropertyField(p.exposureTarget, Styles.exposureTarget);
diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Rendering.Skin.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Rendering.Skin.cs
index 7a27ce64cee..23a2ffdf178 100644
--- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Rendering.Skin.cs
+++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraUI.Rendering.Skin.cs
@@ -8,15 +8,8 @@ partial class Rendering
{
class Styles
{
- public static readonly GUIContent header = EditorGUIUtility.TrTextContent("Rendering", "These settings control for the specific rendering features for this camera.");
-
public static readonly GUIContent antialiasing = EditorGUIUtility.TrTextContent("Post Anti-aliasing", "The postprocess anti-aliasing method to use.");
- public static readonly GUIContent dithering = EditorGUIUtility.TrTextContent("Dithering", "Should we apply 8-bit dithering to the final render?");
- public static readonly GUIContent stopNaNs = EditorGUIUtility.TrTextContent("Stop NaNs", "Automatically replaces NaN/Inf in shaders by a black pixel to avoid breaking some effects. This will slightly affect performances and should only be used if you experience NaN issues that you can't fix.");
- public static readonly GUIContent cullingMask = EditorGUIUtility.TrTextContent("Culling Mask", "Specifies the list of layers the camera should render.");
- public static readonly GUIContent occlusionCulling = EditorGUIUtility.TrTextContent("Occlusion Culling", "When enabled, the camera does not render objects that are being obscured by other geometry.");
-
public static readonly GUIContent SMAAQualityPresetContent = EditorGUIUtility.TrTextContent("Quality Preset", "The quality preset for SMAA, low has the best performance but worst quality, High has the highest quality but worst performance.");
public static readonly GUIContent TAASharpen = EditorGUIUtility.TrTextContent("Sharpen Strength", "The intensity of the sharpen filter used to counterbalance the blur introduced by TAA. A high value might create artifacts such as dark lines depending on the frame content.");