Unity3D WebGL Build Errors: Resolving Auto Exposure (Kernel 'KEyeHistogramClear' not found) and Ambient Occlusion ('MultiScaleVODownSample1' not found) Challenges

If your Unity3D project has post-processing with auto-exposure and ambient occlusion enabled settings, and you try to port the Unity project for a WebGL build, then you will definitely encounter errors related to Auto-exposure or ambient occlusion.

The error details may look like this:

Error - Kernel 'MultiScaleVODownsample1' not found

ArgumentException: Kernel 'MultiScaleVODownsample1' not found.
UnityEngine.Rendering.PostProcessing.MultiScaleVO.PushDownsampleCommands (UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Camera camera, System.Nullable`1[T] depthMap, System.Boolean isMSAA) (at ./Library/PackageCache/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/MultiScaleVO.cs:290)
UnityEngine.Rendering.PostProcessing.MultiScaleVO.GenerateAOMap (UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Camera camera, UnityEngine.Rendering.RenderTargetIdentifier destination, System.Nullable`1[T] depthMap, System.Boolean invert, System.Boolean isMSAA) (at ./Library/PackageCache/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/MultiScaleVO.cs:195)
UnityEngine.Rendering.PostProcessing.MultiScaleVO.RenderAfterOpaque (UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context) (at ./Library/PackageCache/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Effects/MultiScaleVO.cs:531)
UnityEngine.Rendering.PostProcessing.PostProcessLayer.BuildCommandBuffers () (at ./Library/PackageCache/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessLayer.cs:599)
UnityEngine.Rendering.PostProcessing.PostProcessLayer.OnPreCull () (at ./Library/PackageCache/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessLayer.cs:487)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
Post-process error in the console in WebGL mode.

This happens due to the mode of the Ambient Occlusion when its mode is set to Multi-Scale Volumetric Obscurance. It uses a compute shader that is not supported by OpenGL ES 3 which Unity uses for WebGL build.

Or if the Auto Exposure is enabled in the Post-processing profile then, you get the below error:

Error - Kernel 'KEyeHistogramClear' not found

ArgumentException: Kernel 'KEyeHistogramClear' not found.
UnityEngine.Rendering.PostProcessing.LogHistogram.Generate (UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context) (at ./Library/PackageCache/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/Utils/LogHistogram.cs:25)
UnityEngine.Rendering.PostProcessing.PostProcessLayer.RenderBuiltins (UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context, System.Boolean isFinalPass, System.Int32 releaseTargetAfterUse, System.Int32 eye) (at ./Library/PackageCache/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessLayer.cs:1248)
UnityEngine.Rendering.PostProcessing.PostProcessLayer.Render (UnityEngine.Rendering.PostProcessing.PostProcessRenderContext context) (at ./Library/PackageCache/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessLayer.cs:1085)
UnityEngine.Rendering.PostProcessing.PostProcessLayer.BuildCommandBuffers () (at ./Library/PackageCache/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessLayer.cs:693)
UnityEngine.Rendering.PostProcessing.PostProcessLayer.OnPreCull () (at ./Library/PackageCache/com.unity.postprocessing@3.2.2/PostProcessing/Runtime/PostProcessLayer.cs:487)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

This happens due to Auto Exposure. The problem is the Compute shader which is not supported by WebGL. There is a sign that it will be supported as WebGPU is arriving in the new release of Unity 6, but it is still experimental. WebGPU will bring Compute shader to the web for the first time, so I hope we will be able to use the same post-process profile in the WebGL Player which Unity has decided to call UnityWeb in the near future.

Solution:

The solution to this problem is to simply create a new post-process profile without auto-exposure and ambient occlusion. If you want to use ambient occlusion, then you have to use the scalable ambient obscurrence mode instead of Multi-scale.

Remember, if you keep getting errors in the console, make sure to create a new profile instead of updating the old one. Because the auto-exposure or ambient occlusion from the post-process profile causes problems even if you delete it in WebGL. The reason is unknown to me; if you know about it, please let me know in the comments.

Post a Comment

0 Comments