Render in main pass AR (Android)

Hi! I’m trying to do invisible occluder in my Handheld AR project. When I disable “Render in main pass” and enable “Render in Depth pass” I expect the cube become transparent and it will occlude the red objects but it only works when I enable Custom depth too, more over it’s only works in editor, when i hit play button it stop working.How should I hide object but still use it as occluder for oter actors?

[Images][1]Imgur: The magic of the Internet

Ok, I solved this problem myself. There is ARCoreOcclusionMaterial in GoogleARCore Content that helps occlude objects in vitrtual space. But it needs some improvements to work clear, you can’t just put this material to the object and have fun.

First you need to add Custon sRGB to linear convrersion in this material to fit camera image with unreal tonemapped image. Code of this node (or just node) you can find in GoogleARCorePassthroughCameraMaterial.

After this you have to update parameters from material parameter collection. In ARCoreUtils function library you can find UpdateARCoreOcclusionMaterialInstance that you need to call every frame. Just for test I did it in my Static mesh actor.

Now I finally have invisible occluders in my android mobile project.

1 Like

Hey, Can you share a small demo of this project through Git or something else, I am not able to understand this segment at all about How to use Google Passthrough Camera Mat and how does that tie-in with ARcore functionality
Any help is appreciated.

Hello, where to find ARCoreOcclusionMaterial in GoogleARCore Content? GitHub or where?

Still waiting for this

for 5.1.1 I find these 3:
M_ScreenSpacePassthroughCamera
M_PassthroughCamera
M_SceneDepthOcclussion

I dont know wich one was the one faulty one

I just modify them and after “apply” the changes rollback them this seems to force the material to be build correctly.

know I have the doubt of how many other material need to be “modified” to fix them

to find them you need to change the setting of the content bowser

3 Likes

THANK YOU SO MUCH!

This worked for me, I just moved the nodes around a bit, so it would be marked as dirty and I could hit the ‘Apply’ button. And then repackaged everything.

1 Like

Anyone made this work in 5.4.3? I tried everything mentioned earlier, but after building and running it on my android smartphone it crashes after a few seconds with the following errors:

LogPlayLevel: Error: UAT: 08-14 12:47:14.715  8045  8476 D UE      : [2024.08.14-10.47.14:715][  0]LogRHI: Error: External compile of program Program V_B58E8C744DCFBE26F25919EDC8F510C1E8DA7F84_P_D7AEFE3F468E47AF378D6EFF5651BE0D7FF9A6DA failed: Failed to compile shader type: pixel shader log: 0:68: L0001: Typename expected, found 'samplerExternalOES'

LogPlayLevel: Error: UAT: 08-14 12:47:16.766  8045  8208 D UE      : [2024.08.14-10.47.16:766][  1]LogGoogleARCore: Error: SetCameraTextureIds 4 textures

LogPlayLevel: Error: UAT: 08-14 12:47:17.533  8045  8465 D UE      : [2024.08.14-10.47.17:533][ 19]LogRHI: Error: Shader:

… lots of shader code …

