Skip to content

Commit

Permalink
lens blur shader fix
Browse files Browse the repository at this point in the history
  • Loading branch information
YuAo committed Oct 8, 2018
1 parent 881523d commit 3edb4c8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Frameworks/MetalPetal/Shaders/LensBlur.metal
Expand Up @@ -61,7 +61,7 @@ namespace metalpetal {
float4 color2 = sampleWithDelta(colorTexture, colorSampler, vertexIn.textureCoordinate, delta1 * coc);
LensBlurAlphaPassOutput output;
output.vertical = float4(color1.rgb, coc);
output.diagonal = float4((color2 + color1).rgb * 0.5, coc);
output.diagonal = float4((color2 + color1).rgb, coc);
return output;
}

Expand Down

6 comments on commit 3edb4c8

@obs1dium
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems to increase output image brightness quite a bit, leading to blown out highlights in my test images

@YuAo
Copy link
Member Author

@YuAo YuAo commented on 3edb4c8 Oct 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don’t do this the bokeh shape is not hexagonal. Ref. https://colinbarrebrisebois.com/2017/04/18/hexagonal-bokeh-blur-revisited-part-2-improved-2-pass-version/

BTW, can you attach your test image?

@YuAo
Copy link
Member Author

@YuAo YuAo commented on 3edb4c8 Oct 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@obs1dium fixed the over exposure problem. 223e30e

@obs1dium
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm quite sure it was hexagonal before. Let me run some tests with the new code.

@YuAo
Copy link
Member Author

@YuAo YuAo commented on 3edb4c8 Oct 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before:
screen shot 2018-10-10 at 6 13 56 pm

After:
screen shot 2018-10-10 at 6 14 20 pm

@obs1dium
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just ran some tests and got the same results as you.

Before: Artifact in top left part of hexagon
img_0035

First fix: Too bright
img_0036

Latest commit: Correct brightness and no artifact
img_0037

Thanks for the fix!

Please sign in to comment.