загрузка файла GLB и его текстур с помощью Sceneform (ARCore) - PullRequest
0 голосов
/ 18 октября 2019

Я пытался загрузить файл 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

1 Ответ

0 голосов
/ 14 ноября 2019

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

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

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

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

...