LogPlayLevel: Error: UAT: 08-14 12:47:17.533  8045  8465 D UE      : [2024.08.14-10.47.17:533][ 19]LogRHI: Error: Failed to compile shader. Compile log:
LogPlayLevel: UAT: 08-14 12:47:17.533  8045  8465 D UE      : 0:68: L0001: Typename expected, found 'samplerExternalOES'
LogPlayLevel: UAT: 08-14 12:47:17.533  8045  8465 D UE      : Ensure condition failed: bSuccessfullyCompiled [File:./Runtime/OpenGLDrv/Private/OpenGLShaders.cpp] [Line: 761]
LogPlayLevel: UAT: 08-14 12:47:17.533  8045  8465 D UE      :
LogPlayLevel: UAT: 08-14 12:47:17.581  8045  8465 D UE      : [2024.08.14-10.47.17:581][ 20]LogStats: FPlatformStackWalk::StackWalkAndDump -  0.048 s
LogPlayLevel: Error: UAT: 08-14 12:47:17.581  8045  8465 D UE      : [2024.08.14-10.47.17:581][ 20]LogOutputDevice: Error: === Handled ensure: ===
LogPlayLevel: Error: UAT: 08-14 12:47:17.581  8045  8465 D UE      : [2024.08.14-10.47.17:581][ 20]LogOutputDevice: Error:
LogPlayLevel: Error: UAT: 08-14 12:47:17.581  8045  8465 D UE      : [2024.08.14-10.47.17:581][ 20]LogOutputDevice: Error: Ensure condition failed: bSuccessfullyCompiled  [File:./Runtime/OpenGLDrv/Private/OpenGLShaders.cpp] [Line: 761]
LogPlayLevel: Error: UAT: 08-14 12:47:17.581  8045  8465 D UE      : [2024.08.14-10.47.17:581][ 20]LogOutputDevice: Error:
LogPlayLevel: Error: UAT: 08-14 12:47:17.581  8045  8465 D UE      : [2024.08.14-10.47.17:581][ 20]LogOutputDevice: Error: Stack:
LogPlayLevel: Error: UAT: 08-14 12:47:17.581  8045  8465 D UE      : [2024.08.14-10.47.17:581][ 20]LogOutputDevice: Error: [Callstack] 0x00000077DB4A4E04 libUnreal.so(0x00000000113F0E04)!FOpenGLShader::Compile(unsigned int)  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.581  8045  8465 D UE      : [2024.08.14-10.47.17:581][ 20]LogOutputDevice: Error: [Callstack] 0x00000077DB4B0D04 libUnreal.so(0x00000000113FCD04)![Unknown]()  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.581  8045  8465 D UE      : [2024.08.14-10.47.17:581][ 20]LogOutputDevice: Error: [Callstack] 0x00000077DB4AF384 libUnreal.so(0x00000000113FB384)!FOpenGLDynamicRHI::RHICreateBoundShaderState_OnThisThread(FRHIVertexDeclaration*, FRHIVertexShader*, FRHIPixelShader*, FRHIGeometryShader*, bool)  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.581  8045  8465 D UE      : [2024.08.14-10.47.17:581][ 20]LogOutputDevice: Error: [Callstack] 0x00000077DB47743C libUnreal.so(0x00000000113C343C)!FOpenGLDynamicRHI::RHICreateBoundShaderState_internal(FRHIVertexDeclaration*, FRHIVertexShader*, FRHIPixelShader*, FRHIGeometryShader*, bool)  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.581  8045  8465 D UE      : [2024.08.14-10.47.17:581][ 20]LogOutputDevice: Error: [Callstack] 0x00000077DB477170 libUnreal.so(0x00000000113C3170)!FOpenGLDynamicRHI::RHISetGraphicsPipelineState(FRHIGraphicsPipelineState*, unsigned int, bool)  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.581  8045  8465 D UE      : [2024.08.14-10.47.17:581][ 20]LogOutputDevice: Error: [Callstack] 0x00000077D59E57F8 libUnreal.so(0x000000000B9317F8)!FRHICommand<FRHICommandSetGraphicsPipelineState, FRHICommandSetGraphicsPipelineStateString1672>::ExecuteAndDestruct(FRHICommandListBase&, FRHICommandListDebugContext&)  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.581  8045  8465 D UE      : [2024.08.14-10.47.17:581][ 20]LogOutputDevice: Error: [Callstack] 0x00000077D5A15348 libUnreal.so(0x000000000B961348)!FRHICommandListBase::Execute(TRHIPipelineArray<IRHIComputeContext*>&, FRHICommandListBase::FPersistentState::FGPUStats*)  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.581  8045  8465 D UE      : [2024.08.14-10.47.17:581][ 20]LogOutputDevice: Error: [Callstack] 0x00000077D5A56344 libUnreal.so(0x000000000B9A2344)![Unknown]()  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.581  8045  8465 D UE      : [2024.08.14-10.47.17:581][ 20]LogOutputDevice: Error: [Callstack] 0x00000077D3C8CA90 libUnreal.so(0x0000000009BD8A90)!TGraphTask<TFunctionGraphTaskImpl<void (), (ESubsequentsMode::Type)0> >::ExecuteTask(TArray<FBaseGraphTask*, TSizedDefaultAllocator<32> >&, ENamedThreads::Type, bool)  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.581  8045  8465 D UE      : [2024.08.14-10.47.17:581][ 20]LogOutputDevice: Error: [Callstack] 0x00000077D3C9AF68 libUnreal.so(0x0000000009BE6F68)!FNamedTaskThread::ProcessTasksNamedThread(int, bool)  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.581  8045  8465 D UE      : [2024.08.14-10.47.17:581][ 20]LogOutputDevice: Error: [Callstack] 0x00000077D3C9940C libUnreal.so(0x0000000009BE540C)!FNamedTaskThread::ProcessTasksUntilQuit(int)  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.581  8045  8465 D UE      : [2024.08.14-10.47.17:581][ 20]LogOutputDevice: Error: [Callstack] 0x00000077D5BEE794 libUnreal.so(0x000000000BB3A794)!FRHIThread::Run()  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.581  8045  8465 D UE      : [2024.08.14-10.47.17:581][ 20]LogOutputDevice: Error: [Callstack] 0x00000077D3E95F90 libUnreal.so(0x0000000009DE1F90)!FRunnableThreadPThread::Run()  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.581  8045  8465 D UE      : [2024.08.14-10.47.17:581][ 20]LogOutputDevice: Error: [Callstack] 0x00000077D3C915F8 libUnreal.so(0x0000000009BDD5F8)!FRunnableThreadPThread::_ThreadProc(void*)  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.581  8045  8465 D UE      : [2024.08.14-10.47.17:581][ 20]LogOutputDevice: Error: [Callstack] 0x0000007B2F762FC0 libc.so(0x000000000006EFC0)![Unknown]()  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.581  8045  8465 D UE      : [2024.08.14-10.47.17:581][ 20]LogOutputDevice: Error: [Callstack] 0x0000007B2F754D64 libc.so(0x0000000000060D64)![Unknown]()  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.581  8045  8465 D UE      : [2024.08.14-10.47.17:581][ 20]LogOutputDevice: Error:
LogPlayLevel: UAT: 08-14 12:47:17.588  8045  8465 D UE      : [2024.08.14-10.47.17:588][ 20]LogStats:                SubmitErrorReport -  0.000 s
LogPlayLevel: UAT: 08-14 12:47:17.588  8045  8465 D UE      : [2024.08.14-10.47.17:588][ 20]LogStats:                    SendNewReport -  0.000 s
LogPlayLevel: UAT: 08-14 12:47:17.588  8045  8465 D UE      : [2024.08.14-10.47.17:588][ 20]LogStats:             FDebug::EnsureFailed -  0.055 s
LogPlayLevel: Error: UAT: 08-14 12:47:17.589  8045  8465 D UE      : [2024.08.14-10.47.17:589][ 20]LogRHI: Error: Failed to link program. Current total programs: 209 program binary bytes, last gl error 0x0, drvalloc 2664948
LogPlayLevel: UAT: 08-14 12:47:17.589  8045  8465 D UE      :   log:
LogPlayLevel: UAT: 08-14 12:47:17.589  8045  8465 D UE      : Link failed because of invalid fragment shader.
LogPlayLevel: Error: UAT: 08-14 12:47:17.611  8045  8465 D UE      : Fatal error: [File:./Runtime/OpenGLDrv/Private/OpenGLShaders.cpp] [Line: 2976]
LogPlayLevel: UAT: 08-14 12:47:17.611  8045  8465 D UE      : Failed to link program [Program V_B58E8C744DCFBE26F25919EDC8F510C1E8DA7F84_P_D7AEFE3F468E47AF378D6EFF5651BE0D7FF9A6DA]. Current total programs: 209, precompile: 0
LogPlayLevel: Error: UAT: 08-14 12:47:17.611  8045  8465 D UE      : [2024.08.14-10.47.17:611][ 20]Fatal error: [File:./Runtime/OpenGLDrv/Private/OpenGLShaders.cpp] [Line: 2976]

