admin管理员组文章数量:1345176
I'm using the mrdoob Blender Export Plugin (io_mesh_threejs) to Export to Three JS, but the exported .js or .dae objects do not contain any reference to the texture map files. Is there a special way I need to export the object? Alternatively, is there a special way I need to apply the map to the object in Blender 2.65 in order for the exporter to include it. Lastly, if there is not a way, can I manually add the texture in the JS file?
Blender Before Export
JSON Object Exported (without reference to texture)
{
"metadata" :
{
"formatVersion" : 3.1,
"generatedBy" : "Blender 2.65 Exporter",
"vertices" : 8,
"faces" : 6,
"normals" : 8,
"colors" : 0,
"uvs" : [4],
"materials" : 1,
"morphTargets" : 0,
"bones" : 0
},
"scale" : 1.000000,
"materials" : [ {
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "Material",
"blending" : "NormalBlending",
"colorAmbient" : [0.6400000190734865, 0.6400000190734865, 0.6400000190734865],
"colorDiffuse" : [0.6400000190734865, 0.6400000190734865, 0.6400000190734865],
"colorSpecular" : [0.5, 0.5, 0.5],
"depthTest" : true,
"depthWrite" : true,
"shading" : "Lambert",
"specularCoef" : 50,
"transparency" : 1.0,
"transparent" : false,
"vertexColors" : false
}],
"vertices" : [1,-0.988938,-1,1,-0.988938,1,-1,-0.988938,1,-1,-0.988938,-1,1,1.01106,-0.999999,0.999999,1.01106,1,-1,1.01106,1,-1,1.01106,-1],
"morphTargets" : [],
"normals" : [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.577349,0.577349,-0.577349,-0.577349,0.577349,-0.577349,-0.577349,0.577349,0.577349,0.577349,0.577349,0.577349],
"colors" : [],
"uvs" : [[1,-0,1,1,0,1,-0,0]],
"faces" : [43,0,1,2,3,0,0,1,2,3,0,1,2,3,43,4,7,6,5,0,0,1,2,3,4,5,6,7,43,0,4,5,1,0,0,1,2,3,0,4,7,1,43,1,5,6,2,0,0,1,2,3,1,7,6,2,43,2,6,7,3,0,0,1,2,3,2,6,5,3,43,4,0,3,7,0,2,3,0,1,4,0,3,5],
"bones" : [],
"skinIndices" : [],
"skinWeights" : [],
"animation" : {}
}
Code To Load JSON Object
var object;
var loader = new THREE.JSONLoader();
loader.load( "./quirk_logo.js", function(geometry, materials) {
var material = new THREE.MeshFaceMaterial(materials);
object = new THREE.Mesh(geometry, materials);
object.scale.set(1, 1, 1);
scene.add(object)
render();
});
I'm using the mrdoob Blender Export Plugin (io_mesh_threejs) to Export to Three JS, but the exported .js or .dae objects do not contain any reference to the texture map files. Is there a special way I need to export the object? Alternatively, is there a special way I need to apply the map to the object in Blender 2.65 in order for the exporter to include it. Lastly, if there is not a way, can I manually add the texture in the JS file?
Blender Before Export
JSON Object Exported (without reference to texture)
{
"metadata" :
{
"formatVersion" : 3.1,
"generatedBy" : "Blender 2.65 Exporter",
"vertices" : 8,
"faces" : 6,
"normals" : 8,
"colors" : 0,
"uvs" : [4],
"materials" : 1,
"morphTargets" : 0,
"bones" : 0
},
"scale" : 1.000000,
"materials" : [ {
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "Material",
"blending" : "NormalBlending",
"colorAmbient" : [0.6400000190734865, 0.6400000190734865, 0.6400000190734865],
"colorDiffuse" : [0.6400000190734865, 0.6400000190734865, 0.6400000190734865],
"colorSpecular" : [0.5, 0.5, 0.5],
"depthTest" : true,
"depthWrite" : true,
"shading" : "Lambert",
"specularCoef" : 50,
"transparency" : 1.0,
"transparent" : false,
"vertexColors" : false
}],
"vertices" : [1,-0.988938,-1,1,-0.988938,1,-1,-0.988938,1,-1,-0.988938,-1,1,1.01106,-0.999999,0.999999,1.01106,1,-1,1.01106,1,-1,1.01106,-1],
"morphTargets" : [],
"normals" : [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.577349,0.577349,-0.577349,-0.577349,0.577349,-0.577349,-0.577349,0.577349,0.577349,0.577349,0.577349,0.577349],
"colors" : [],
"uvs" : [[1,-0,1,1,0,1,-0,0]],
"faces" : [43,0,1,2,3,0,0,1,2,3,0,1,2,3,43,4,7,6,5,0,0,1,2,3,4,5,6,7,43,0,4,5,1,0,0,1,2,3,0,4,7,1,43,1,5,6,2,0,0,1,2,3,1,7,6,2,43,2,6,7,3,0,0,1,2,3,2,6,5,3,43,4,0,3,7,0,2,3,0,1,4,0,3,5],
"bones" : [],
"skinIndices" : [],
"skinWeights" : [],
"animation" : {}
}
Code To Load JSON Object
var object;
var loader = new THREE.JSONLoader();
loader.load( "./quirk_logo.js", function(geometry, materials) {
var material = new THREE.MeshFaceMaterial(materials);
object = new THREE.Mesh(geometry, materials);
object.scale.set(1, 1, 1);
scene.add(object)
render();
});
Share
edited Mar 6, 2013 at 11:56
sparkyspider
asked Mar 6, 2013 at 11:50
sparkyspidersparkyspider
13.5k11 gold badges97 silver badges135 bronze badges
3 Answers
Reset to default 2I think you can first export your model to .obj
from your Blender and then follow the rest part of this tutorial to get your right .json
model.
http://bkcore./blog/3d/webgl-three-js-workflow-tips.html
This should be what you are looking for.
http://graphic-sim./B_basic_export.html
Take a look at the example i cooked up .
https://github./master-atul/blender3js
U can see the working example here :
http://www.atulr./blender3js
You can check out my code from my repo link.
And if you wish to know the export options i used :
I directly exported the animations and everything from blender with options described here.
https://devmatrix.wordpress./2013/02/27/creating-skeletal-animation-in-blender-and-exporting-it-to-three-js/
Hope this helps Cheers :)
本文标签: javascriptTHREEJS Exporting JSON models from blender (including textures)Stack Overflow
版权声明:本文标题:javascript - THREE.JS Exporting JSON models from blender (including textures) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743691587a2522802.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论