Three.js materialLoader doesn't load embedded texture image

本秂侑毒 提交于 2019-12-12 09:06:39

问题


I'm exporting a three.js material using material.toJSON() provided method, this is the result:

{
"metadata":{"version":4.5,"type":"Material","generator":"Material.toJSON"},
"uuid":"8E6F9A32-1952-4E12-A099-632637DBD732",
"type":"MeshStandardMaterial",
"color":11141120,
"roughness":1,
"metalness":0.5,
"emissive":0,
"map":"876D3309-43AD-4EEE-946F-A8AE8BA53C9E",
"transparent":true,"depthFunc":3,"depthTest":true,"depthWrite":true,

"textures":[
    {
        "uuid":"876D3309-43AD-4EEE-946F-A8AE8BA53C9E",
        "name":"",
        "mapping":300,
        "repeat":[1,1],
        "offset":[0,0],
        "center":[0,0],
        "rotation":0,
        "wrap":[1001,1001],
        "minFilter":1008,
        "magFilter":1006,
        "anisotropy":1,
        "flipY":true,
        "image":"C6B4FEDA-8E7E-490A-A1AD-866ECE36E952"}],

"images":[
{
    "uuid":"C6B4FEDA-8E7E-490A-A1AD-866ECE36E952",
    "url":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAEACAYAAADFkM5nAAAg[...]"
}]}

I try to use MaterialLoader as the example suggest

https://threejs.org/docs/#api/loaders/MaterialLoader

but at parsing time I always get this error

THREE.MaterialLoader: Undefined texture 876D3309-43AD-4EEE-946F-A8AE8BA53C9E

I'm I wrong if I expect from the MaterialLoader to use the embedded resources? I'm doing it wrong or missing something? How can I also load the images in the json file into the related texture?

Thanks!

here a fiddle: http://jsfiddle.net/akmcv7Lh/211/

来源:https://stackoverflow.com/questions/47168553/three-js-materialloader-doesnt-load-embedded-texture-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!