and a few lines later

LogPlayLevel: Error: UAT: 08-14 12:47:17.611  8045  8465 D UE      : [2024.08.14-10.47.17:611][ 20]LogAndroid: Error: === Critical error: ===
LogPlayLevel: Error: UAT: 08-14 12:47:17.611  8045  8465 D UE      : [2024.08.14-10.47.17:611][ 20]LogAndroid: Error:
LogPlayLevel: Error: UAT: 08-14 12:47:17.611  8045  8465 D UE      : [2024.08.14-10.47.17:611][ 20]LogAndroid: Error: Fatal error: [File:./Runtime/OpenGLDrv/Private/OpenGLShaders.cpp] [Line: 2976]
LogPlayLevel: Error: UAT: 08-14 12:47:17.612  8045  8465 D UE      : [2024.08.14-10.47.17:611][ 20]LogAndroid: Error: Failed to link program [Program V_B58E8C744DCFBE26F25919EDC8F510C1E8DA7F84_P_D7AEFE3F468E47AF378D6EFF5651BE0D7FF9A6DA]. Current total programs: 209, precompile: 0
LogPlayLevel: Error: UAT: 08-14 12:47:17.612  8045  8465 D UE      : [2024.08.14-10.47.17:612][ 20]LogAndroid: Error: [Callstack] 0x00000077DB4B04F0 libUnreal.so(0x00000000113FC4F0)!FOpenGLDynamicRHI::RHICreateBoundShaderState_OnThisThread(FRHIVertexDeclaration*, FRHIVertexShader*, FRHIPixelShader*, FRHIGeometryShader*, bool)  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.612  8045  8465 D UE      : [2024.08.14-10.47.17:612][ 20]LogAndroid: Error: [Callstack] 0x00000077DB47743C libUnreal.so(0x00000000113C343C)!FOpenGLDynamicRHI::RHICreateBoundShaderState_internal(FRHIVertexDeclaration*, FRHIVertexShader*, FRHIPixelShader*, FRHIGeometryShader*, bool)  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.612  8045  8465 D UE      : [2024.08.14-10.47.17:612][ 20]LogAndroid: Error: [Callstack] 0x00000077DB477170 libUnreal.so(0x00000000113C3170)!FOpenGLDynamicRHI::RHISetGraphicsPipelineState(FRHIGraphicsPipelineState*, unsigned int, bool)  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.612  8045  8465 D UE      : [2024.08.14-10.47.17:612][ 20]LogAndroid: Error: [Callstack] 0x00000077D59E57F8 libUnreal.so(0x000000000B9317F8)!FRHICommand<FRHICommandSetGraphicsPipelineState, FRHICommandSetGraphicsPipelineStateString1672>::ExecuteAndDestruct(FRHICommandListBase&, FRHICommandListDebugContext&)  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.612  8045  8465 D UE      : [2024.08.14-10.47.17:612][ 20]LogAndroid: Error: [Callstack] 0x00000077D5A15348 libUnreal.so(0x000000000B961348)!FRHICommandListBase::Execute(TRHIPipelineArray<IRHIComputeContext*>&, FRHICommandListBase::FPersistentState::FGPUStats*)  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.612  8045  8465 D UE      : [2024.08.14-10.47.17:612][ 20]LogAndroid: Error: [Callstack] 0x00000077D5A56344 libUnreal.so(0x000000000B9A2344)![Unknown]()  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.612  8045  8465 D UE      : [2024.08.14-10.47.17:612][ 20]LogAndroid: Error: [Callstack] 0x00000077D3C8CA90 libUnreal.so(0x0000000009BD8A90)!TGraphTask<TFunctionGraphTaskImpl<void (), (ESubsequentsMode::Type)0> >::ExecuteTask(TArray<FBaseGraphTask*, TSizedDefaultAllocator<32> >&, ENamedThreads::Type, bool)  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.612  8045  8465 D UE      : [2024.08.14-10.47.17:612][ 20]LogAndroid: Error: [Callstack] 0x00000077D3C9AF68 libUnreal.so(0x0000000009BE6F68)!FNamedTaskThread::ProcessTasksNamedThread(int, bool)  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.612  8045  8465 D UE      : [2024.08.14-10.47.17:612][ 20]LogAndroid: Error: [Callstack] 0x00000077D3C9940C libUnreal.so(0x0000000009BE540C)!FNamedTaskThread::ProcessTasksUntilQuit(int)  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.612  8045  8465 D UE      : [2024.08.14-10.47.17:612][ 20]LogAndroid: Error: [Callstack] 0x00000077D5BEE794 libUnreal.so(0x000000000BB3A794)!FRHIThread::Run()  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.612  8045  8465 D UE      : [2024.08.14-10.47.17:612][ 20]LogAndroid: Error: [Callstack] 0x00000077D3E95F90 libUnreal.so(0x0000000009DE1F90)!FRunnableThreadPThread::Run()  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.612  8045  8465 D UE      : [2024.08.14-10.47.17:612][ 20]LogAndroid: Error: [Callstack] 0x00000077D3C915F8 libUnreal.so(0x0000000009BDD5F8)!FRunnableThreadPThread::_ThreadProc(void*)  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.612  8045  8465 D UE      : [2024.08.14-10.47.17:612][ 20]LogAndroid: Error: [Callstack] 0x0000007B2F762FC0 libc.so(0x000000000006EFC0)![Unknown]()  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.612  8045  8465 D UE      : [2024.08.14-10.47.17:612][ 20]LogAndroid: Error: [Callstack] 0x0000007B2F754D64 libc.so(0x0000000000060D64)![Unknown]()  []
LogPlayLevel: Error: UAT: 08-14 12:47:17.612  8045  8465 D UE      : [2024.08.14-10.47.17:612][ 20]LogAndroid: Error:
LogPlayLevel: Error: UAT: 08-14 12:47:17.612  8045  8465 D UE      : [2024.08.14-10.47.17:612][ 20]LogAndroid: Error:
LogPlayLevel: Error: UAT: 08-14 12:47:17.612  8045  8465 D UE      : [2024.08.14-10.47.17:612][ 20]LogAndroid: Error:
LogPlayLevel: Error: UAT: 08-14 12:47:17.612  8045  8465 D UE      : [2024.08.14-10.47.17:612][ 20]LogAndroid: Error:

Any ideas, what may cause this issue?