A screen blur effect for Unity/C#
Asset Store Link
HRP version
non-ShaderGraph version
© 2022 Justin Garza
PLEASE LEAVE A REVIEW OR RATE THE PACKAGE IF YOU FIND IT USEFUL! Enjoy! :)
My Contact info is on my github profile
https://github.com/jgarza9788
Required: please follow Unity's EULA
Suggestion/Optional: please put my name in the credits, or in the special thanks section. :)
You need to set up your project to use a URP Asset.
Note: you might need to make your own URP_Asset if there is not one that matches the unity version.
Note:
"Opaque Texture" gives us the ability to access _CameraOpaqueTexture, a texture of what the main camera sees (but this texture will not have transparent objects (like Sprites) within it)
if you need sprites and non-opaque to show up in the blur, please see the Demo_Basic(Sprites).scene
You can actual use nearly any image you want.
So if you don't want to use a second camera, consider a static image.
In addition, you can change the Size and Color Format of your RenderTexture.
reducing the size and optimizing it.
To use the shader on the UI, just use the material.
(or create you're own material and use my shader)
CustomTexture:
pass in any texture (image) you'd like (i.e. a Render Texture or 2D Texture)
useCameraOpaqueTexture:
this will be used as a default texture for blurring.
note: this will not render transparent (Sprite and non-Opaque) objects (you might want to use a Render Texture)
BlurScale:
This is how much to blur the texture.
(This will automatically adjust two other variables)
Lightness:
how light or dark the UI should be.
Tint:
a color tint to be applied to the UI.
Saturation:
adjusts the saturation (color) of the UI.
This will use the Source Image.
So you can fade the blur depending on where it is on the screen.
see Demo_UIEffect.scene:
The Source Image is our map to know how much to blur the edges and the center.
This is for Objects in the WorldSpace.
see Demo_3DModel.scene for an example.
note:
The Layer should be set to BlurObject.
Metallic & Smoothness:
these are used to adjust the shinny-ness of the object.
if this is not working we might want to double check our custom-renderer. it's in *\GaussianBlur_URP\Assets\URP
Here are the settings for the custom-renderer.
these scenes shows how we can blur only a piece of the image.
In the ShaderGraph we are creating a mask.
we are controlling the about of blur and other items with shader properties and Animator Component.
these videos go in deal on how the ShaderGraphs work.
please watch these if you plan to create your own remix of the shader.
GaussianBlur_UI Video
GaussianBlur_WS Video
GaussianBlur_UIEffect Video
by default by Shader will be using the _CameraOpaqueTexture, this texture only contains Opaque Objects. However we can use whatever Texture we want.
please read the Set Up (for Transparent objects) section above.
Most of the time this is just caused by the settings in the URP_Asset or the settings you picked in the shader.
please review the settings and make sure they are ok.
Try re-downloading the asset and/or Contact me for help.
Try deleting the Asset\Settings folder.
This folder was created when the URP project was created.
I'm not sure why this causes an issue with the project,
but it fixes the project sometimes.
this asset can be adjusted for multiple Blur Layers, however there are a few issues with adjusting this asset for Blurred Layers.