Skip to content

Add missing tooltips in physical camera and improve the UI for aperture #1061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jul 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Removing the planarReflectionCacheCompressed setting from asset.
- SHADERPASS for TransparentDepthPrepass and TransparentDepthPostpass identification is using respectively SHADERPASS_TRANSPARENT_DEPTH_PREPASS and SHADERPASS_TRANSPARENT_DEPTH_POSTPASS
- Renamed the debug name from SSAO to ScreenSpaceAmbientOcclusion (1254974).
- Added missing tooltips and improved the UI of the aperture control (case 1254916).
- Fixed wrong tooltips in the Dof Volume (case 1256641).

## [7.1.1] - 2019-09-05

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ namespace UnityEditor.Rendering.HighDefinition
[VolumeComponentEditor(typeof(DepthOfField))]
sealed class DepthOfFieldEditor : VolumeComponentWithQualityEditor
{
static partial class Styles
{
public static GUIContent k_NearSampleCount = new GUIContent("Sample Count", "Sets the number of samples to use for the near field.");
public static GUIContent k_NearMaxBlur = new GUIContent("Max Radius", "Sets the maximum radius the near blur can reach.");
public static GUIContent k_FarSampleCount = new GUIContent("Sample Count", "Sets the number of samples to use for the far field.");
public static GUIContent k_FarMaxBlur = new GUIContent("Max Radius", "Sets the maximum radius the far blur can reach");

public static GUIContent k_NearFocusStart = new GUIContent("Start", "Sets the distance from the Camera at which the near field blur begins to decrease in intensity.");
public static GUIContent k_FarFocusStart = new GUIContent("Start", "Sets the distance from the Camera at which the far field starts blurring.");

public static GUIContent k_NearFocusEnd = new GUIContent("End", "Sets the distance from the Camera at which the near field does not blur anymore.");
public static GUIContent k_FarFocusEnd = new GUIContent("End", "Sets the distance from the Camera at which the far field blur reaches its maximum blur radius.");
}

SerializedDataParameter m_FocusMode;

// Physical mode
Expand Down Expand Up @@ -74,12 +88,12 @@ public override void OnInspectorGUI()
{
GUI.enabled = useCustomValue;
EditorGUILayout.LabelField("Near Blur", EditorStyles.miniLabel);
PropertyField(m_NearSampleCount, EditorGUIUtility.TrTextContent("Sample Count"));
PropertyField(m_NearMaxBlur, EditorGUIUtility.TrTextContent("Max Radius"));
PropertyField(m_NearSampleCount, Styles.k_NearSampleCount);
PropertyField(m_NearMaxBlur, Styles.k_NearMaxBlur);

EditorGUILayout.LabelField("Far Blur", EditorStyles.miniLabel);
PropertyField(m_FarSampleCount, EditorGUIUtility.TrTextContent("Sample Count"));
PropertyField(m_FarMaxBlur, EditorGUIUtility.TrTextContent("Max Radius"));
PropertyField(m_FarSampleCount, Styles.k_FarSampleCount);
PropertyField(m_FarMaxBlur, Styles.k_FarMaxBlur);
GUI.enabled = true;
}
}
Expand All @@ -88,26 +102,26 @@ public override void OnInspectorGUI()
EditorGUILayout.Space();

EditorGUILayout.LabelField("Near Blur", EditorStyles.miniLabel);
PropertyField(m_NearFocusStart, EditorGUIUtility.TrTextContent("Start"));
PropertyField(m_NearFocusEnd, EditorGUIUtility.TrTextContent("End"));
PropertyField(m_NearFocusStart, Styles.k_NearFocusStart);
PropertyField(m_NearFocusEnd, Styles.k_NearFocusEnd);

if (advanced)
{
GUI.enabled = useCustomValue;
PropertyField(m_NearSampleCount, EditorGUIUtility.TrTextContent("Sample Count"));
PropertyField(m_NearMaxBlur, EditorGUIUtility.TrTextContent("Max Radius"));
PropertyField(m_NearSampleCount, Styles.k_NearSampleCount);
PropertyField(m_NearMaxBlur, Styles.k_NearMaxBlur);
GUI.enabled = true;
}

EditorGUILayout.LabelField("Far Blur", EditorStyles.miniLabel);
PropertyField(m_FarFocusStart, EditorGUIUtility.TrTextContent("Start"));
PropertyField(m_FarFocusEnd, EditorGUIUtility.TrTextContent("End"));
PropertyField(m_FarFocusStart, Styles.k_FarFocusStart);
PropertyField(m_FarFocusEnd, Styles.k_FarFocusEnd);

if (advanced)
{
GUI.enabled = useCustomValue;
PropertyField(m_FarSampleCount, EditorGUIUtility.TrTextContent("Sample Count"));
PropertyField(m_FarMaxBlur, EditorGUIUtility.TrTextContent("Max Radius"));
PropertyField(m_FarSampleCount, Styles.k_FarSampleCount);
PropertyField(m_FarMaxBlur, Styles.k_FarMaxBlur);
GUI.enabled = true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,58 @@ static void Drawer_PhysicalCamera(SerializedHDCamera p, Editor owner)
cam.focalLength.floatValue = focalLengthVal;
}

