Guides ·

How to convert STEP to GLB for a website or AR

You have a product as a STEP file and want it turning on a web page, or standing on a table in augmented reality (AR). Browsers can't read STEP, but nearly every web 3D viewer reads GLB. This post explains what the conversion changes, how to keep the file small, and walks through it on a 16-part 3D printer extruder.

Drop your STEP file on the free STEP to GLB converter, keep curves on Normal, untick hidden parts and download a GLB ready for the web.Try it on your own file
The MK8 extruder STEP file in the unmake STEP to GLB converter: grey motor, yellow bracket, finned heatsink and black fan, Converted: your GLB is ready to download, Smoothness of curves on Normal with 10,946 triangles and about 335 KB, 80.5 × 52 × 74 mm, 104.88 cm³
The MK8 extruder in the converter, 16 parts in their colours. Model: MK8 by Daniel Stauffer, FreeCAD library, CC BY 3.0.

Why a web viewer wants GLB

A STEP file stores exact geometry: a hole is a cylinder with a radius, a fillet is a curved surface with a formula. To draw it, a program first turns those surfaces into small flat triangles, a mesh. That takes a CAD kernel, a large piece of software a web page would rather not load.

GLB is the binary form of glTF 2.0, a format from the Khronos Group made for showing 3D. It holds the mesh, ready for the graphics card, plus colours and part names, all in one file. Google's model-viewer, a common way to put 3D on a page, accepts only glTF and GLB.

What changes in the conversion

Curves become triangles. Each solid in the STEP file becomes its own mesh with its name, and each colour becomes a simple material.

Units and axes change too. The glTF specification says all distances are in metres and +Y is up. CAD files are usually in millimetres with Z up. A good converter fixes both, so the model stands upright at its real size instead of lying on its back 1,000 times too big.

STEP holds exact curved surfaces in millimetres with Z up; the GLB holds triangles with colours and part names, in metres with Y up, which a web page or a phone's AR view can show
From exact curves to triangles, millimetres to metres, Z up to Y up.

Detail decides the file size

More triangles follow curves more closely and make a bigger file. The converter's Smoothness of curves menu shows each level's triangles and the expected file size. On the sample extruder: Coarse 8,294 triangles (≈ 268 KB), Normal 10,946 (≈ 335 KB) and Fine 24,994 (≈ 678 KB). The STEP file itself is 3,234,890 bytes.

On a screen, Normal already looks smooth; the extra triangles of Fine only help when the mesh will be printed. For a page that people open on phones, Coarse cuts the download by another fifth.

Hide what nobody will see

Screws inside a housing, a motor behind a cover, the back of a fan: hidden parts still cost triangles and download time. Untick them in the parts list before downloading; the GLB holds only what is visible.

On the extruder, unticking the 40 mm fan took Normal from 10,946 to 8,418 triangles and the downloaded GLB from 355,640 to 279,564 bytes, about a fifth less. The size line changed from 80.5 to 70.5 mm long, a quick check that the right part went.

Check the GLB before you publish

Open the result in a GLB viewer and compare it with the STEP. Our Normal file opened in the unmake GLB viewer with 16 parts, 10,946 triangles, the same colours and a volume of 104.88 cm³, as in the converter.

The size now reads 80.5 × 74 × 52 mm instead of 80.5 × 52 × 74 mm. Nothing moved: the height, 74 mm, is now the second number because Y is up. The part names came along too, straight from the CAD model: Nema-17-motor-40mm-final, fan-40x40mm-final and feature names such as Pad006.

The converted MK8.glb open in the unmake GLB viewer: same colours, 80.5 × 74 × 52 mm, 104.88 cm³, Closed (watertight) shape, 10,946 triangles, 16 parts, units m, up axis Y
The GLB checked in the GLB viewer: 16 parts, colours kept, Y up. Model: MK8 by Daniel Stauffer, FreeCAD library, CC BY 3.0.

Put it on a page or in AR

With model-viewer, one tag shows the file: <model-viewer src="MK8.glb" camera-controls ar></model-viewer>, after loading its script as its documentation describes. Visitors can turn and zoom the model.

The ar attribute adds an AR button on phones that support it. On Android it can open Scene Viewer; on an iPhone it opens Quick Look, for which model-viewer makes a USDZ file from your GLB on the fly. Because the GLB is in metres, the extruder appears at its real size, about 8 cm long.

Want a polished look, with brushed metal instead of flat grey? Open the GLB in Blender, which imports and exports glTF, change the materials and export again.

A worked example: the MK8 extruder

  1. Download MK8.step from the FreeCAD library (Electrical Parts, Hotend): a 3,234,890-byte STEP AP214 file of an MK8 extruder with a NEMA 17 motor, heatsink and fan, 16 solids.
  2. Drop it on the STEP to GLB converter. It opens with 16 parts, 80.5 × 52 × 74 mm and 104.88 cm³, in its own colours: grey motor, yellow bracket, black fan.
  3. Leave Smoothness of curves on Normal (10,946 triangles, ≈ 335 KB) and press Download GLB: MK8.glb, 355,640 bytes, about a ninth of the STEP.
  4. Drop MK8.glb on the GLB viewer: 80.5 × 74 × 52 mm, 16 parts, 10,946 triangles, colours and names kept.
  5. For a lighter phone version, untick the fan (8,418 triangles, 279,564 bytes) or choose Coarse (8,294 triangles, 286,600 bytes).

Common mistakes

Questions

Will the AR view show the model at its real size?

Yes, when it first appears: the GLB is in metres, so model-viewer places the extruder at about 8 cm. Visitors can then pinch to resize it; add ar-scale="fixed" to the tag to keep it at 100%.

Will the GLB work in AR on an iPhone?

iPhones use Quick Look, which reads USDZ. If you show the GLB with model-viewer, it creates the USDZ for Quick Look when the AR button is pressed.

Does the GLB keep part names and colours?

In our test, yes: the extruder's 16 solids became 16 meshes and 16 coloured materials, all carrying their STEP names, and the scene is named MK8 after the file.

Can I convert the GLB back to STEP?

No. A GLB holds triangles only. If a supplier needs the part, send the STEP; the GLB is for showing it.

Sample file: MK8.step · CC BY 3.0, Daniel Stauffer (FreeCAD library)

Sources

Drop your STEP file on the free STEP to GLB converter, keep curves on Normal, untick hidden parts and download a GLB ready for the web.Try it on your own file