NokiMo
pucklovesgames
pucklovesgames

patreon


Rain shader (with blurry refractions) FILES

Here's a rain shader that uses a blurred screen texture (done via a command buffer) to create a bloomed light refracting through the drops. As its base, it's using the blurry refraction example from here ( https://docs.unity3d.com/Manual/GraphicsCommandBuffers.html ).

The particle system has CommandBufferBlurRefractionHDR.cs (a version of the script in the command buffer example, tweaked to allow an HDR render texture) on it, which adds the command buffer to the main camera (capturing the screen, blurring it, then setting it as a global render texture called "_GrabBlurTexture".

The script lets you change the blur scale and also the render texture format (if you're not using bloom or tone mapping, you could bump this down to the default ARGB32). The rest of the settings are on the shader of the rain particles.

It's very much a first pass at this effect - I haven't done any performance testing yet, and I intend to continue to tweak and improve it.

It also requires the project to be in Linear colour space, not Gamma, but honestly that's something you should be in anyway! Edit -> Project Settings -> Player -> Other Settings -> Rendering, Color Space. So if things look wrong when you import it, check your colour space first. This isn't a requirement of the effect, just the way the command buffer blur is working, I'm sure I can fix the visual issues that spring up if you're using Gamma... but again, why? Linear is best ;)

I feel like I can get a pretty decent approximation of this effect without using a blurry screen grab at all, which I'm guessing will be a bit more performant, but until I do some comparison testing I can't be sure. I'll upload that version soon as well.

Here's a gif of the version just using Light Attenuation and a vanilla screengrab (and also less particles).


If you have any feedback on how well this works (or doesn't work) for you, please let me know - Command Buffers are still fairly new to me.



Rain shader (with blurry refractions) FILES

Comments

Hi Anthony, thanks! The only thing that's actually stopping it from working in Gamma space is the blur shader itself afaik, which I got from the Unity Command Buffer example link. If you can find a more compatible blur shader that you can drop in to the "Blur Shader" slot of the Command Buffer Blur Refraction HDR script, then it should work. I'll have a look and see if I can get it working for you, but I might not be able to do it right away sorry.

Puck Loves Games

Hi Ed, I absolutely adore this effect. Any chance you're still able to make this work fully with Gamma (one compromise I found is setting the blur scale to 0)? There's a specific look I can only achieve for my project using Gamma color space and I would like to incorporate this effect...


Related Creators