首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用Sceneform (ARCore)加载GLB文件及其纹理

用Sceneform (ARCore)加载GLB文件及其纹理
EN

Stack Overflow用户
提问于 2019-10-18 00:49:59
回答 1查看 2.2K关注 0票数 1

我一直试图加载一个GLB文件,但它的纹理似乎不会加载,即使我在同一个资产文件夹中有PNG文件。

下面是代码:

代码语言:javascript
复制
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
            }

我在日志里看到了这样的信息:

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

发布于 2019-11-13 23:47:47

这通常意味着在GLTF文件中,您已经声明了一个资源纹理,并且使用该纹理的路径无效。

确认你的GLTF文件是正确包装的纹理包括。

在我看来,你对待这像SFB文件或DAE文件,在图像文件中你有单独的纹理。让你的设计师出口他们的包装纹理,你应该是好的。

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

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58442511

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档