Tuesday, 15 February 2011

javascript - Texture not being rendered by OBJMTLLoader -



javascript - Texture not being rendered by OBJMTLLoader -

i have 3d model texture comes blender in obj/mtl/jpg format. cannot render correctly three,js.

the viewer code identical illustration on three.js website. have changed paths obj , mtl files. i'm pretty sure files in right place. obj , mtl files loaded, , path jpg in mtl file right path relative mtl file (there 404 if alter it).

yet result black model. my illustration can found here. can set me out of misery , tell me i've done wrong?

for ease of reading:

the obj file the mtl file the jpg file

you need understand parameters in mtl file represent. diffuse reflectance , ambient reflectance black -- not good. alter them reasonable, so:

kd 1.000 1.000 1.000 # white ka 1.000 1.000 1.000 # white

or modify loader callback function so:

node.material.color.setrgb( 1, 1, 1 ); node.material.ambient.setrgb( 1, 1, 1 ); // no longer required (see note)

note: ambient property of material has been removed three.js, need set color.

three.js r.71

javascript three.js webgl

No comments:

Post a Comment