1

I'm working a simple proof of concept. This involves exporting a simple textured model from Blender into the an .obj model file, an .mtl material file, and some .jpg texture images. My model is a single plane with a grass texture on the top of it.

The problem I'm having is the grass texture isn't loading. I'm getting console messages and the JS code looks to be actually loading the image file, but it's not showing up. The plane is a green colour, which I don't understand, since I havent defined colours anywhere. I'm not sure if this is a rendering problem.

I had a look at the examples ThreeJS provides, but they're slightly different than the files I'm getting from blender. The obj loader example doesn't include any .mtl files. The obj + mtl loader example is using some .dds files for the models, which I don't have. I had a quick look into it and it has something to do with direct x.

My example is up at https://www.raydowe.com/three/

Does anyone have an example of how to load .obj, .mtl, and .jpg assets into ThreeJS?

1 Answer 1

1

so, this is easy you need texture coordinate to map the texture onto the vertices. In the *.obj it is represented into "vt"

https://github.com/koolkap/Obj-Mtl-Loader

This is your working sample

https://github.com/koolkap/Obj-Mtl-Loader/blob/master/obj/scene.obj

this is *.obj required. feel free to ask

Sign up to request clarification or add additional context in comments.

2 Comments

I played around with this again and realized it was indeed a problem with my model. Thanks.
Yup map texture in blender this is easy happy coding

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.