garrettlynchirl
garrettlynchirl

Reputation: 910

obj missing material in three.js objloader

I'm using the objloader in three.js but the .obj I'm working with does not load the material. Everything is loading fine in three.js according to the console. I have the three obj files in the same folder, they are - model.jpg, model.obj and model.mtl.

model.obj has both the reference to the mtl and the material to use like so:

mtllib model.mtl
usemtl $Material_0

model.mtl has the following:

newmtl $Material_0
Kd 0.6 0.6 0.6
Ka 0.05 0.05 0.05
Ks 0.6 0.6 0.6
illum 1

shouldn't there be a map line for the jpg in this as well or is there something else that's missing?

Upvotes: 0

Views: 444

Answers (1)

Mugen87
Mugen87

Reputation: 31026

shouldn't there be a map line for the jpg in this as well or is there something else that's missing?

Yes. Normally there should be an additional line like in the following example if the MTL actually refers to a texture (e.g. diffuse map).

newmtl $Material_0
Kd 0.6 0.6 0.6
Ka 0.05 0.05 0.05
Ks 0.6 0.6 0.6
illum 1
map_Kd diffuse.jpg

Upvotes: 1

Related Questions