Skip to content

Commit 7ab1b0c

Browse files
Fixed range fields for depth of field #6285
1 parent 3a5b361 commit 7ab1b0c

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1818
- Fixed SpeedTree graph compatibility by removing custom interpolators.
1919
- Fixed edges and ghosting appearing on shadow matte due to the shadow being black outside the range of the light (case 1371441).
2020
- Fixed interpolation issue with wind orientation (case 1379841).
21+
- Fixed range fields for depth of field (case 1376609).
2122

2223
## [12.1.2] - 2021-10-22
2324

com.unity.render-pipelines.high-definition/Editor/PostProcessing/DepthOfFieldEditor.cs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,55 @@ void DrawFocusSettings(int mode)
117117
}
118118
else if (mode == (int)DepthOfFieldMode.Manual)
119119
{
120+
EditorGUI.BeginChangeCheck();
120121
PropertyField(m_NearFocusStart, Styles.k_NearFocusStart);
122+
if (EditorGUI.EndChangeCheck())
123+
{
124+
float maxBound = m_NearFocusEnd.overrideState.boolValue ? m_NearFocusEnd.value.floatValue :
125+
m_FarFocusStart.overrideState.boolValue ? m_FarFocusStart.value.floatValue :
126+
m_FarFocusEnd.overrideState.boolValue ? m_FarFocusEnd.value.floatValue : float.MaxValue;
127+
if (m_NearFocusStart.value.floatValue >= maxBound)
128+
m_NearFocusStart.value.floatValue = maxBound - 1e-5f;
129+
}
130+
131+
EditorGUI.BeginChangeCheck();
121132
PropertyField(m_NearFocusEnd, Styles.k_NearFocusEnd);
133+
if (EditorGUI.EndChangeCheck())
134+
{
135+
float minBound = m_NearFocusStart.overrideState.boolValue ? m_NearFocusStart.value.floatValue : float.MinValue;
136+
if (m_NearFocusEnd.value.floatValue <= minBound)
137+
m_NearFocusEnd.value.floatValue = minBound + 1e-5f;
138+
139+
float maxBound = m_FarFocusStart.overrideState.boolValue ? m_FarFocusStart.value.floatValue :
140+
m_FarFocusEnd.overrideState.boolValue ? m_FarFocusEnd.value.floatValue : float.MaxValue;
141+
if (m_NearFocusEnd.value.floatValue >= maxBound)
142+
m_NearFocusEnd.value.floatValue = maxBound - 1e-5f;
143+
}
144+
145+
EditorGUI.BeginChangeCheck();
122146
PropertyField(m_FarFocusStart, Styles.k_FarFocusStart);
147+
if (EditorGUI.EndChangeCheck())
148+
{
149+
float minBound = m_NearFocusEnd.overrideState.boolValue ? m_NearFocusEnd.value.floatValue :
150+
m_NearFocusStart.overrideState.boolValue ? m_NearFocusStart.value.floatValue : float.MinValue;
151+
if (m_FarFocusStart.value.floatValue <= minBound)
152+
m_FarFocusStart.value.floatValue = minBound + 1e-5f;
153+
154+
float maxBound = m_FarFocusEnd.overrideState.boolValue ? m_FarFocusEnd.value.floatValue : float.MaxValue;
155+
if (m_FarFocusStart.value.floatValue >= maxBound)
156+
m_FarFocusStart.value.floatValue = maxBound - 1e-5f;
157+
}
158+
159+
EditorGUI.BeginChangeCheck();
123160
PropertyField(m_FarFocusEnd, Styles.k_FarFocusEnd);
161+
if (EditorGUI.EndChangeCheck())
162+
{
163+
float minBound = m_FarFocusStart.overrideState.boolValue ? m_FarFocusStart.value.floatValue :
164+
m_NearFocusEnd.overrideState.boolValue ? m_NearFocusEnd.value.floatValue :
165+
m_NearFocusStart.overrideState.boolValue ? m_NearFocusStart.value.floatValue : float.MinValue;
166+
if (m_FarFocusEnd.value.floatValue <= minBound)
167+
m_FarFocusEnd.value.floatValue = minBound + 1e-5f;
168+
}
124169
}
125170
}
126171

0 commit comments

Comments
 (0)