This post is from a multi-part series titled “Hexagonal Bokeh Blur Revisited”. Want to jump directly to the index? If so, click here.
Another common artifact is the Y-shaped pattern of overlapping rhombi:
Y-shaped Artifact
From the first post in this series, you might remember our blur function:
float4 BlurTexture(sampler2D tex, float2 uv, float2 direction) { float4 finalColor = 0.0f; float blurAmount = 0.0f; // This offset is important. Will explain later. ;) uv += direction * 0.5f; for (int i = 0; i < NUM_SAMPLES; ++i) { float4 color = tex2D(tex, uv + direction * i); color *= color.a; blurAmount += color.a; finalColor += color; } return (finalColor / blurAmount); }
The half sample offset highlighted in bold shows how to prevent this issue.
Rhombi Overlap (Left) vs Proper Alignment (Right)
Steve Hill reminded me that this was actually mentioned in the notes on slide 15:
We also apply a half sample offset to stop overlapping rhombi. Otherwise you’ll end up with a double brightening artifact in an upside Y shape.
As you can see, it’s easily solvable! 😀
I couldn’t figure out how to see the speaker notes on Slideshare (which you link to here), but the PDF for the slides on the Advanced in Real-Time Rendering website also has them:
Click to access White,%20BarreBrisebois-%20Rendering%20in%20BF3%20(Siggraph%202011%20Advances%20in%20Real-Time%20Rendering%20Course).pdf
Thanks for writing this series! I hope you find time to continue it at some point 🙂