I couldn’t find much info on a blur effect for the new stack so I’ve converted the old ‘Blur (Optimized)’ image effect over to work with the new Post Processing Stack v2. Just thought I’d post it here as I’ve seen a few requests for something similar
You did look at them? You get 3 places for now, but more may come in future. If that’s not acceptable you will need to clone the entire post effect and modify it extensively. From what I can see this is hardly necessary.
I thank you for the shader that I am using but I have some questions in case someone can help. After starting to use it we noticed a reproducible crash happening quite often. It’s a player crash, which means there is something wrong in the Unity code, but it’s related to this shader.
The crash happens inside the unityplayer.dll in the ShaderLab::TexEnv::SetTextureInfo function called by the SetupLightShaderProperties from inside ForwardRenderingLoopJob.
I don’t have the complete stack with my right now, but it should give a good idea.
The problem is that the shader is corrupted, the memory pointed by the shader is obviously rubbish. The editor actually manages to complain as well before the crash, giving this:
ArgumentException: Invalid shader ()
at UnityEngine.Rendering.PostProcessing.PropertySheetFactory.Get (UnityEngine.Shader shader) [0x00018] in C:\Users\rgent\AppData\Local\Unity\cache\packages[packages.unity.com](http://packages.unity.com/)\com.unity.postprocessing@2.0.7-preview\PostProcessing\Runtime\Utils\PropertySheetFactory.cs:30
at UnityEngine.Rendering.PostProcessing.BlurEffect.Render (UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context) [0x00085] in C:\Users\rgent\Perforce\rgent_RGent_Release_1.53\CardLifeUnity\Assets\Standard Assets\Blur.cs:50
at UnityEngine.Rendering.PostProcessing.PostProcessLayer.RenderList (System.Collections.Generic.List`1 list, UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context, System.String marker) [0x000ab] in C:\Users\rgent\AppData\Local\Unity\cache\packages[packages.unity.com](http://packages.unity.com/)\com.unity.postprocessing@2.0.7-preview\PostProcessing\Runtime\PostProcessLayer.cs:752
at UnityEngine.Rendering.PostProcessing.PostProcessLayer.RenderInjectionPoint (PostProcessEvent evt, UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context, System.String marker, Int32 releaseTargetAfterUse) [0x00049] in C:\Users\rgent\AppData\Local\Unity\cache\packages[packages.unity.com](http://packages.unity.com/)\com.unity.postprocessing@2.0.7-preview\PostProcessing\Runtime\PostProcessLayer.cs:720
at UnityEngine.Rendering.PostProcessing.PostProcessLayer.Render (UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context) [0x001dd] in C:\Users\rgent\AppData\Local\Unity\cache\packages[packages.unity.com](http://packages.unity.com/)\com.unity.postprocessing@2.0.7-preview\PostProcessing\Runtime\PostProcessLayer.cs:695
at UnityEngine.Rendering.PostProcessing.PostProcessLayer.BuildCommandBuffers () [0x003ad] in C:\Users\rgent\AppData\Local\Unity\cache\packages[packages.unity.com](http://packages.unity.com/)\com.unity.postprocessing@2.0.7-preview\PostProcessing\Runtime\PostProcessLayer.cs:437
at UnityEngine.Rendering.PostProcessing.PostProcessLayer.OnPreCull () [0x00096] in C:\Users\rgent\AppData\Local\Unity\cache\packages[packages.unity.com](http://packages.unity.com/)\com.unity.postprocessing@2.0.7-preview\PostProcessing\Runtime\PostProcessLayer.cs:294
Now I am 95% sure that this is due to the Shader.Find() failing to retrieve the right shader. I can still be wrong, I am investigating, but meanwhile I am asking this:
The PostProcessEffectRenderer Render method is not only called every frame, it’s even called when the editor is paused (why?). So
a) Shader.Find every frame? Is it wise?
b) why building a command buffer every frame?
Anyhow, I just remember(although not tested yet) that the shader is not in the resource folder, so very likely that;s the problem, but my previous observations are still valid. Furthermore Unity should really warn about this mistake and not crash.
Am I only one who has this issue?
I’m not really into shaders, but its not working -_-
Shader error in 'Hidden/Legacy/Blur': failed to open source file: '../../PostProcessing/Shaders/StdLib.hlsl' at line 6 (on d3d11)
Compiling Vertex program
Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING
Maybe code became legacy after some time? Or am I doing something wrong?
@vmp1r3
I had the same issue in 2018.2.10f1 with version 2.0.17-preview of the post-processing stack. Changing the line #include **"../../PostProcessing/Shaders/StdLib.hlsl"**
to: #include "PostProcessing/Shaders/StdLib.hlsl"
fixed it.
If that doesn’t work, try **#include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl"**
instead.
It works for me ! I tried first to move the files inside the package cache, but I got an error talking about missing meta files due to read only.
btw I wanted to have the HDR support for the blur (to exceed 0-1 values), to have that you only need to add “RenderTextureFormat.DefaultHDR” on every “GetTemporaryRT” call.