Hey y’all, this tutorial series is going to cover all of the techniques used to create the foggy window shader! There’s quite a bit going on, so we’re going to break it down into 3 parts:
- The Gaussian blur effect
- Writing & reading a texture
- Changing the blur based on the texture
At the end of each part, you’ll have a fully working shader, and you’ll learn techniques that you can reuse and adapt in other shaders!
A little disclaimer- this section does a really lazy application for the blur for the purposes of focusing on part 2 and 3. It’s most useful if you’ve never written a blur before and want to learn a really basic (but lazy) way of applying it in Unity. If you’re already a pro at writing a blur shader, then go ahead and move on to part 2!
Here’s the full code for the foggy window shader for you to reference. You’ll also need to look at the DrawOnTexture script for the C# part of this tutorial, and the blurring algorithm is in blur.cginc.
On with the tutorial 🙂