Saturday, February 13, 2016

Everything is a blur

So I just added a blur filter, to let the player know where is the fear meter currently.

How to add blur effect to the camera in Unity 5 free version?

The way I did was pretty simple: clicked on Assets -> Import package -> Effects, selected BlurOptimized and PostEffectBase from Standard Assets/Effects/ImageEffects/Scripts, and selected MobileBlur from Standard Assets/Effects/ImageEffects/Shaders/_BloomAndFlares.

Then, added BlurOptimized to the camera as a component.

Now, since I don't want blurring just at the start of the game, I set the sliders to their minimal value. Then went into the Player component, and in the Update function, I added this code:

// Change main camera's blur to reflect fear level
Camera.main.GetComponent<UnityStandardAssets.ImageEffects.BlurOptimized>().blurSize = fearLevel * 10f;

(Gif in full post)



Basically, that's it. Gif:


No comments:

Post a Comment