Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit 63c13b3

Browse files
committed
Improved quality with odd number screen resolution
1 parent e604e4f commit 63c13b3

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

PostProcessing/Runtime/Components/DepthOfFieldComponent.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ public void Prepare(RenderTexture source, Material uberMaterial, bool antialiasC
8888
var rcpAspect = (float)source.height / source.width;
8989
material.SetFloat(Uniforms._RcpAspect, rcpAspect);
9090

91-
var rt1 = context.renderTextureFactory.Get(context.width / 2, context.height / 2, 0, RenderTextureFormat.ARGBHalf, filterMode: FilterMode.Bilinear);
91+
var rt1 = context.renderTextureFactory.Get(context.width / 2, context.height / 2, 0, RenderTextureFormat.ARGBHalf);
92+
source.filterMode = FilterMode.Point;
9293

9394
// Pass #1 - Downsampling, prefiltering and CoC calculation
9495
Graphics.Blit(source, rt1, material, 0);
@@ -97,7 +98,7 @@ public void Prepare(RenderTexture source, Material uberMaterial, bool antialiasC
9798
var pass = rt1;
9899
if (antialiasCoC)
99100
{
100-
pass = context.renderTextureFactory.Get(context.width / 2, context.height / 2, 0, RenderTextureFormat.ARGBHalf, filterMode: FilterMode.Bilinear);
101+
pass = context.renderTextureFactory.Get(context.width / 2, context.height / 2, 0, RenderTextureFormat.ARGBHalf);
101102

102103
if (m_CoCHistory == null || !m_CoCHistory.IsCreated() || m_CoCHistory.width != context.width / 2 || m_CoCHistory.height != context.height / 2)
103104
{
@@ -123,7 +124,7 @@ public void Prepare(RenderTexture source, Material uberMaterial, bool antialiasC
123124
}
124125

125126
// Pass #3 - Bokeh simulation
126-
var rt2 = context.renderTextureFactory.Get(context.width / 2, context.height / 2, 0, RenderTextureFormat.ARGBHalf, filterMode: FilterMode.Bilinear);
127+
var rt2 = context.renderTextureFactory.Get(context.width / 2, context.height / 2, 0, RenderTextureFormat.ARGBHalf);
127128
Graphics.Blit(pass, rt2, material, 1 + (int)settings.kernelSize);
128129

129130
if (context.profile.debugViews.IsModeActive(DebugMode.FocusPlane))
@@ -143,6 +144,7 @@ public void Prepare(RenderTexture source, Material uberMaterial, bool antialiasC
143144
context.renderTextureFactory.Release(pass);
144145

145146
context.renderTextureFactory.Release(rt1);
147+
source.filterMode = FilterMode.Bilinear;
146148
}
147149

148150
public override void OnDisable()

0 commit comments

Comments
 (0)