Hi everyone!
I am trying to load an .obj and .mtl file and .png textures from a url containing a zip file. The zip file contents are all the .png textures, .mtl file and the .obj file.
I am not getting any errors in the console. The output that I am getting is the loaded model, except that its all black, it seems to be that for some reason it is not loading or referencing the textures correctly.
Please let me know if I can provide any further information, any help would be greatly appreciated.
Below is my implementation, I did not include all lights and scene to keep the example concise.
state.processedModel = processed3dModel;
state.scene = new THREE.Scene();
state.scene.background = new THREE.Color(0xf0f0f0);
const data = await JSZipUtils.getBinaryContent(state.processedModel.zip_test);
const zip = new JSZip();
const unzippedFiles = await zip.loadAsync(data);
const loadingManager = new THREE.LoadingManager();
const urls=[]
loadingManager.setURLModifier(url => {
if(!urls.includes(url)){
urls.push(url);
var enc = new TextEncoder("utf-8");
const buffer = enc.encode(url); //Uint8Array
const blob = new Blob( [ buffer] );
const NewUrl = URL.createObjectURL( blob );
return NewUrl
}
});
const mtlLoader = new MTLLoader(loadingManager);
const mtlAsString = await unzippedFiles.file('castleGPU/texturedMesh.mtl' ).async("string");
const materials = mtlLoader.parse(mtlAsString );
const materialArray = materials.getAsArray();
const objAsString = await unzippedFiles.file( 'castleGPU/texturedMesh.obj' ).async("string");
const object = new OBJLoader();
object.setMaterials(materials);
state.mesh = object.parse(objAsString);
state.scene.add( state.mesh );
Just in case, this is the contents from materials
TextureAtlas_1001 through TextureAtlas_1009 is referenced within the .obj file as, for example
usemtl TextureAtlas_1003
{
"baseUrl": "",
"options": {
},
"materialsInfo": {
"TextureAtlas_1001": {
"name": "TextureAtlas_1001",
"ka": [
0.6,
0.6,
0.6
],
"kd": [
0.6,
0.6,
0.6
],
"ks": [
0,
0,
0
],
"d": "1.0",
"ns": "0.0",
"illum": "2",
"map_kd": "texture_1001.png"
},
"TextureAtlas_1002": {
"name": "TextureAtlas_1002",
"ka": [
0.6,
0.6,
0.6
],
"kd": [
0.6,
0.6,
0.6
],
"ks": [
0,
0,
0
],
"d": "1.0",
"ns": "0.0",
"illum": "2",
"map_kd": "texture_1002.png"
},
"TextureAtlas_1003": {
"name": "TextureAtlas_1003",
"ka": [
0.6,
0.6,
0.6
],
"kd": [
0.6,
0.6,
0.6
],
"ks": [
0,
0,
0
],
"d": "1.0",
"ns": "0.0",
"illum": "2",
"map_kd": "texture_1003.png"
},
"TextureAtlas_1004": {
"name": "TextureAtlas_1004",
"ka": [
0.6,
0.6,
0.6
],
"kd": [
0.6,
0.6,
0.6
],
"ks": [
0,
0,
0
],
"d": "1.0",
"ns": "0.0",
"illum": "2",
"map_kd": "texture_1004.png"
},
"TextureAtlas_1005": {
"name": "TextureAtlas_1005",
"ka": [
0.6,
0.6,
0.6
],
"kd": [
0.6,
0.6,
0.6
],
"ks": [
0,
0,
0
],
"d": "1.0",
"ns": "0.0",
"illum": "2",
"map_kd": "texture_1005.png"
},
"TextureAtlas_1006": {
"name": "TextureAtlas_1006",
"ka": [
0.6,
0.6,
0.6
],
"kd": [
0.6,
0.6,
0.6
],
"ks": [
0,
0,
0
],
"d": "1.0",
"ns": "0.0",
"illum": "2",
"map_kd": "texture_1006.png"
},
"TextureAtlas_1007": {
"name": "TextureAtlas_1007",
"ka": [
0.6,
0.6,
0.6
],
"kd": [
0.6,
0.6,
0.6
],
"ks": [
0,
0,
0
],
"d": "1.0",
"ns": "0.0",
"illum": "2",
"map_kd": "texture_1007.png"
},
"TextureAtlas_1008": {
"name": "TextureAtlas_1008",
"ka": [
0.6,
0.6,
0.6
],
"kd": [
0.6,
0.6,
0.6
],
"ks": [
0,
0,
0
],
"d": "1.0",
"ns": "0.0",
"illum": "2",
"map_kd": "texture_1008.png"
},
"TextureAtlas_1009": {
"name": "TextureAtlas_1009",
"ka": [
0.6,
0.6,
0.6
],
"kd": [
0.6,
0.6,
0.6
],
"ks": [
0,
0,
0
],
"d": "1.0",
"ns": "0.0",
"illum": "2",
"map_kd": "texture_1009.png"
}
},
"materials": {
"TextureAtlas_1001": {
"metadata": {
"version": 4.5,
"type": "Material",
"generator": "Material.toJSON"
},
"uuid": "4bc46bff-818c-4126-97c6-fcd506bfc170",
"type": "MeshPhongMaterial",
"name": "TextureAtlas_1001",
"color": 5329233,
"emissive": 0,
"specular": 0,
"shininess": 0,
"map": "6a88f61a-b171-43f5-97d1-ef0474be76cb",
"reflectivity": 1,
"refractionRatio": 0.98,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"colorWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680,
"textures": [
{
"uuid": "6a88f61a-b171-43f5-97d1-ef0474be76cb",
"name": "",
"image": "ebb17a3a-effb-4506-b9ce-6a40becb3699",
"mapping": 300,
"repeat": [
1,
1
],
"offset": [
0,
0
],
"center": [
0,
0
],
"rotation": 0,
"wrap": [
1000,
1000
],
"format": 1023,
"type": 1009,
"encoding": 3001,
"minFilter": 1008,
"magFilter": 1006,
"anisotropy": 1,
"flipY": true,
"premultiplyAlpha": false,
"unpackAlignment": 4
}
],
"images": [
{
"uuid": "ebb17a3a-effb-4506-b9ce-6a40becb3699",
"url": ""
}
]
},
"TextureAtlas_1002": {
"metadata": {
"version": 4.5,
"type": "Material",
"generator": "Material.toJSON"
},
"uuid": "8e7ddd3d-3e37-4cad-b8e4-f7ac40edf1a1",
"type": "MeshPhongMaterial",
"name": "TextureAtlas_1002",
"color": 5329233,
"emissive": 0,
"specular": 0,
"shininess": 0,
"map": "3cd5ac3b-1587-4ac1-b849-9a6668174613",
"reflectivity": 1,
"refractionRatio": 0.98,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"colorWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680,
"textures": [
{
"uuid": "3cd5ac3b-1587-4ac1-b849-9a6668174613",
"name": "",
"image": "7c64944b-0fc2-4d5f-8245-62f54a59dc0f",
"mapping": 300,
"repeat": [
1,
1
],
"offset": [
0,
0
],
"center": [
0,
0
],
"rotation": 0,
"wrap": [
1000,
1000
],
"format": 1023,
"type": 1009,
"encoding": 3001,
"minFilter": 1008,
"magFilter": 1006,
"anisotropy": 1,
"flipY": true,
"premultiplyAlpha": false,
"unpackAlignment": 4
}
],
"images": [
{
"uuid": "7c64944b-0fc2-4d5f-8245-62f54a59dc0f",
"url": ""
}
]
},
"TextureAtlas_1003": {
"metadata": {
"version": 4.5,
"type": "Material",
"generator": "Material.toJSON"
},
"uuid": "c3f77222-bc7d-4870-bc1e-a60c7a1138c1",
"type": "MeshPhongMaterial",
"name": "TextureAtlas_1003",
"color": 5329233,
"emissive": 0,
"specular": 0,
"shininess": 0,
"map": "a80e6459-9a8c-46b5-9bb6-cfc127c87867",
"reflectivity": 1,
"refractionRatio": 0.98,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"colorWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680,
"textures": [
{
"uuid": "a80e6459-9a8c-46b5-9bb6-cfc127c87867",
"name": "",
"image": "61312916-e609-4a82-b58e-08af07e6ff8c",
"mapping": 300,
"repeat": [
1,
1
],
"offset": [
0,
0
],
"center": [
0,
0
],
"rotation": 0,
"wrap": [
1000,
1000
],
"format": 1023,
"type": 1009,
"encoding": 3001,
"minFilter": 1008,
"magFilter": 1006,
"anisotropy": 1,
"flipY": true,
"premultiplyAlpha": false,
"unpackAlignment": 4
}
],
"images": [
{
"uuid": "61312916-e609-4a82-b58e-08af07e6ff8c",
"url": ""
}
]
},
"TextureAtlas_1004": {
"metadata": {
"version": 4.5,
"type": "Material",
"generator": "Material.toJSON"
},
"uuid": "8a611e87-039b-46b3-86cb-0cf702011fc5",
"type": "MeshPhongMaterial",
"name": "TextureAtlas_1004",
"color": 5329233,
"emissive": 0,
"specular": 0,
"shininess": 0,
"map": "a0d4589d-8e73-429b-b886-f15ae9e92e35",
"reflectivity": 1,
"refractionRatio": 0.98,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"colorWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680,
"textures": [
{
"uuid": "a0d4589d-8e73-429b-b886-f15ae9e92e35",
"name": "",
"image": "a07743bf-e7f2-4dfe-a925-20f47959b9b6",
"mapping": 300,
"repeat": [
1,
1
],
"offset": [
0,
0
],
"center": [
0,
0
],
"rotation": 0,
"wrap": [
1000,
1000
],
"format": 1023,
"type": 1009,
"encoding": 3001,
"minFilter": 1008,
"magFilter": 1006,
"anisotropy": 1,
"flipY": true,
"premultiplyAlpha": false,
"unpackAlignment": 4
}
],
"images": [
{
"uuid": "a07743bf-e7f2-4dfe-a925-20f47959b9b6",
"url": ""
}
]
},
"TextureAtlas_1005": {
"metadata": {
"version": 4.5,
"type": "Material",
"generator": "Material.toJSON"
},
"uuid": "e753caae-24bb-4d3c-96f4-07d9fade3f98",
"type": "MeshPhongMaterial",
"name": "TextureAtlas_1005",
"color": 5329233,
"emissive": 0,
"specular": 0,
"shininess": 0,
"map": "2744e521-df6f-4d0b-967f-2cc120694b5a",
"reflectivity": 1,
"refractionRatio": 0.98,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"colorWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680,
"textures": [
{
"uuid": "2744e521-df6f-4d0b-967f-2cc120694b5a",
"name": "",
"image": "bfbfa844-0d49-4799-80c1-a45d897db200",
"mapping": 300,
"repeat": [
1,
1
],
"offset": [
0,
0
],
"center": [
0,
0
],
"rotation": 0,
"wrap": [
1000,
1000
],
"format": 1023,
"type": 1009,
"encoding": 3001,
"minFilter": 1008,
"magFilter": 1006,
"anisotropy": 1,
"flipY": true,
"premultiplyAlpha": false,
"unpackAlignment": 4
}
],
"images": [
{
"uuid": "bfbfa844-0d49-4799-80c1-a45d897db200",
"url": ""
}
]
},
"TextureAtlas_1006": {
"metadata": {
"version": 4.5,
"type": "Material",
"generator": "Material.toJSON"
},
"uuid": "052349fd-f009-4b19-b600-1cdf1a686ecb",
"type": "MeshPhongMaterial",
"name": "TextureAtlas_1006",
"color": 5329233,
"emissive": 0,
"specular": 0,
"shininess": 0,
"map": "31322f58-0d44-4cc6-add8-338883f0670f",
"reflectivity": 1,
"refractionRatio": 0.98,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"colorWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680,
"textures": [
{
"uuid": "31322f58-0d44-4cc6-add8-338883f0670f",
"name": "",
"image": "64be3cb5-7f63-4305-a457-bc62f732d61c",
"mapping": 300,
"repeat": [
1,
1
],
"offset": [
0,
0
],
"center": [
0,
0
],
"rotation": 0,
"wrap": [
1000,
1000
],
"format": 1023,
"type": 1009,
"encoding": 3001,
"minFilter": 1008,
"magFilter": 1006,
"anisotropy": 1,
"flipY": true,
"premultiplyAlpha": false,
"unpackAlignment": 4
}
],
"images": [
{
"uuid": "64be3cb5-7f63-4305-a457-bc62f732d61c",
"url": ""
}
]
},
"TextureAtlas_1007": {
"metadata": {
"version": 4.5,
"type": "Material",
"generator": "Material.toJSON"
},
"uuid": "481b3c49-137a-4a23-837d-83e83653a850",
"type": "MeshPhongMaterial",
"name": "TextureAtlas_1007",
"color": 5329233,
"emissive": 0,
"specular": 0,
"shininess": 0,
"map": "8becb851-a963-414e-abfd-38aaacd76032",
"reflectivity": 1,
"refractionRatio": 0.98,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"colorWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680,
"textures": [
{
"uuid": "8becb851-a963-414e-abfd-38aaacd76032",
"name": "",
"image": "0a43181d-8412-406d-bb39-3e8eff2c2e63",
"mapping": 300,
"repeat": [
1,
1
],
"offset": [
0,
0
],
"center": [
0,
0
],
"rotation": 0,
"wrap": [
1000,
1000
],
"format": 1023,
"type": 1009,
"encoding": 3001,
"minFilter": 1008,
"magFilter": 1006,
"anisotropy": 1,
"flipY": true,
"premultiplyAlpha": false,
"unpackAlignment": 4
}
],
"images": [
{
"uuid": "0a43181d-8412-406d-bb39-3e8eff2c2e63",
"url": ""
}
]
},
"TextureAtlas_1008": {
"metadata": {
"version": 4.5,
"type": "Material",
"generator": "Material.toJSON"
},
"uuid": "451fb82e-c0f5-4270-9edc-9a11d793e59e",
"type": "MeshPhongMaterial",
"name": "TextureAtlas_1008",
"color": 5329233,
"emissive": 0,
"specular": 0,
"shininess": 0,
"map": "68ac648c-f0ad-4a24-ab11-781d44c9f69b",
"reflectivity": 1,
"refractionRatio": 0.98,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"colorWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680,
"textures": [
{
"uuid": "68ac648c-f0ad-4a24-ab11-781d44c9f69b",
"name": "",
"image": "6e7c15b1-511c-4802-820d-8d321b67c5be",
"mapping": 300,
"repeat": [
1,
1
],
"offset": [
0,
0
],
"center": [
0,
0
],
"rotation": 0,
"wrap": [
1000,
1000
],
"format": 1023,
"type": 1009,
"encoding": 3001,
"minFilter": 1008,
"magFilter": 1006,
"anisotropy": 1,
"flipY": true,
"premultiplyAlpha": false,
"unpackAlignment": 4
}
],
"images": [
{
"uuid": "6e7c15b1-511c-4802-820d-8d321b67c5be",
"url": ""
}
]
},
"TextureAtlas_1009": {
"metadata": {
"version": 4.5,
"type": "Material",
"generator": "Material.toJSON"
},
"uuid": "c1e0b556-1955-4c99-9b81-ad025bf845b5",
"type": "MeshPhongMaterial",
"name": "TextureAtlas_1009",
"color": 5329233,
"emissive": 0,
"specular": 0,
"shininess": 0,
"map": "3a71889a-7793-4bb8-9271-11ab4b4f40b5",
"reflectivity": 1,
"refractionRatio": 0.98,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"colorWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680,
"textures": [
{
"uuid": "3a71889a-7793-4bb8-9271-11ab4b4f40b5",
"name": "",
"image": "9a88f753-fd7e-4298-bc8d-d3755b71ab43",
"mapping": 300,
"repeat": [
1,
1
],
"offset": [
0,
0
],
"center": [
0,
0
],
"rotation": 0,
"wrap": [
1000,
1000
],
"format": 1023,
"type": 1009,
"encoding": 3001,
"minFilter": 1008,
"magFilter": 1006,
"anisotropy": 1,
"flipY": true,
"premultiplyAlpha": false,
"unpackAlignment": 4
}
],
"images": [
{
"uuid": "9a88f753-fd7e-4298-bc8d-d3755b71ab43",
"url": ""
}
]
}
},
"materialsArray": [
{
"metadata": {
"version": 4.5,
"type": "Material",
"generator": "Material.toJSON"
},
"uuid": "4bc46bff-818c-4126-97c6-fcd506bfc170",
"type": "MeshPhongMaterial",
"name": "TextureAtlas_1001",
"color": 5329233,
"emissive": 0,
"specular": 0,
"shininess": 0,
"map": "6a88f61a-b171-43f5-97d1-ef0474be76cb",
"reflectivity": 1,
"refractionRatio": 0.98,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"colorWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680,
"textures": [
{
"uuid": "6a88f61a-b171-43f5-97d1-ef0474be76cb",
"name": "",
"image": "ebb17a3a-effb-4506-b9ce-6a40becb3699",
"mapping": 300,
"repeat": [
1,
1
],
"offset": [
0,
0
],
"center": [
0,
0
],
"rotation": 0,
"wrap": [
1000,
1000
],
"format": 1023,
"type": 1009,
"encoding": 3001,
"minFilter": 1008,
"magFilter": 1006,
"anisotropy": 1,
"flipY": true,
"premultiplyAlpha": false,
"unpackAlignment": 4
}
],
"images": [
{
"uuid": "ebb17a3a-effb-4506-b9ce-6a40becb3699",
"url": ""
}
]
},
{
"metadata": {
"version": 4.5,
"type": "Material",
"generator": "Material.toJSON"
},
"uuid": "8e7ddd3d-3e37-4cad-b8e4-f7ac40edf1a1",
"type": "MeshPhongMaterial",
"name": "TextureAtlas_1002",
"color": 5329233,
"emissive": 0,
"specular": 0,
"shininess": 0,
"map": "3cd5ac3b-1587-4ac1-b849-9a6668174613",
"reflectivity": 1,
"refractionRatio": 0.98,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"colorWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680,
"textures": [
{
"uuid": "3cd5ac3b-1587-4ac1-b849-9a6668174613",
"name": "",
"image": "7c64944b-0fc2-4d5f-8245-62f54a59dc0f",
"mapping": 300,
"repeat": [
1,
1
],
"offset": [
0,
0
],
"center": [
0,
0
],
"rotation": 0,
"wrap": [
1000,
1000
],
"format": 1023,
"type": 1009,
"encoding": 3001,
"minFilter": 1008,
"magFilter": 1006,
"anisotropy": 1,
"flipY": true,
"premultiplyAlpha": false,
"unpackAlignment": 4
}
],
"images": [
{
"uuid": "7c64944b-0fc2-4d5f-8245-62f54a59dc0f",
"url": ""
}
]
},
{
"metadata": {
"version": 4.5,
"type": "Material",
"generator": "Material.toJSON"
},
"uuid": "c3f77222-bc7d-4870-bc1e-a60c7a1138c1",
"type": "MeshPhongMaterial",
"name": "TextureAtlas_1003",
"color": 5329233,
"emissive": 0,
"specular": 0,
"shininess": 0,
"map": "a80e6459-9a8c-46b5-9bb6-cfc127c87867",
"reflectivity": 1,
"refractionRatio": 0.98,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"colorWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680,
"textures": [
{
"uuid": "a80e6459-9a8c-46b5-9bb6-cfc127c87867",
"name": "",
"image": "61312916-e609-4a82-b58e-08af07e6ff8c",
"mapping": 300,
"repeat": [
1,
1
],
"offset": [
0,
0
],
"center": [
0,
0
],
"rotation": 0,
"wrap": [
1000,
1000
],
"format": 1023,
"type": 1009,
"encoding": 3001,
"minFilter": 1008,
"magFilter": 1006,
"anisotropy": 1,
"flipY": true,
"premultiplyAlpha": false,
"unpackAlignment": 4
}
],
"images": [
{
"uuid": "61312916-e609-4a82-b58e-08af07e6ff8c",
"url": ""
}
]
},
{
"metadata": {
"version": 4.5,
"type": "Material",
"generator": "Material.toJSON"
},
"uuid": "8a611e87-039b-46b3-86cb-0cf702011fc5",
"type": "MeshPhongMaterial",
"name": "TextureAtlas_1004",
"color": 5329233,
"emissive": 0,
"specular": 0,
"shininess": 0,
"map": "a0d4589d-8e73-429b-b886-f15ae9e92e35",
"reflectivity": 1,
"refractionRatio": 0.98,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"colorWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680,
"textures": [
{
"uuid": "a0d4589d-8e73-429b-b886-f15ae9e92e35",
"name": "",
"image": "a07743bf-e7f2-4dfe-a925-20f47959b9b6",
"mapping": 300,
"repeat": [
1,
1
],
"offset": [
0,
0
],
"center": [
0,
0
],
"rotation": 0,
"wrap": [
1000,
1000
],
"format": 1023,
"type": 1009,
"encoding": 3001,
"minFilter": 1008,
"magFilter": 1006,
"anisotropy": 1,
"flipY": true,
"premultiplyAlpha": false,
"unpackAlignment": 4
}
],
"images": [
{
"uuid": "a07743bf-e7f2-4dfe-a925-20f47959b9b6",
"url": ""
}
]
},
{
"metadata": {
"version": 4.5,
"type": "Material",
"generator": "Material.toJSON"
},
"uuid": "e753caae-24bb-4d3c-96f4-07d9fade3f98",
"type": "MeshPhongMaterial",
"name": "TextureAtlas_1005",
"color": 5329233,
"emissive": 0,
"specular": 0,
"shininess": 0,
"map": "2744e521-df6f-4d0b-967f-2cc120694b5a",
"reflectivity": 1,
"refractionRatio": 0.98,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"colorWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680,
"textures": [
{
"uuid": "2744e521-df6f-4d0b-967f-2cc120694b5a",
"name": "",
"image": "bfbfa844-0d49-4799-80c1-a45d897db200",
"mapping": 300,
"repeat": [
1,
1
],
"offset": [
0,
0
],
"center": [
0,
0
],
"rotation": 0,
"wrap": [
1000,
1000
],
"format": 1023,
"type": 1009,
"encoding": 3001,
"minFilter": 1008,
"magFilter": 1006,
"anisotropy": 1,
"flipY": true,
"premultiplyAlpha": false,
"unpackAlignment": 4
}
],
"images": [
{
"uuid": "bfbfa844-0d49-4799-80c1-a45d897db200",
"url": ""
}
]
},
{
"metadata": {
"version": 4.5,
"type": "Material",
"generator": "Material.toJSON"
},
"uuid": "052349fd-f009-4b19-b600-1cdf1a686ecb",
"type": "MeshPhongMaterial",
"name": "TextureAtlas_1006",
"color": 5329233,
"emissive": 0,
"specular": 0,
"shininess": 0,
"map": "31322f58-0d44-4cc6-add8-338883f0670f",
"reflectivity": 1,
"refractionRatio": 0.98,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"colorWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680,
"textures": [
{
"uuid": "31322f58-0d44-4cc6-add8-338883f0670f",
"name": "",
"image": "64be3cb5-7f63-4305-a457-bc62f732d61c",
"mapping": 300,
"repeat": [
1,
1
],
"offset": [
0,
0
],
"center": [
0,
0
],
"rotation": 0,
"wrap": [
1000,
1000
],
"format": 1023,
"type": 1009,
"encoding": 3001,
"minFilter": 1008,
"magFilter": 1006,
"anisotropy": 1,
"flipY": true,
"premultiplyAlpha": false,
"unpackAlignment": 4
}
],
"images": [
{
"uuid": "64be3cb5-7f63-4305-a457-bc62f732d61c",
"url": ""
}
]
},
{
"metadata": {
"version": 4.5,
"type": "Material",
"generator": "Material.toJSON"
},
"uuid": "481b3c49-137a-4a23-837d-83e83653a850",
"type": "MeshPhongMaterial",
"name": "TextureAtlas_1007",
"color": 5329233,
"emissive": 0,
"specular": 0,
"shininess": 0,
"map": "8becb851-a963-414e-abfd-38aaacd76032",
"reflectivity": 1,
"refractionRatio": 0.98,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"colorWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680,
"textures": [
{
"uuid": "8becb851-a963-414e-abfd-38aaacd76032",
"name": "",
"image": "0a43181d-8412-406d-bb39-3e8eff2c2e63",
"mapping": 300,
"repeat": [
1,
1
],
"offset": [
0,
0
],
"center": [
0,
0
],
"rotation": 0,
"wrap": [
1000,
1000
],
"format": 1023,
"type": 1009,
"encoding": 3001,
"minFilter": 1008,
"magFilter": 1006,
"anisotropy": 1,
"flipY": true,
"premultiplyAlpha": false,
"unpackAlignment": 4
}
],
"images": [
{
"uuid": "0a43181d-8412-406d-bb39-3e8eff2c2e63",
"url": ""
}
]
},
{
"metadata": {
"version": 4.5,
"type": "Material",
"generator": "Material.toJSON"
},
"uuid": "451fb82e-c0f5-4270-9edc-9a11d793e59e",
"type": "MeshPhongMaterial",
"name": "TextureAtlas_1008",
"color": 5329233,
"emissive": 0,
"specular": 0,
"shininess": 0,
"map": "68ac648c-f0ad-4a24-ab11-781d44c9f69b",
"reflectivity": 1,
"refractionRatio": 0.98,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"colorWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680,
"textures": [
{
"uuid": "68ac648c-f0ad-4a24-ab11-781d44c9f69b",
"name": "",
"image": "6e7c15b1-511c-4802-820d-8d321b67c5be",
"mapping": 300,
"repeat": [
1,
1
],
"offset": [
0,
0
],
"center": [
0,
0
],
"rotation": 0,
"wrap": [
1000,
1000
],
"format": 1023,
"type": 1009,
"encoding": 3001,
"minFilter": 1008,
"magFilter": 1006,
"anisotropy": 1,
"flipY": true,
"premultiplyAlpha": false,
"unpackAlignment": 4
}
],
"images": [
{
"uuid": "6e7c15b1-511c-4802-820d-8d321b67c5be",
"url": ""
}
]
},
{
"metadata": {
"version": 4.5,
"type": "Material",
"generator": "Material.toJSON"
},
"uuid": "c1e0b556-1955-4c99-9b81-ad025bf845b5",
"type": "MeshPhongMaterial",
"name": "TextureAtlas_1009",
"color": 5329233,
"emissive": 0,
"specular": 0,
"shininess": 0,
"map": "3a71889a-7793-4bb8-9271-11ab4b4f40b5",
"reflectivity": 1,
"refractionRatio": 0.98,
"depthFunc": 3,
"depthTest": true,
"depthWrite": true,
"colorWrite": true,
"stencilWrite": false,
"stencilWriteMask": 255,
"stencilFunc": 519,
"stencilRef": 0,
"stencilFuncMask": 255,
"stencilFail": 7680,
"stencilZFail": 7680,
"stencilZPass": 7680,
"textures": [
{
"uuid": "3a71889a-7793-4bb8-9271-11ab4b4f40b5",
"name": "",
"image": "9a88f753-fd7e-4298-bc8d-d3755b71ab43",
"mapping": 300,
"repeat": [
1,
1
],
"offset": [
0,
0
],
"center": [
0,
0
],
"rotation": 0,
"wrap": [
1000,
1000
],
"format": 1023,
"type": 1009,
"encoding": 3001,
"minFilter": 1008,
"magFilter": 1006,
"anisotropy": 1,
"flipY": true,
"premultiplyAlpha": false,
"unpackAlignment": 4
}
],
"images": [
{
"uuid": "9a88f753-fd7e-4298-bc8d-d3755b71ab43",
"url": ""
}
]
}
],
"nameLookup": {
"TextureAtlas_1001": 0,
"TextureAtlas_1002": 1,
"TextureAtlas_1003": 2,
"TextureAtlas_1004": 3,
"TextureAtlas_1005": 4,
"TextureAtlas_1006": 5,
"TextureAtlas_1007": 6,
"TextureAtlas_1008": 7,
"TextureAtlas_1009": 8
},
"crossOrigin": "anonymous",
"side": 0,
"wrap": 1000,
"manager": {
}
}
Output:
Expected output:
This was generated as a test, with the files copied in to the project locally, so the above code was not used, rather the classical mtl + obj loader pattern was used.