google / filament

Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2
https://google.github.io/filament/
Apache License 2.0
17.82k stars 1.89k forks source link

iOS sample "hello-ar" crash on startup #7985

Closed linconz closed 3 months ago

linconz commented 3 months ago

Describe the bug Crash on startup,I don't know what happen,but the camera is OK, because I can see the image on screen.

To Reproduce Just build,and run.

Logs

2024-07-21 22:24:11.600062+0800 hello-ar[21718:23261722] [SceneConfiguration] Info.plist contained no UIScene configuration dictionary (looking for configuration named "(no name)")
2024-07-21 22:24:11.600126+0800 hello-ar[21718:23261722] [SceneConfiguration] Info.plist contained no UIScene configuration dictionary (looking for configuration named "(no name)")
2024-07-21 22:24:11.606964+0800 hello-ar[21718:23261722] Metal GPU Frame Capture Enabled
2024-07-21 22:24:11.607111+0800 hello-ar[21718:23261722] Metal API Validation Enabled
FEngine (64 bits) created at 0x106829000 (threading is enabled)
FEngine resolved backend: Metal
Selected physical device 'Apple A14 GPU'
Supported GPU families: 
  MTLGPUFamilyCommon3
  MTLGPUFamilyApple7
Features:
  readWriteTextureSupport: true
Backend feature level: 3
FEngine feature level: 1
Requested linear format but KTX contains a sRGB format. 
PanicLog
in void utils::panic(const char *, const char *, int, const char *):34
in file /Users/zhang/workfolder/github/filament/libs/utils/src/debug.cpp
reason: /Users/zhang/workfolder/github/filament/filament/src/ShadowMap.cpp:1211: failed assertion 'transpose(viewMatrix)[3] == float4(0, 0, 0, 1)'

#0  hello-ar                               0x1043e9384 utils::CallStack::update(unsigned long) + 32
#1  hello-ar                               0x1043e932c utils::CallStack::unwind(unsigned long) + 44
#2  hello-ar                               0x104400b08 utils::details::panicLog(char const*, char const*, int, char const*, ...) + 220
#3  hello-ar                               0x1043e6c44 utils::panic(char const*, char const*, int, char const*) + 92
#4  hello-ar                               0x1041d24a4 filament::ShadowMap::SceneInfo::SceneInfo(filament::FScene const&, unsigned char, filament::math::details::TMat44<float> const&) + 264
#5  hello-ar                               0x1041d2868 filament::ShadowMap::SceneInfo::SceneInfo(filament::FScene const&, unsigned char, filament::math::details::TMat44<float> const&) + 52
#6  hello-ar                               0x1041d7148 filament::ShadowMapManager::update(filament::ShadowMapManager::Builder const&, filament::FEngine&, filament::FView&, filament::CameraInfo const&, utils::StructureOfArraysBase<utils::Arena<utils::HeapAllocator, utils::LockingPolicy::NoLock, utils::TrackingPolicy::Untracked, utils::AreaPolicy::HeapArea>, utils::EntityInstance<filament::RenderableManager, false>, filament::math::details::TMat44<float>, filament::FRenderableManager::Visibility, filament::FRenderableManager::SkinningBindingInfo, filament::FRenderableManager::MorphingBindingInfo, filament::FRenderableManager::InstancesInfo, filament::math::details::TVec3<float>, unsigned char, unsigned char, unsigned char, filament::math::details::TVec3<float>, utils::Slice<filament::FRenderPrimitive>, unsigned int, filament::PerRenderableData, float>&, utils::StructureOfArraysBase<utils::Arena<utils::HeapAllocator, utils::LockingPolicy::NoLock, utils::TrackingPolicy::Untracked, utils::AreaPolicy::HeapArea>, fi#7  hello-ar                               0x1042929c4 filament::FView::prepareShadowing(filament::FEngine&, utils::StructureOfArraysBase<utils::Arena<utils::HeapAllocator, utils::LockingPolicy::NoLock, utils::TrackingPolicy::Untracked, utils::AreaPolicy::HeapArea>, utils::EntityInstance<filament::RenderableManager, false>, filament::math::details::TMat44<float>, filament::FRenderableManager::Visibility, filament::FRenderableManager::SkinningBindingInfo, filament::FRenderableManager::MorphingBindingInfo, filament::FRenderableManager::InstancesInfo, filament::math::details::TVec3<float>, unsigned char, unsigned char, unsigned char, filament::math::details::TVec3<float>, utils::Slice<filament::FRenderPrimitive>, unsigned int, filament::PerRenderableData, float>&, utils::StructureOfArraysBase<utils::Arena<utils::HeapAllocator, utils::LockingPolicy::NoLock, utils::TrackingPolicy::Untracked, utils::AreaPolicy::HeapArea>, filament::math::details::TVec4<float>, filament::math::details::TVec3<float>, filament::math::#8  hello-ar                               0x1042934b4 filament::FView::prepare(filament::FEngine&, filament::backend::CommandStream&, utils::ArenaScope<utils::Arena<utils::LinearAllocator, utils::LockingPolicy::NoLock, utils::TrackingPolicy::DebugAndHighWatermark, utils::AreaPolicy::HeapArea> >&, filament::Viewport, filament::CameraInfo, filament::math::details::TVec4<float> const&, bool) + 952
#9  hello-ar                               0x10425adc8 filament::FRenderer::renderJob(utils::ArenaScope<utils::Arena<utils::LinearAllocator, utils::LockingPolicy::NoLock, utils::TrackingPolicy::DebugAndHighWatermark, utils::AreaPolicy::HeapArea> >&, filament::FView&) + 2624
#10 hello-ar                               0x10425a1cc filament::FRenderer::renderInternal(filament::FView const*) + 136
#11 hello-ar                               0x10425a314 filament::FRenderer::render(filament::FView const*) + 288
#12 hello-ar                               0x1041be64c filament::Renderer::render(filament::View const*) + 52
#13 hello-ar                               0x104130b2c FilamentApp::render(FilamentApp::FilamentArFrame const&) + 492
#14 hello-ar                               0x104135610 -[FilamentArViewController session:didUpdateFrame:] + 2744
#15 ARKitCore                              0x1cd34a3dc <redacted> + 44
#16 libdispatch.dylib                      0x10590453c _dispatch_call_block_and_release + 32
#17 libdispatch.dylib                      0x105905ff0 _dispatch_client_callout + 20

Smartphone (please complete the following information):

bejado commented 3 months ago

Thanks, I've noticed this issue recently too. @pixelflinger this assertion fires when the view matrix we get from ARKit has a slight error in it, i.e., the fourth column is something like float4(0, 0, 0, .999999). Can we remove that assertion? We already require model matrices to be rigid transforms:

https://github.com/google/filament/blob/9057c47a566dbcbba96bcfa3ec0a51eb1d5e1736/filament/include/filament/Camera.h#L407

pixelflinger commented 3 months ago

Thanks, I've noticed this issue recently too. @pixelflinger this assertion fires when the view matrix we get from ARKit has a slight error in it, i.e., the fourth column is something like float4(0, 0, 0, .999999). Can we remove that assertion? We already require model matrices to be rigid transforms:

https://github.com/google/filament/blob/9057c47a566dbcbba96bcfa3ec0a51eb1d5e1736/filament/include/filament/Camera.h#L407

Sounds good