How STL Converts to GLB — And Why Colors Disappear
Every day thousands of people convert STL files to GLB and immediately discover their colored, textured model has turned grey. This is not a bug. It is the inevitable result of STL's core design — and once you understand why it happens, you also understand how to fix it. This guide covers the full conversion process, the color loss problem, and your real options for getting color into a GLB.
Why Convert STL to GLB at All?
STL is the universal language of 3D printing. GLB is the universal language of real-time 3D on the web, in AR, and in game engines. If you want to display a 3D-printable model on a website, in an AR viewer, or in Unity/Unreal, you need it in GLB. STL files cannot be loaded by Three.js, Babylon.js, Google's model-viewer, or most game engines without a conversion step.
Web 3D viewer → GLB. Android AR (SceneViewer) → GLB. Godot game engine → GLB. React Three Fiber → GLB. If it touches the web or a real-time renderer, convert to GLB.
The Root Cause: What STL Cannot Store
STL stores exactly one type of data: triangle geometry. The format specification, written in 1987, has no fields for color, material, roughness, metallic, emissive, or transparency. It was designed purely to describe the shape of an object for a stereolithography machine — a machine that at the time could only produce objects in one color of resin.
The triangle data in an STL file consists of:
- A surface normal vector (which direction is "outside")
- Three vertex coordinates (X, Y, Z positions of each corner)
That is everything. No color field exists anywhere in the standard specification.
What Actually Happens During Conversion
When a converter processes an STL file into GLB, it performs these steps:
- Parse the STL — read all triangle normals and vertex positions
- Build a vertex buffer — deduplicate shared vertices, build index buffer
- Create a mesh node — wrap the geometry in a glTF mesh primitive
- Assign a default material — since STL has no material data, the converter invents one. Usually this is a solid grey PBR material with metallic=0, roughness=0.5
- Write the GLB — package the JSON scene descriptor and binary buffer into a .glb container
Step 4 is why the output looks grey. The converter did not lose your colors — the colors were never there to begin with.
Why Colors Always Disappear
If your STL appeared colored in your CAD software, one of three things was happening:
- The CAD software was displaying a preview color — Fusion 360, Tinkercad, and others assign display colors to bodies for visual organisation, but these are not stored in the STL when you export
- You had a separate OBJ+MTL workflow — some tools export color through OBJ format which has a companion .mtl material file. STL does not have this
- Non-standard color extension — some software writes color data into STL's 2-byte "attribute byte count" field. This is unofficial and is ignored by most converters
If you exported from any CAD tool to STL, your color data was discarded at export time, before the conversion to GLB even began. The STL file itself is colorless. The GLB converter has nothing to work with.
How to Convert STL to GLB
Option 1: Online Converters
Convertio, CloudConvert, Online3DConverter — upload your STL, download GLB. Fast and free for small files. Result will be grey geometry with a default material. Good for quick previews where color does not matter.
Option 2: Blender (Free, Most Powerful)
- Open Blender → File → Import → STL
- Apply materials in the material properties panel
- File → Export → glTF 2.0 → choose GLB format
This is the only workflow that lets you add real PBR materials before export.
Option 3: obj2gltf (Node.js CLI)
If you have an OBJ+MTL version of your model (which does contain basic materials), use the obj2gltf command-line tool to convert to GLB while preserving color information.
npm install -g obj2gltf obj2gltf -i model.obj -o model.glb
How to Add Color to Your GLB
There are three practical approaches, from simplest to most powerful:
1. Assign a Flat Color in Blender
Import your STL into Blender, select the object, open the Material Properties tab, click New, set the Base Color to your desired color, set Metallic and Roughness to taste, then export as GLB. The result will be a solid-color GLB with a proper PBR material.
2. Paint Vertex Colors in Blender
For models that need different colors on different parts of the geometry: in Blender, enter Vertex Paint mode and paint colors directly onto the mesh. Export with vertex colors enabled. The GLB will contain per-vertex color data that most real-time renderers can display.
3. UV Unwrap and Apply a Texture
The most professional approach: UV unwrap the mesh in Blender, create or bake a texture map, apply it as the albedo texture on a PBR material. The exported GLB will contain the embedded texture and full material definition. This is how game-ready assets are made.
The Best Workflow for Colored GLB From 3D Print Models
If you start with a 3D print model and need a colored GLB for web display, here is the most efficient path:
- Export from your CAD tool to OBJ format (not STL) — OBJ supports basic material colors via the .mtl companion file
- Import the OBJ into Blender — the material colors will be preserved
- Refine materials if needed (add roughness, convert to PBR)
- Export as GLB from Blender with "Include → Materials" enabled
Skip STL entirely if color matters. Export from your CAD software to OBJ or FBX — both support material data. STL is for printers, not for real-time display.
Frequently Asked Questions
Related Articles