Hi,
Is anyone aware of an approach or a shader that can blur UGUI Text? An image with a material that blurs whichever UGUI component is below it would be ideal, especially if it has an exposed parameter that controls the level of blur.
Generally I find a lot of information about shaders that can be put on a UI element to blur the (3D) background, but that’s not what I’m looking for. What I need is a way for the subtitles in my game to get blurred to the point of unreadability at certain specific moments. I’ve considered updating the font atlas so the individual glyphs are blurry, but I’ve dismissed that approach because I suspect the overlap would look badly, and ideally I would like to gradually transition from non-blurry to blurry text and back.
You can blur and unblur a texture by sampling it a bunch of times where each sample has small UV offsets from the others. Then average the samples together. This is sometimes called a filter kernel. If you set up a parameter that spreads and converges the UV offsets of all of the samples, you can control the blurring in real time. This is a somewhat expensive method because of the number of texture samples required. I explain it in this tutorial video:
In the case I’m showing in the video, I’m blurring the whole screen, but you can use this to blur a texture too if you just sample the texture instead of sampling the screen buffer.
Another method you could try is to store your text as a signed distance field (store the blurred version) and then use a parameter to control the blurriness/sharpness of the result of the field. I explain this technique in this video tutorial:
In this video, I’m explaining how to keep text sharp, but it might work in reverse and allow you to blur it as well.