EditorGUILayout.PropertyField(p.aperture, apertureContent);
// Custom layout for aperture
var rect = EditorGUILayout.BeginHorizontal();
{
// Magic values/offsets to get the UI look consistent
const float textRectSize = 80;
const float textRectPaddingRight = 62;
const float unitRectPaddingRight = 97;
const float sliderPaddingLeft = 2;
const float sliderPaddingRight = 77;

var labelRect = rect;
labelRect.width = EditorGUIUtility.labelWidth;
labelRect.height = EditorGUIUtility.singleLineHeight;
EditorGUI.LabelField(labelRect, apertureContent);

GUI.SetNextControlName("ApertureSlider");
var sliderRect = rect;
sliderRect.x += labelRect.width + sliderPaddingLeft;
sliderRect.width = rect.width - labelRect.width - sliderPaddingRight;
float newVal = GUI.HorizontalSlider(sliderRect, p.aperture.floatValue, HDPhysicalCamera.kMinAperture, HDPhysicalCamera.kMaxAperture);

// keep only 2 digits of precision, like the otehr editor fields
newVal = Mathf.Floor(100 * newVal) / 100.0f;

if (p.aperture.floatValue != newVal)
{
p.aperture.floatValue = newVal;
// Note: We need to move the focus when the slider changes, otherwise the textField will not update
GUI.FocusControl("ApertureSlider");
}

var unitRect = rect;
unitRect.x += rect.width - unitRectPaddingRight;
unitRect.width = textRectSize;
unitRect.height = EditorGUIUtility.singleLineHeight;
EditorGUI.LabelField(unitRect, "f /", EditorStyles.label);

var textRect = rect;
textRect.x = rect.width - textRectPaddingRight;
textRect.width = textRectSize;
textRect.height = EditorGUIUtility.singleLineHeight;
string newAperture = EditorGUI.TextField(textRect, p.aperture.floatValue.ToString());
try
{
p.aperture.floatValue = Mathf.Clamp(float.Parse(newAperture), HDPhysicalCamera.kMinAperture, HDPhysicalCamera.kMaxAperture);
}
catch
{ }
}

EditorGUILayout.EndHorizontal();
EditorGUILayout.Space(EditorGUIUtility.singleLineHeight);
EditorGUILayout.PropertyField(cam.lensShift, lensShiftContent);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ static partial class HDCameraUI
static readonly GUIContent renderingPathContent = EditorGUIUtility.TrTextContent("Custom Frame Settings", "Define the custom Frame Settings for this Camera to use.");

// TODO: Tooltips
static readonly GUIContent isoContent = EditorGUIUtility.TrTextContent("Iso");
static readonly GUIContent shutterSpeedContent = EditorGUIUtility.TrTextContent("Shutter Speed");
static readonly GUIContent apertureContent = EditorGUIUtility.TrTextContent("Aperture");
static readonly GUIContent bladeCountContent = EditorGUIUtility.TrTextContent("Blade Count");
static readonly GUIContent curvatureContent = EditorGUIUtility.TrTextContent("Curvature");
static readonly GUIContent barrelClippingContent = EditorGUIUtility.TrTextContent("Barrel Clipping");
static readonly GUIContent anamorphismContent = EditorGUIUtility.TrTextContent("Anamorphism");
static readonly GUIContent isoContent = EditorGUIUtility.TrTextContent("Iso", "Sets the light sensitivity of the Camera sensor. This property affects Exposure if you set its Mode to Use Physical Camera.");
static readonly GUIContent shutterSpeedContent = EditorGUIUtility.TrTextContent("Shutter Speed", "The amount of time the Camera sensor is capturing light.");
static readonly GUIContent apertureContent = EditorGUIUtility.TrTextContent("Aperture", "The f-stop (f-number) of the lens. Lower values give a wider lens aperture.");
static readonly GUIContent bladeCountContent = EditorGUIUtility.TrTextContent("Blade Count", "The number of blades in the lens aperture. Higher values give a rounder aperture shape.");
static readonly GUIContent curvatureContent = EditorGUIUtility.TrTextContent("Curvature", "Controls the curvature of the lens aperture blades. The minimum value results in fully-curved, perfectly-circular bokeh, and the maximum value results in visible aperture blades.");
static readonly GUIContent barrelClippingContent = EditorGUIUtility.TrTextContent("Barrel Clipping", "Controls the self-occlusion of the lens, creating a cat's eye effect.");
static readonly GUIContent anamorphismContent = EditorGUIUtility.TrTextContent("Anamorphism", "Use the slider to stretch the sensor to simulate an anamorphic look.");

static readonly GUIContent antialiasingContent = EditorGUIUtility.TrTextContent("Anti-aliasing", "The anti-aliasing method to use.");
static readonly GUIContent SMAAQualityPresetContent = EditorGUIUtility.TrTextContent("SMAA Quality Preset", "The quality preset for SMAA, low has the best performance but worst quality, High has the highest quality but worst performance.");
Expand Down