Looking for a simple example to render my .OBJ along with its .MTL (and OrbitControl)

I’m rusty with coding. I’m just trying to get a barebones rendering of my .OBJ along with its associated .MTL file. I’ve tried several examples I found online but they don’t list all the moving parts, so I can’t seem to get them working.

MY .OBJ is just a single static object, that I want to apply the .MTL file to, so it picks up the colours (currently, it’s just white, no matter what I do to the .OBJ in Blender), as well as the Orbit Control to spin the object (this I do have working, but again, only in my current implementation).

Perhaps someone could point me at a stand-alone example that incoprporates a .MTL in a simple implementation?

Most likely you have already tried it, but here is the official Three.js example of loading OBJ+MLT (click on the (<>) button in the lower right corner to view the source):

https://threejs.org/examples/?q=ob#webgl_loader_obj_mtl

If this example does not work for your case, it could be some issue with the object and/or material file (e.g. non standard feature, or feature not supported by the OBJ/MLT loaders).

2 Likes

An old example from the collection brought up to date. The lighting is different. You have to look more closely.

loadOBJ 2018

loadOBJ 2025

“… click on the (<>) button…”
GRR! I saw that and assumed by its location, isolation and symbology that was navigation arrows to go between examples!

The correct symbol for code is </>!

(Thanks.)

1 Like