- Home /
How to blur entire scene but a specific spot?
What I want is basically: A way to blur every object/sprite on the scene, but have a "blur-free" circular zone, that can move. And everything that's behind that circular zone won't have the blur effect applied to it.
In a 2D mobile game, how would I do that, especially in a way that's not too heavy, performance-wise(if possible).
And if it's not possible to do that in a way that won't completely destroy my performance, I also have those sprites already "pre-blurred" so maybe there's a way to have both blurred and "unblurred" objects at the same position, and only draw the right parts of them as they go through the scene and reach the blur-free zone. If there's a way to do that, that'd also help immensely.
Thanks for your time.
Answer by CesarNascimento · Jan 22, 2016 at 02:15 PM
I managed to solve my problem. I used the shaders from this post: http://forum.unity3d.com/threads/sprite-renderer-mask-on-specific-sorting-layer.356824/#post-2310992
And a simple grey circle for the "blur-free" circular zone. The pre-blurred sprites used the "Stencil Draw In Mask" one, the regular sprites used a shader that was the same as the above, but with Ref set to 1, and the grey circle used the Stencil Mask. While my draw calls doubled, as there was 2 times the amount of objects on scene, the performance impact wasn't as great as if I used a shader to blur the entire scene.
Thanks for your attention.
Answer by Mikea15 · Jan 20, 2016 at 11:01 PM
This is probably not the best answer you'll get but, I think it can be helpful. Gamasutra as a nice article on 2D portals . I think you can use this technique to have a blurred "layer" and a circular area that sees through the blur layer ;)
Your answer
![](https://koobas.hobune.stream/wayback/20220612060940im_/https://answers.unity.com/themes/thub/images/avi.jpg)