Graphics Reference
In-Depth Information
newmtl Cap
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.990000 0.120000 0.120000
Ks 0.500000 0.500000 0.500000
Ni 1.000000
d 1.00000
illum 2
newmtl Minifig
Ns 874.999998
Ka 0.000000 0.000000 0.000000
Kd 0.800000 0.800000 0.800000
Ks 0.200000 0.200000 0.200000
Ni 1.000000
d 1.000000
illum 2
map_Kd ../textures/Mini-tex.png
This .mtl file defines two materials: one for the body of the mini figure and
one for its cap. What we need to check is the map_Kd property. This prop-
erty needs to contain the relative path, from where the .obj file is loaded to
where Three.js can find the textures. In our example, this path is: .../tex-
tures/Mini-tex.png .
2. Now that we've made sure the .mtl file contains the correct references, we
can load the model using THREE.OBJMTLLoader :
var loader = new THREE.OBJMTLLoader();
// based on model from:
// http://www.blendswap.com/blends/view/
69499
loader.load("../assets/models/lego.obj",
"../assets/models/lego.mtl",
function(obj) {
obj.translateY(-3);
obj.name='lego';
Search WWH ::




Custom Search