Masked blurring

Hey all.

I’m wondering if anyone has worked on this before and might offer some insight.

I’m thinking about how to implement a sniper view that does a masked blur, basically it blurs the area outside of the scope such that the scope has a zoomed in focus and the surrounding world view is blurred. My instinct is to implement it with a post process effect using a depthoffield modification, but I’m not entirely sure. Anyone tried it?


Make a Gaussian x and Gaussian y shader and use them in the post processing chain, surely the framebuffer gets updated after each custom post processing… You should scale the blur width by a gradient texture to mask the blur, that should do what you are asking for. Hopefully I’m right that the framebuffer ‘postprocessinput0’ gets updated after each postprocess material has rendered, if so then it will work.

Please don’t simply lerp the blur, because that’ll look bad compared to using a mask to size the kernel… :slight_smile:

If the gradient texture isn’t what you want, make a mask using custom depth (render only in focus stuff there and Ceil the buffer to make a mask) and use that. You could even just render normal depth and have proper depth of field with a bit of different code to avoid blur bleeding…