Skip to content

加载有贴图的gltf文件会报错 #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
majie1202 opened this issue Apr 16, 2020 · 15 comments
Open

加载有贴图的gltf文件会报错 #15

majie1202 opened this issue Apr 16, 2020 · 15 comments

Comments

@majie1202
Copy link

e = TypeError: Cannot read property 'URL' of undefined at GLTFParser.loadTexture (http://127.0.0.1:22948/appservice/libs/gltf-loader.js:1723:24) at GLTFParser.getDependency (http://127.0.0.1:22948/appservice/libs/gltf-loader.js:1489:31) at GLTFParser.assignTexture (http://127.0.0.1:22948/appservice/libs/gltf-loader.js:1812:19) at GLTFParser.loadMaterial (http://127.0.0.1:22948/appservice/libs/gltf-loader.js:2001:31) at GLTFParser.getDependency (http://127.0.0.1:22948/appservice/libs/gltf-loader.js:1485:31) at GLTFParser.loadMesh (http://127.0.0.1:22948/appservice/libs/gltf-loader.js:2218:94) at GLTFParser.getDependency (http://127.0.0.1:22948/appservice/libs/gltf-loader.js:1469:31) at http://127.0.0.1:22948/appservice/libs/gltf-loader.js:2550:31 at GLTFParser.loadNode (http://127.0.0.1:22948/appservice/libs/gltf-loader.js:2603:8) at GLTFParser.getDependency (http://127.0.0.1:22948/appservice/libs/gltf-loader.js:1465:31)

@ele828
Copy link
Collaborator

ele828 commented May 21, 2020

方便提供下模型文件看看吗

@chenqincheng
Copy link

gltf-loader.js 文件的大概1966 行 loadTexture方法;
1.有window对象,报错;
2.Blob对象,目前微信小程序还不支持;

@chenqincheng
Copy link

@ele828

@Ivorzk
Copy link

Ivorzk commented Jun 6, 2020

gltf-loader.js 文件的大概1966 行 loadTexture方法;
1.有window对象,报错;
2.Blob对象,目前微信小程序还不支持;

所以,现在还有办法解决此问题不?

@iguoxing
Copy link

iguoxing commented Dec 21, 2020

gltf-loader.js 文件的大概1966 行 loadTexture方法;
1.有window对象,报错;
2.Blob对象,目前微信小程序还不支持;

看到你的仓库里有类似的解决方案,但不知道texture_loader.js如何用,求大神指点~

@iguoxing
Copy link

@chenqincheng

@deepkolos
Copy link

已支持小程序加载GLB polyfill https://github.com/deepkolos/three-platformize

@sanyuered
Copy link

sanyuered commented Feb 24, 2021

《关于gltf模型加载贴图的问题》
#5

《带贴图的模型加载出问题》
#6

《TextureLoader真机加载图片失败》
#2

@deepkolos
Copy link

@sanyuered 可以尝试 https://github.com/deepkolos/three-platformize

已测试模块
Loader

GLTFLoader (支持带纹理的 GLB) && (EXT_meshopt_compression 安卓可用WASM,ios可用ASM版,见tools) && (KHR_mesh_quantization,小程序可用)
TextureLoader
RGBELoader & PMREMGenerator (小程序部分机型可能偶现生成 envMap 错误,可用HDRPrefilter避免 )
SVGLoader
OBJLoader
EXRLoader (需支持 OES_texture_float_linear 扩展,部分移动端 GPU 不支持)
MTLLoader (小程序使用 JPG 纹理即可)
DDSLoader (需支持 WEBGL_compressed_texture_s3tc 扩展,移动端 GPU 不支持)
LWOLoader (需支持 EXT_blend_minmax 扩展,小程序一半效果绘制出错)
FBXLoader
BVHLoader
ColladaLoader (TGALoader 尚未适配)
TTFLoader
STLLoader
PDBLoader

Controls

OrbitControls & MapControls
DeviceOrientationControls

@SunXinFei
Copy link

https://github.com/deepkolos/three-platformize 为什么不能参考这个解决一下呢

@mydaoyuan
Copy link

https://github.com/deepkolos/three-platformize 为什么不能参考这个解决一下呢 (悲伤)

@mydaoyuan
Copy link

模型用 blender 导出的时候选 gltf 分离,导出后就是一个 gltf文件,一个贴图,一个 bin 文件,于是就可以加载 gltf 文件了。
不过模型用在 VKSession 里面的时候,还是会展示错误,不知道是不是修改了 着色器相关的内容

@SunXinFei
Copy link

最后three用的threejs-miniprogram,gltf参考了https://github.com/deepkolos/three-platformize,搞的微信小程序AR

@mydaoyuan
Copy link

最后three用的threejs-miniprogram,gltf参考了https://github.com/deepkolos/three-platformize,搞的微信小程序AR

噢噢,老哥你是参考 three-platformize 项目,重写了 gltfloader 是吗?

@SunXinFei
Copy link

最后three用的threejs-miniprogram,gltf参考了https://github.com/deepkolos/three-platformize,搞的微信小程序AR

噢噢,老哥你是参考 three-platformize 项目,重写了 gltfloader 是吗?

是的,让threejs-miniprogram和three-platformize的gltfloader结合一起

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants