загрузка файла GLB и его текстур с помощью Sceneform (ARCore)

Я пытался загрузить файл GLB, но мне кажется, что его текстура не загружается, хотя файл PNG находится в той же папке assets.

Вот код:

val GLTF_ASSET = "model.glb"

ModelRenderable.builder()
            .setSource(
                this, RenderableSource.builder().setSource(
                    this,
                    Uri.parse(GLTF_ASSET),
                    RenderableSource.SourceType.GLB
                )
                    .setScale(0.5f)
                    .setRecenterMode(RenderableSource.RecenterMode.ROOT)
                    .build()
            )
            .setRegistryId(GLTF_ASSET)
            .build()
            .thenAccept {
                loadModel(it)
            }
            .exceptionally {
                val builder = AlertDialog.Builder(this)
                builder.setMessage(it.message)
                    .setTitle("error!")
                val dialog = builder.create()
                dialog.show()
                return@exceptionally null
            }

У меня в логах появляется такое сообщение:

W/ImpView: 1 textures declared in source assets were not found:
2019-10-17 17:30:48.453 22579-22682/com.example.arcore_test W/ImpView:  missing: '49264a5c-5cb7-44cf-bc52-04c4d26f0457.png'
2019-10-17 17:30:48.453 22579-22682/com.example.arcore_test W/ImpView:  (use -I to add other search folders)
2019-10-17 17:30:55.806 22579-22579/com.example.arcore_test W/Filament: setMaterialInstanceAt() on primitive 0 of Renderable at 1: declared attributes [POSITION, TANGENTS, UV0] do no satisfy required attributes [POSITION, TANGENTS, COLOR, UV0]
2019-10-17 17:30:55.806 22579-22579/com.example.arcore_test W/Filament: [instance=1, primitive @ 0] missing required attributes (0xf), declared=0xb
2019-10-17 17:30:55.806 22579-22579/com.example.arcore_test W/Filament: setMaterialInstanceAt() on primitive 1 of Renderable at 1: declared attributes [POSITION, TANGENTS, UV0] do no satisfy required attributes [POSITION, TANGENTS, COLOR, UV0]
2019-10-17 17:30:55.806 22579-22579/com.example.arcore_test W/Filament: [instance=1, primitive @ 1] missing required attributes (0xf), declared=0xb
2019-10-17 17:30:55.807 22579-22579/com.example.arcore_test W/Filament: setMaterialInstanceAt() on primitive 2 of Renderable at 1: declared attributes [POSITION, TANGENTS, UV0] do no satisfy required attributes [POSITION, TANGENTS, COLOR, UV0]
2019-10-17 17:30:55.807 22579-22579/com.example.arcore_test W/Filament: [instance=1, primitive @ 2] missing required attributes (0xf), declared=0xb
2019-10-17 17:30:55.807 22579-22579/com.example.arcore_test W/Filament: setMaterialInstanceAt() on primitive 3 of Renderable at 1: declared attributes [POSITION, TANGENTS, UV0] do no satisfy required attributes [POSITION, TANGENTS, COLOR, UV0]
2019-10-17 17:30:55.807 22579-22579/com.example.arcore_test W/Filament: [instance=1, primitive @ 3] missing required attributes (0xf), declared=0xb
2019-10-17 17:30:55.807 22579-22579/com.example.arcore_test W/Filament: setMaterialInstanceAt() on primitive 4 of Renderable at 1: declared attributes [POSITION, TANGENTS, UV0] do no satisfy required attributes [POSITION, TANGENTS, COLOR, UV0]
2019-10-17 17:30:55.807 22579-22579/com.example.arcore_test W/Filament: [instance=1, primitive @ 4] missing required attributes (0xf), declared=0xb
2019-10-17 17:30:55.807 22579-22579/com.example.arcore_test W/Filament: setMaterialInstanceAt() on primitive 5 of Renderable at 1: declared attributes [POSITION, TANGENTS, UV0] do no satisfy required attributes [POSITION, TANGENTS, COLOR, UV0]
2019-10-17 17:30:55.807 22579-22579/com.example.arcore_test W/Filament: [instance=1, primitive @ 5] missing required attributes (0xf), declared=0xb
2019-10-17 17:30:55.808 22579-22579/com.example.arcore_test W/Filament: setMaterialInstanceAt() on primitive 6 of Renderable at 1: declared attributes [POSITION, TANGENTS, UV0] do no satisfy required attributes [POSITION, TANGENTS, COLOR, UV0]
2019-10-17 17:30:55.808 22579-22579/com.example.arcore_test W/Filament: [instance=1, primitive @ 6] missing required attributes (0xf), declared=0xb

person gmartinsnull    schedule 18.10.2019    source источник


Ответы (1)


Обычно это означает, что в файле GLTF вы объявили текстуру ресурса, а путь для использования этой текстуры недействителен.

Убедитесь, что ваш файл GLTF был правильно упакован с включенными текстурами.

Мне кажется, что вы относитесь к этому как к файлам SFB или DAE, где у вас есть текстуры отдельно в файлах изображений. Попросите вашего дизайнера экспортировать их как упакованные текстуры, и все будет в порядке.

https://www.khronos.org/blog/art-pipeline-for-gltf

person Sam    schedule 13.11.2019
comment
оказывается, что GLB, похоже, не принимает текстуры, которые не встроены в 3D-модель. - person gmartinsnull; 20.11.2019
comment
На самом деле это имеет смысл, поскольку GLB - это скомпилированный GLTF, который вы обычно загружаете. - person Sam; 20.11.2019