Skip to content

Commit 997e0c1

Browse files
committed
Fix depth of field being fully blurry in some projects
1 parent ad9fd02 commit 997e0c1

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
88

99
### Fixed
1010
- Viewport handling wasn't working correctly when FXAA or SMAA were used with builtin pipelines.
11+
- Depth of Field could end up fully blurry depending on the project setup.
1112

1213
### Changed
1314
- Warning for mobiles about using post-processing with non-fullscreen cameras.

PostProcessing/Runtime/Effects/DepthOfField.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ RenderTexture CheckHistory(int eye, int id, PostProcessRenderContext context, Re
164164

165165
public override void Render(PostProcessRenderContext context)
166166
{
167-
var colorFormat = context.sourceFormat;
167+
// The coc is stored in alpha so we need a 4 channels target. Note that using ARGB32
168+
// will result in a very weak near-blur.
169+
var colorFormat = context.camera.allowHDR ? RenderTextureFormat.ARGBHalf : RenderTextureFormat.ARGB32;
168170
var cocFormat = SelectFormat(RenderTextureFormat.R8, RenderTextureFormat.RHalf);
169171

170172
// Avoid using R8 on OSX with Metal. #896121, https://goo.gl/MgKqu6

0 commit comments

Comments
 (0)