PavelDoGreat / Super-Blur

Screen and UI gaussian blur for Unity
MIT License
843 stars 107 forks source link

Invalid pass number (1) for Graphics.Blit (Material "SuperBlurPostEffect" with 1 passes) #6

Closed domeniko-gentner closed 6 years ago

domeniko-gentner commented 6 years ago

Hi.

I am learning Unity right now and your package seemed like a good idea to get some blur going in a 2d game, to add some depth to the background.

I have added the script to the camera, as well as the materials, as outlined in the Readme.md. However, upon running my project, it says:

Invalid pass number (1) for Graphics.Blit (Material "SuperBlurPostEffect" with 1 passes) UnityEngine.Graphics:Blit(Texture, RenderTexture, Material, Int32) SuperBlur.SuperBlurBase:Blur(RenderTexture, RenderTexture) (at Assets/SuperBlur/Core/SuperBlurBase.cs:69) SuperBlur.SuperBlur:OnRenderImage(RenderTexture, RenderTexture) (at Assets/SuperBlur/SuperBlur.cs:24)

Invalid pass number (2) for Graphics.Blit (Material "SuperBlurPostEffect" with 1 passes) UnityEngine.Graphics:Blit(Texture, RenderTexture, Material, Int32) SuperBlur.SuperBlurBase:Blur(RenderTexture, RenderTexture) (at Assets/SuperBlur/Core/SuperBlurBase.cs:75) SuperBlur.SuperBlur:OnRenderImage(RenderTexture, RenderTexture) (at Assets/SuperBlur/SuperBlur.cs:24)

OnRenderImage() possibly didn't write anything to the destination texture!

Worth noting is, that I have 2 cameras. I have Maincamera for rendering the game and UI with "depth only" clear setting and CameraBackground for rendering the background only, which is on it's own layer. It is set to clear to solid color. I tried disabling the second camera and added the script to the first, same error occured, so I doubt that is the actual issue.

Unity Version is 5.6.3p2, Graphics: Sapphire Nitro+ RX480

I am not very savvy with Shaders, so I cannot offer you a patch, but if you can fix it, that would be awesome 👍

domeniko-gentner commented 6 years ago

Figured it out: Unity applied an error shader to the material, for whatever reason. One needs to apply "Custom/SuperBlur" shader to both materials, then it works :).