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.81k stars 1.89k forks source link

How to upgrade a compiled matc file(without source mat file) to new matc format? #2579

Closed balarayen closed 4 years ago

balarayen commented 4 years ago

Describe the bug When upgrading sceneform-android-sdk which uses filament 1.4.5 to filament 1.60, it asserts in the following line:

2020-05-23 09:45:35.836 23295-23295/com.blippar.op E/Filament: in static filament::MaterialParser *filament::details::FMaterial::createParser(backend::Backend, const void *, size_t):493
    reason: could not parse the material package
2020-05-23 09:45:35.837 23295-23295/com.blippar.op A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x20 in tid 23295 (com.blippar.op), pid 23295 (com.blippar.op)

As mentioned in the filament release notes, the mat file has to be recompiled, but don't have the mat source file due to the following reason.

Background: Google has archived sceneform-android-sdk with many bugs and made it opensource. Unfortunately it didn't give the source of the important material files like (sceneform_camera_material.matc, sceneform_plane_shadow_material.matc, etc). Since the project is archived, I couldn't ask for the source file in the github.

Smartphone (please complete the following information):

Is there any way to compile the available matc and sfb files in the following link https://github.com/google-ar/sceneform-android-sdk/tree/master/sceneformsrc/sceneform/src/main/res/raw to the new matc format?

Please help.

romainguy commented 4 years ago

Unfortunately no. The matc files contain compiled shaders. The best you could do is download Filament 1.4.5 and use the bundled matinfo tool to extract information about the material file so you can attempt to rewrite it. The shader bits might be difficult however if the materials where compiled in optimized mode.

steven-gao commented 4 years ago

Describe the bug When upgrading sceneform-android-sdk which uses filament 1.4.5 to filament 1.60, it asserts in the following line:

2020-05-23 09:45:35.836 23295-23295/com.blippar.op E/Filament: in static filament::MaterialParser *filament::details::FMaterial::createParser(backend::Backend, const void *, size_t):493
    reason: could not parse the material package
2020-05-23 09:45:35.837 23295-23295/com.blippar.op A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x20 in tid 23295 (com.blippar.op), pid 23295 (com.blippar.op)

As mentioned in the filament release notes, the mat file has to be recompiled, but don't have the mat source file due to the following reason.

Background: Google has archived sceneform-android-sdk with many bugs and made it opensource. Unfortunately it didn't give the source of the important material files like (sceneform_camera_material.matc, sceneform_plane_shadow_material.matc, etc). Since the project is archived, I couldn't ask for the source file in the github.

Smartphone (please complete the following information):

  • Device: Pixel 2
  • OS: Android 10

Is there any way to compile the available matc and sfb files in the following link https://github.com/google-ar/sceneform-android-sdk/tree/master/sceneformsrc/sceneform/src/main/res/raw to the new matc format?

Please help.

do you fix this bug?I met same crash to you when i laydown a video model.

balarayen commented 4 years ago

When google made sceneform sdk open source in v1.16.0 which was causing this error had no source code of these precompiled matc files, so I couldn't upgrade the filament engine.

The time when I fixed this bug, I had to cherry pick some commits of filament to support gltf and as well as old matc format.

But you don't need to go through that hassle now because google has released the source code of the precompiled matc files in github https://github.com/google-ar/sceneform-android-sdk v1.17.1.

If you are using the latest version of sceneform sdk, you shouldn't be seeing this error.

steven-gao commented 4 years ago

When google made sceneform sdk open source in v1.16.0 which was causing this error had no source code of these precompiled matc files, so I couldn't upgrade the filament engine.

The time when I fixed this bug, I had to cherry pick some commits of filament to support gltf and as well as old matc format.

But you don't need to go through that hassle now because google has released the source code of the precompiled matc files in github https://github.com/google-ar/sceneform-android-sdk v1.17.1.

If you are using the latest version of sceneform sdk, you shouldn't be seeing this error.

i take your advice to dependency 1.17.1 version ,but the build is faild,because of : Unresolved reference: setIsFilamentGltf,there is no setIsFilamentGltf method for ModelRenderable.builder class. Would you pass me a copy of your sceneformsrc and sceneformux library? I have been troubled by this problem for several days。If you help me i will thank you very mush