I did some research and learn how to export the obj file to .js file that can be imported by JSON model of Three.js. but how can you animated such model ? I have a bird model in .js format i need to learn to flap its wings. Further more when i downloaded the obj file from the internet as it was free model it also contains texture images for the object but when i import the obj in 3d modelling software Blender 3d, it cannot load the texture but it has the location right inside the obj file when i open it from text editor. When i convert it to .js format it also has right location located to the bmp images for texture mapping, but fail to load when i load the model in webgl, using JSON Model.
Can anyone please point me in right direction from where i can learn all this thinks, it would be even great if you know and help me right away in answer. Please, I need help form you guys .
Code of the Js model file
{
"metadata" :
{
"formatVersion" : 3,
"generatedBy" : "Blender 2.66 Exporter",
"vertices" : 2652,
"faces" : 4798,
"normals" : 2652,
"colors" : 0,
"uvs" : [1202],
"materials" : 4,
"morphTargets" : 0,
"bones" : 0
},
"scale" : 1.000000,
"materials" : [ {
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "_5___Default0",
"blending" : "NormalBlending",
"colorAmbient" : [0.800000011920929, 0.800000011920929, 0.800000011920929],
"colorDiffuse" : [0.800000011920929, 0.800000011920929, 0.800000011920929],
"colorSpecular" : [0.8999999761581421, 0.8999999761581421, 0.8999999761581421],
"depthTest" : true,
"depthWrite" : true,
"mapDiffuse" : "n-201.bmp",
"mapDiffuseWrap" : ["repeat", "repeat"],
"shading" : "Lambert",
"specularCoef" : 2,
"transparency" : 1.0,
"transparent" : false,
"vertexColors" : false
},
{
"DbgColor" : 15597568,
"DbgIndex" : 1,
"DbgName" : "_5___Default1",
"blending" : "NormalBlending",
"colorAmbient" : [0.800000011920929, 0.800000011920929, 0.800000011920929],
"colorDiffuse" : [0.800000011920929, 0.800000011920929, 0.800000011920929],
"colorSpecular" : [0.8999999761581421, 0.8999999761581421, 0.8999999761581421],
"depthTest" : true,
"depthWrite" : true,
"mapDiffuse" : "n-200.bmp",
"mapDiffuseWrap" : ["repeat", "repeat"],
"shading" : "Lambert",
"specularCoef" : 2,
"transparency" : 1.0,
"transparent" : false,
"vertexColors" : false
},
{
"DbgColor" : 60928,
"DbgIndex" : 2,
"DbgName" : "_5___Default2",
"blending" : "NormalBlending",
"colorAmbient" : [0.800000011920929, 0.800000011920929, 0.800000011920929],
"colorDiffuse" : [0.800000011920929, 0.800000011920929, 0.800000011920929],
"colorSpecular" : [0.8999999761581421, 0.8999999761581421, 0.8999999761581421],
"depthTest" : true,
"depthWrite" : true,
"mapDiffuse" : "n-202.bmp",
"mapDiffuseWrap" : ["repeat", "repeat"],
"shading" : "Lambert",
"specularCoef" : 2,
"transparency" : 1.0,
"transparent" : false,
"vertexColors" : false
},
{
"DbgColor" : 238,
"DbgIndex" : 3,
"DbgName" : "_5___Default",
"blending" : "NormalBlending",
"colorAmbient" : [0.800000011920929, 0.800000011920929, 0.800000011920929],
"colorDiffuse" : [0.800000011920929, 0.800000011920929, 0.800000011920929],
"colorSpecular" : [0.8999999761581421, 0.8999999761581421, 0.8999999761581421],
"depthTest" : true,
"depthWrite" : true,
"mapDiffuse" : "n-203.bmp",
"mapDiffuseWrap" : ["repeat", "repeat"],
"shading" : "Lambert",
"specularCoef" : 2,
"transparency" : 1.0,
"transparent" : false,
"vertexColors" : false
},
{
"DbgColor" : 15658496,
"DbgIndex" : 4,
"DbgName" : "_5___Default0",
"blending" : "NormalBlending",
"colorAmbient" : [0.800000011920929, 0.800000011920929, 0.800000011920929],
"colorDiffuse" : [0.800000011920929, 0.800000011920929, 0.800000011920929],
"colorSpecular" : [0.8999999761581421, 0.8999999761581421, 0.8999999761581421],
"depthTest" : true,
"depthWrite" : true,
"mapDiffuse" : "n-201.bmp",
"mapDiffuseWrap" : ["repeat", "repeat"],
"shading" : "Lambert",
"specularCoef" : 2,
"transparency" : 1.0,
"transparent" : false,
"vertexColors" : false
},
{
"DbgColor" : 61166,
"DbgIndex" : 5,
"DbgName" : "_5___Default1",
"blending" : "NormalBlending",
"colorAmbient" : [0.800000011920929, 0.800000011920929, 0.800000011920929],
"colorDiffuse" : [0.800000011920929, 0.800000011920929, 0.800000011920929],
"colorSpecular" : [0.8999999761581421, 0.8999999761581421, 0.8999999761581421],
"depthTest" : true,
"depthWrite" : true,
"mapDiffuse" : "n-200.bmp",
"mapDiffuseWrap" : ["repeat", "repeat"],
"shading" : "Lambert",
"specularCoef" : 2,
"transparency" : 1.0,
"transparent" : false,
"vertexColors" : false
},
{
"DbgColor" : 15597806,
"DbgIndex" : 6,
"DbgName" : "_5___Default2",
"blending" : "NormalBlending",
"colorAmbient" : [0.800000011920929, 0.800000011920929, 0.800000011920929],
"colorDiffuse" : [0.800000011920929, 0.800000011920929, 0.800000011920929],
"colorSpecular" : [0.8999999761581421, 0.8999999761581421, 0.8999999761581421],
"depthTest" : true,
"depthWrite" : true,
"mapDiffuse" : "n-202.bmp",
"mapDiffuseWrap" : ["repeat", "repeat"],
"shading" : "Lambert",
"specularCoef" : 2,
"transparency" : 1.0,
"transparent" : false,
"vertexColors" : false
},
{
"DbgColor" : 419610,
"DbgIndex" : 7,
"DbgName" : "_5___Default",
"blending" : "NormalBlending",
"colorAmbient" : [0.800000011920929, 0.800000011920929, 0.800000011920929],
"colorDiffuse" : [0.800000011920929, 0.800000011920929, 0.800000011920929],
"colorSpecular" : [0.8999999761581421, 0.8999999761581421, 0.8999999761581421],
"depthTest" : true,
"depthWrite" : true,
"mapDiffuse" : "n-203.bmp",
"mapDiffuseWrap" : ["repeat", "repeat"],
"shading" : "Lambert",
"specularCoef" : 2,
"transparency" : 1.0,
"transparent" : false,
"vertexColors" : false
}],
Take a look here
http://threejs.org/examples/webgl_morphnormals.html http://threejs.org/examples/webgl_morphtargets_horse.html
In the first example look here,line 90
var loader = new THREE.JSONLoader();
loader.load( "models/animated/flamingo.js", function( geometry ) {
morphColorsToFaceColors( geometry );
geometry.computeMorphNormals();
var material = new THREE.MeshLambertMaterial( { color: 0xffffff, morphTargets: true, morphNormals: true, vertexColors: THREE.FaceColors, shading: THREE.FlatShading } );
var meshAnim = new THREE.MorphAnimMesh( geometry, material );
meshAnim.duration = 5000;
meshAnim.scale.set( 1.5, 1.5, 1.5 );
meshAnim.position.y = 150;
scene1.add( meshAnim );
morphs.push( meshAnim );
} );
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.