2
\$\begingroup\$

I'm unable to use a UI image blur effect when I'm also using a grayscale post-processing effect on my camera.

I activate the grayscale post-processing effect when the game is paused, which is also when I show my pause menu, which is a UI panel with a blur shader.

When the grayscale effect is enabled, the UI panel is invisible. It's there, because all my text/buttons show fine. It's just the portion the blur shader applies to, has become fully transparent.

When the grayscale effect is disabled, my panel shows fine, with the blur working as expected.

Here is the grayscale post-processing effect I'm using by Alan Zucconi. I have this on my Main Camera, and it is enabled when my game is paused.

Here is the blur shader I'm using by vinipc, modified from cician, whose blur shader is commonly used by Unity users.

I'm not sure why these would conflict. My guess is that somehow the blur effect is seeing empty/fully transparent colors and therefore is also transparent?

\$\endgroup\$
3
  • \$\begingroup\$ Is your Pause Menu being rendered in Screen Space - Overlay mode? Or a different mode? \$\endgroup\$
    – DMGregory
    Commented Dec 16, 2017 at 18:37
  • \$\begingroup\$ Yes. I have a Canvas set to Screen Space - Overlay. That has a child empty game object, which holds the panel with the blur shader, and the text/images. \$\endgroup\$
    – BotskoNet
    Commented Dec 16, 2017 at 18:43
  • \$\begingroup\$ @BotskoNet when you create image effect in unity it have three thing : Cull Off And ZWrite Off And ZTest Always // No culling or depth \$\endgroup\$ Commented Dec 21, 2017 at 7:33

1 Answer 1

1
+50
\$\begingroup\$

Add ZTest always to your UI Blur shader this make it Always Top!!

How should depth testing be performed. Default is LEqual (draw objects in from or at the distance as existing objects; hide objects behind them).

or

Add ZWrite Off to your ImageEffect shader

Controls whether pixels from this object are written to the depth buffer (default is On). If you’re drawng solid objects, leave this on. If you’re drawing semitransparent effects, switch to ZWrite Off. For more details read below.

https://docs.unity3d.com/Manual/SL-CullAndDepth.html


One solution is using two cameras

1.Make secondary camera

2.On second camera, in Clear Flags set it to Don't clear

image

image

From what I observe, many Unity users do not grasp the concept of using multiple Unity cameras on a single scene. “If I want to look from only one perspective, why do I need more than one camera?”. Saying that it makes perfect sense when more than one camera captures the scene from the same perspective makes it even more confusing. So why even bother? The reason is somewhat complex, but it’s really worth learning. It will help you create great visual effects, that are hard to accomplish with the use of only one camera, in an easy way. http://blog.theknightsofunity.com/using-multiple-unity-cameras-why-this-may-be-important/


One interesting thing :)

2017-12-21_8-08-34 if you want filter Image Effect to specific objects you can do this:

1.Make secondary camera

2.On second camera, in Clear Flags set it to Depth only

3.Create new Layer and set it to some objects, then select camera and change culling mask.

I solve this problem and place in my Github you can download it from Here

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .