4.15p4 BUG CustomStencil crash on mobile

If I enable custom stencil in the project setting and set the proper postprocessing material using customstencil,the game will crash both in ios/android vulkan preview es3.1 and on real mobile devices(at least it crashes on my iphone7 plus and galaxy s7edge):here’s the crash log in mobile preview es3.1:

LoginId:
EpicAccountId:

Fatal error: [File:D:\Build++UE4+Release-4.15+Compile\Sync\Engine\Source\Runtime\Engine\Private\Materials\MaterialShared.cpp] [Line: 1805]
Couldn’t find Shader FDepthOnlyPS for Material Resource M_Swordman!
With VF=TGPUSkinVertexFactorytrue, Platform=PCD3D_ES31
ShouldCache: Mat=1, VF=1, Shader=0
MaterialUsageDesc: LightingModel=MSM_DefaultLit, BlendMode=BLEND_Opaque, SpecialEngine=0, TwoSided=0, TSNormal=1, Masked=0, Distorted=0, WritesEveryPixel=1, ModifiesMeshPosition=1, Usage={bUsedWithSkeletalMesh}

UE4Editor_Core!FDebug::AssertFailed() [d:\build++ue4+release-4.15+compile\sync\engine\source\runtime\core\private\misc\assertionmacros.cpp:349]
UE4Editor_Engine!FMaterial::GetShader() [d:\build++ue4+release-4.15+compile\sync\engine\source\runtime\engine\private\materials\materialshared.cpp:1796]
UE4Editor_Renderer!FDepthDrawingPolicy::FDepthDrawingPolicy() [d:\build++ue4+release-4.15+compile\sync\engine\source\runtime\renderer\private\depthrendering.cpp:326]
UE4Editor_Renderer!FDepthDrawingPolicyFactory::DrawMesh() [d:\build++ue4+release-4.15+compile\sync\engine\source\runtime\renderer\private\depthrendering.cpp:735]
UE4Editor_Renderer!FDepthDrawingPolicyFactory::DrawDynamicMesh() [d:\build++ue4+release-4.15+compile\sync\engine\source\runtime\renderer\private\depthrendering.cpp:785]
UE4Editor_Renderer!FCustomDepthPrimSet::DrawPrims() [d:\build++ue4+release-4.15+compile\sync\engine\source\runtime\renderer\private\customdepthrendering.cpp:54]
UE4Editor_Renderer!FSceneRenderer::RenderCustomDepthPass() [d:\build++ue4+release-4.15+compile\sync\engine\source\runtime\renderer\private\scenerendering.cpp:1536]
UE4Editor_Renderer!FMobileSceneRenderer::Render() [d:\build++ue4+release-4.15+compile\sync\engine\source\runtime\renderer\private\mobileshadingrenderer.cpp:183]
UE4Editor_Renderer!RenderViewFamily_RenderThread() [d:\build++ue4+release-4.15+compile\sync\engine\source\runtime\renderer\private\scenerendering.cpp:1728]
UE4Editor_Renderer!TGraphTask<FRendererModule::BeginRenderingViewFamily'::21’::EURCMacro_FDrawSceneCommand>::ExecuteTask() [d:\build++ue4+release-4.15+compile\sync\engine\source\runtime\core\public\async\taskgraphinterfaces.h:883]
UE4Editor_Core!FNamedTaskThread::ProcessTasksNamedThread() [d:\build++ue4+release-4.15+compile\sync\engine\source\runtime\core\private\async\taskgraph.cpp:954]
UE4Editor_Core!FNamedTaskThread::ProcessTasksUntilQuit() [d:\build++ue4+release-4.15+compile\sync\engine\source\runtime\core\private\async\taskgraph.cpp:701]
UE4Editor_RenderCore!RenderingThreadMain() [d:\build++ue4+release-4.15+compile\sync\engine\source\runtime\rendercore\private\renderingthread.cpp:325]
UE4Editor_RenderCore!FRenderingThread::Run() [d:\build++ue4+release-4.15+compile\sync\engine\source\runtime\rendercore\private\renderingthread.cpp:459]
UE4Editor_Core!FRunnableThreadWin::Run() [d:\build++ue4+release-4.15+compile\sync\engine\source\runtime\core\private\windows\windowsrunnablethread.cpp:76]

!

Hi ,

I wasn’t able to get a crash with the material you provided. Here are the steps I took. Feel free to correct me if my test has any errors.

  • Open a new blank project set for Mobile on high quality
  • Add post process material into content folder provided by
  • In the scene add a post process volume and apply the post process material to the volume (make the volume unbound)
  • In the project settings enable custom stencil with custom depth
  • Select the default floor mesh and check “render custom depth” and assign stencil value of 1
  • change the preview rendering level to all of the high end settings (iOS Metal, Android Vulkan, Default High End Mobile,Android GLES3_1)

RESULT
The rendering preview changed and the floor mesh had a green outline from the custom stencil pass.

EXPECTED
Same as result.

for your test!By the way,did you click the play button after changing the preview rendering level,if you click the play button then the editor will crash in es3.1 mode.

I looked in our crash database and the crash you are getting is unique to you. There may be something in your project or engine source files that may have gotten corrupted. First try these steps to see if it fixes the issue.

1. Delete The following folders and then try testing for the crash

  • Intermediate
  • Saved
  • Config (deleting this folder will result in having to re-enter all values for your Editor and Project Settings. So make a copy somewhere safe!)

2. Disable Plugins

If that doesn’t do the trick try waiting for 4.15 to be released and reinstall the engine. It should be out very soon!
If the problem persists past this point let me know and we can continue.

,

! After further investigation, I have found the main cause. It has nothing to do with the corrupted files. This issue is only affected by the WorldPositionOffset Node in the material.

To create this crash, just create a new material and add a const3vector node and plug that into the WorldPositionOffset Node. And apply that to the model. Then after playing in the es3.1 preview or just click apply that material, the crash will occur immediately.

Good News ,

Okay, so I was able to start reproducing the crash reliably. This crash will only occur when this criteria is met.

  • You have enabled custom depth with stencils in the project settings
  • A mesh in the scene is rendering to custom depth with a stencil value of 1
  • The mesh has a material applied that is using WPO
  • You are in a High-End Mobile preview level (ES3_1)

I have logged the report for this issue here: Unreal Engine Issues and Bug Tracker (UE-41976)

You can track the report’s status as the issue is reviewed by our development staff. Please be aware that this issue may not be prioritized or fixed soon.

Cheers,