Closed aphex- closed 12 years ago
Could you also share the relevant code where you're loading this?
I found the problem while I reduced my code to the relevant lines. I used the same instance of a THREE.JSONLoader for more files synchronously. This is obviously not the best idea. Thank you for respond again.
OK.. same problem again (THREE.js r47).
json-file:
{
"metadata" :
{
"formatVersion" : 3,
"generatedBy" : "Blender 2.60 Exporter",
"vertices" : 48,
"faces" : 43,
"normals" : 20,
"colors" : 0,
"uvs" : 0,
"materials" : 1,
"morphTargets" : 0
},
"scale" : 0.200000,
"materials": [ {
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "Material.006",
"colorAmbient" : [0.0, 0.0, 0.0],
"colorDiffuse" : [0.6400000190734865, 0.6400000190734865, 0.6400000190734865],
"colorSpecular" : [0.5, 0.5, 0.5],
"mapDiffuse" : "palette.png",
"mapDiffuseWrap" : ["repeat", "repeat"],
"shading" : "Lambert",
"specularCoef" : 50,
"transparency" : 1.0,
"vertexColors" : false
}],
"vertices": [1.000000,0.007309,-1.000000,1.000000,0.007310,1.000000,-1.000000,0.007310,1.000000,-1.000000,0.007309,-1.000000,1.000000,0.085013,-0.999999,0.999999,0.085013,1.000001,-1.000000,0.085013,1.000000,-1.000000,0.085013,-1.000000,1.000000,0.312176,-0.999999,-1.000000,0.312176,-1.000000,-1.000000,0.312176,1.000000,0.999999,0.312176,1.000001,1.000000,0.391582,-0.999999,0.999999,0.391582,1.000001,-1.000000,0.391582,1.000000,-1.000000,0.391582,-1.000000,0.600000,0.007310,1.000000,0.200000,0.007310,1.000000,-0.200000,0.007310,1.000000,-0.600000,0.007310,1.000000,0.600000,0.007309,-1.000000,0.200000,0.007309,-1.000000,-0.200000,0.007309,-1.000000,-0.600000,0.007309,-1.000000,0.599999,0.085013,1.000000,0.199999,0.085013,1.000000,-0.200001,0.085013,1.000000,-0.600000,0.085013,1.000000,0.600000,0.085013,-1.000000,0.200000,0.085013,-1.000000,-0.200000,0.085013,-1.000000,-0.600000,0.085013,-1.000000,0.600000,0.312176,-1.000000,0.200000,0.312176,-1.000000,-0.200000,0.312176,-1.000000,-0.600000,0.312176,-1.000000,-0.600000,0.312176,1.000000,-0.200001,0.312176,1.000000,0.199999,0.312176,1.000000,0.599999,0.312176,1.000000,0.599999,0.391582,1.000000,0.199999,0.391582,1.000000,-0.200001,0.391582,1.000000,-0.600000,0.391582,1.000000,0.600000,0.391582,-1.000000,0.200000,0.391582,-1.000000,-0.200000,0.391582,-1.000000,-0.600000,0.391582,-1.000000],
"morphTargets": [],
"normals": [0.707083,0.000000,-0.707083,0.707083,0.000000,0.707083,-0.707083,0.000000,0.707083,-0.707083,0.000000,-0.707083,0.577349,0.577349,-0.577349,0.577349,0.577349,0.577349,-0.577349,0.577349,0.577349,-0.577349,0.577349,-0.577349,-0.301492,0.301492,0.904508,0.000000,0.000000,1.000000,0.301492,0.301492,0.904508,0.000000,0.000000,-1.000000,-0.301492,0.301492,-0.904508,0.301492,0.301492,-0.904508,-0.316202,0.000000,-0.948668,0.316202,0.000000,-0.948668,0.316202,0.000000,0.948668,-0.316202,0.000000,0.948668,0.000000,0.707083,0.707083,0.000000,0.707083,-0.707083],
"colors": [],
"uvs": [[]],
"faces": [35,0,4,5,1,0,0,0,1,1,35,2,6,7,3,0,2,2,3,3,35,7,6,10,9,0,3,2,2,3,35,5,4,8,11,0,1,0,0,1,35,11,8,12,13,0,1,0,4,5,35,9,10,14,15,0,3,2,6,7,35,5,24,16,1,0,1,8,9,1,35,24,25,17,16,0,8,10,9,9,35,25,26,18,17,0,10,8,9,9,35,26,27,19,18,0,8,10,9,9,35,27,6,2,19,0,10,2,2,9,35,0,20,28,4,0,0,11,12,0,35,20,21,29,28,0,11,11,13,12,35,21,22,30,29,0,11,11,12,13,35,22,23,31,30,0,11,11,13,12,35,23,3,7,31,0,11,3,3,13,35,4,28,32,8,0,0,12,14,0,35,29,30,34,33,0,13,12,14,15,35,31,7,9,35,0,13,3,3,15,35,6,27,36,10,0,2,10,16,2,35,26,25,38,37,0,8,10,16,17,35,24,5,11,39,0,8,1,1,17,35,10,36,43,14,0,2,16,18,6,35,36,37,42,43,0,16,17,18,18,35,37,38,41,42,0,17,16,18,18,35,38,39,40,41,0,16,17,18,18,35,39,11,13,40,0,17,1,5,18,35,8,32,44,12,0,0,14,19,4,35,32,33,45,44,0,14,15,19,19,35,33,34,46,45,0,15,14,19,19,35,34,35,47,46,0,14,15,19,19,35,35,9,15,47,0,15,3,7,19,35,12,44,40,13,0,4,19,18,5,35,44,45,41,40,0,19,19,18,18,35,45,46,42,41,0,19,19,18,18,35,46,47,43,42,0,19,19,18,18,35,47,15,14,43,0,19,7,6,18,35,26,30,31,27,0,8,12,13,10,35,27,31,35,36,0,10,13,15,16,35,26,37,34,30,0,8,17,14,12,35,25,29,33,38,0,10,13,15,16,35,24,28,29,25,0,8,12,13,10,35,24,39,32,28,0,8,17,14,12]
}
var jsonLoader = new THREE.JSONLoader(true);
jsonLoader.load("Models/palette.json", function(geo){
var mesh = new THREE.Mesh( geo, new THREE.MeshFaceMaterial());
scene.add(mesh);
} );
Using THREE.MeshFaceMaterial() or any other Material with a texure does not work. Materials without textures are working. The file "palette.png" is in the same directory like the json-file (256x256px). Any ideas? :)
You don't have texture coordinates in your model. You need to create real UVs in Blender, not just use its procedurally generated coordinates.
And this worked... thank you :)
I get this Error if I try to inport a jsonmodel. (FireFox 11, WebGL.Verbose = true) WebGL: DrawElements: bound vertex attribute buffers do not have sufficient size for given indices from the bound element array (Three.js:281) Any ideas? :)
Edit: I do only use the geometry of this file and later aply a material.