javascript - Three.js Mesh animation and texture mapping -
i did research , learn how export obj file .js file can imported json model of three.js. how can animated such model ? have bird model in .js format need learn flap wings. further more when downloaded obj file internet free model contains texture images object when import obj in 3d modelling software blender 3d, cannot load texture has location right inside obj file when open text editor. when convert .js format has right location located bmp images texture mapping, fail load when load model in webgl, using json model.
can please point me in right direction can learn thinks, great if know , me right away in answer. please, need form guys .
code of 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 here
http://threejs.org/examples/webgl_morphnormals.html http://threejs.org/examples/webgl_morphtargets_horse.html
in first example 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 ); } );
Comments
Post a Comment