Skip to content

Commit fb40599

Browse files
committed
Improved quality with odd number screen resolution
- Changed to use point sampling in downsampler. - Removed the warning message.
1 parent bf9c617 commit fb40599

File tree

3 files changed

+1
-31
lines changed

3 files changed

+1
-31
lines changed

Assets/Kino/Bokeh/Bokeh.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ void OnRenderImage(RenderTexture source, RenderTexture destination)
209209

210210
// Pass #1 - Downsampling, prefiltering and CoC calculation
211211
var rt1 = RenderTexture.GetTemporary(width / 2, height / 2, 0, format);
212+
source.filterMode = FilterMode.Point;
212213
Graphics.Blit(source, rt1, _material, 0);
213214

214215
// Pass #2 - Bokeh simulation

Assets/Kino/Bokeh/Editor/BokehEditor.cs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ public class BokehEditor : Editor
3838
SerializedProperty _kernelSize;
3939
SerializedProperty _visualize;
4040

41-
bool _warnOddNumber;
42-
4341
static GUIContent _labelPointOfFocus = new GUIContent(
4442
"Point Of Focus",
4543
"Transform that represents the point of focus."
@@ -75,14 +73,6 @@ public class BokehEditor : Editor
7573
"Visualize the depths as red (focused), green (far) or blue (near)."
7674
);
7775

78-
static string _textOddNumberWarning = "Odd number screen width or height may introduce artifacts.";
79-
80-
bool CheckOddNumber()
81-
{
82-
var camera = ((Component)target).GetComponent<Camera>();
83-
return (camera.pixelWidth & 1) != 0 || (camera.pixelHeight & 1) != 0;
84-
}
85-
8676
void OnEnable()
8777
{
8878
_pointOfFocus = serializedObject.FindProperty("_pointOfFocus");
@@ -92,23 +82,6 @@ void OnEnable()
9282
_focalLength = serializedObject.FindProperty("_focalLength");
9383
_kernelSize = serializedObject.FindProperty("_kernelSize");
9484
_visualize = serializedObject.FindProperty("_visualize");
95-
_warnOddNumber = CheckOddNumber();
96-
EditorApplication.update += Update;
97-
}
98-
99-
void OnDisable()
100-
{
101-
EditorApplication.update -= Update;
102-
}
103-
104-
void Update()
105-
{
106-
var oddNumberFlag = CheckOddNumber();
107-
if (_warnOddNumber != oddNumberFlag)
108-
{
109-
_warnOddNumber = oddNumberFlag;
110-
Repaint();
111-
}
11285
}
11386

11487
public override void OnInspectorGUI()
@@ -154,10 +127,6 @@ public override void OnInspectorGUI()
154127
// Visualize
155128
EditorGUILayout.PropertyField(_visualize, _labelVisualize);
156129

157-
// Odd number screen width/height warning
158-
if (_warnOddNumber)
159-
EditorGUILayout.HelpBox(_textOddNumberWarning, MessageType.Warning);
160-
161130
serializedObject.ApplyModifiedProperties();
162131
}
163132
}

KinoBokeh.unitypackage

-258 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)