meshfx // CONVERT // OBJ TO GLB
How to convert an OBJ file to GLB
You convert OBJ to GLB by importing the .obj with its .mtl file and textures into a 3D editor, setting the size yourself (OBJ has no units), rebuilding the material as PBR, and exporting glTF 2.0 (.glb). Keep the .obj, .mtl and texture files in one folder first, or the textures will not load.
pyrofx effects work today, and new accounts start with $5 of usage.
meshfx measures faults, checks repairs and makes LODs for a triangle budget. meshfx runs on the hosted API: try it in the Playground.
- OBJ has no units or pivots
- Materials live in the .mtl file
- No animation to carry over
01 // WHAT CHANGES
What OBJ leaves out
- OBJ stores plain numbers with no unit, so the same file can mean meters, centimeters or inches. GLB is in meters, so you decide the scale at import.
- OBJ has no objects with their own position or pivot, because the vertex coordinates are the pivot. Set origins in your editor before export so each GLB node has a sensible pivot.
- The .mtl file holds old-style color, specular and shininess values plus texture paths, while GLB wants base color, metallic and roughness, so you rebuild the material.
- An OBJ may or may not include normals (the
vnlines), and without them the model shades faceted until you smooth it. - OBJ has no animation, so there is nothing to carry over.
02 // BY HAND
Convert it by hand
- Put the .obj, .mtl and textures in one folder, open the .mtl in a text editor, and change any absolute texture paths to plain file names.
- Import the OBJ into Blender or your 3D editor and scale it to real size next to a 1 m cube.
- Join or separate objects the way you want them in your scene, and set each origin.
- Turn on smooth shading with a smoothing angle if the model came in faceted.
- Rebuild each material as PBR, with base color from the
map_Kdtexture and roughness and metallic as values or maps. - Export glTF 2.0 as glTF Binary (.glb) and check it in a glTF viewer or your engine.
03 // MTL FILES
Read the .mtl before you import
Most missing-texture problems with OBJ start in the .mtl file. It is plain text, and each material lists its textures on lines such as map_Kd wood.png for color and map_Bump wood_n.png for bump or normal detail. If those lines point at a drive letter or a folder on someone else's computer, the importer finds nothing and the model loads gray.
04 // meshfx
meshfx for obj to glb
meshfx measures holes, flipped faces and non-manifold edges. Each repair is checked against the source and undone with a warning if it moves the surface too far. Hosted meshfx runs are available in the Playground.
How do I load a glTF model in three.js?
Use GLTFLoader to load the file and add gltf.scene to your scene, attaching DRACOLoader first if the geometry uses Draco compression.
Does OBJLoader in three.js handle ngons?
Yes, it splits faces with more than three corners into a fan of triangles, which breaks concave faces. Triangulate in your 3D editor first.
How do I fix incorrect object scale before exporting an OBJ?
Scale the model to its real size, apply the scale and set the OBJ exporter scale field so one file unit matches one engine unit.
Why does my OBJ look black in three.js?
Its vn normals point inward or are missing. Export again with corrected normals or call geometry.computeVertexNormals() on each mesh after OBJLoader loads it.
Explore meshfx outputs
Inspect compiled meshfx outputs and their reports. Hosted meshfx runs are available in the Playground.