Guide Adding a 3D Model to a Website
Back to top

How to add a 3D model to a website the file, the viewer and the page

Start a project

A product that turns in the browser needs a GLB file, a viewer in the page and a model light enough to load on a phone.

Guide

To add a 3D model to a website, export the model as a GLB file, upload it, and place a viewer in the page that points to it. The visitor can then turn the product, zoom in and look at it from any side, in an ordinary browser.

The code is the short part. A viewer such as the open-source model-viewer component is one tag in the page HTML. Most of the work is in the model: making it accurate, making it look right under the viewer's lighting, and making the file small enough to load quickly on mobile data. This guide covers the format, the viewer, the ways to keep a file light, the poster image and placement on the page. There are live 3D models on our home page to try.

In short

  • 01

    Use GLB

    A GLB file holds the shape, the materials and the textures in one file that browsers can display.

  • 02

    Add a viewer

    The model-viewer component is a tag in the HTML that loads the file and handles turning and zooming.

  • 03

    Keep it light

    Fewer polygons, Draco compression and smaller textures bring the file down to a size a phone can load.

  • 04

    Show a poster first

    A still image appears at once, and the model takes its place when it has loaded.

  • 05

    Place it where it helps

    In the product gallery or beside the specifications, where a buyer already looks for detail.

  • 06

    Check your platform

    E-commerce platforms set their own rules for 3D files. Read the current ones before the model is made.

Seen in practice

Products we have built in 3D. Live models you can turn are on the home page.

Duke & D’or Noir 50 ml perfume bottle, CGI product render Duke & D’or PerfumesNoir & royal eau de parfum
American Tourister suitcase, frame from the 3D product film American Tourister — Suitcase3d product film — suitcase animation

The file: what a GLB file is

GLB is the single-file form of glTF, an open format for 3D models made for the web. A GLB file contains the mesh, which is the shape, the materials, which say how each surface responds to light, and the textures, which are the images wrapped onto the surfaces. Browsers on phones and computers can display it without a plug-in.

Other 3D formats exist for other purposes. CAD formats are for manufacturing. The files a rendering studio works in are for making images and films. Neither is meant to be sent to a visitor's phone. For a website, the model is exported or rebuilt as GLB.

The viewer: a tag in the page HTML

A viewer is the code that loads the GLB and draws it. The one we use is model-viewer, an open-source web component. A developer adds its script to the page once, then writes a single tag where the model should appear. The tag names the GLB file, the poster image and a few settings: whether the model turns by itself, how far the visitor can zoom, and how it is lit.

That is how to add a 3D model to a website in HTML. No 3D programming is needed, and a developer who can edit a page template can do it. The same tag can later carry an AR button, so the product can be viewed in a room from a phone.

Keeping the file light

A heavy model is the usual reason a 3D view fails. The visitor sees an empty box, waits and scrolls on.

The skill is in reducing the size without the product looking worse. Detail is kept where the eye goes, such as stitching, edges and logos, and removed where it does not show. A model taken from CAD or from a rendering scene nearly always has to be rebuilt this way. These are the things that decide the size.

  • Polygons, the small flat faces that make up the shape: use fewer, placed where the curves need them
  • Draco compression: a method that shrinks the shape data inside a GLB
  • Textures, the images on the surfaces: smaller dimensions and efficient image formats
  • Materials: fewer separate materials means fewer sets of textures to download
  • Hidden parts: remove anything the visitor can never see

The poster image and loading

A poster is a still picture of the product, taken from the angle the model starts at. It shows as soon as the page opens. When the model has loaded, it takes the poster's place, and because the angle matches, the change is hardly noticed.

Set the viewer to load the model only when it scrolls into view, or when the visitor taps. A page with many products should not download every model at once. On a slow connection the visitor still sees the poster, which is an ordinary product image.

Where on the page it goes

Put the 3D view where a buyer already looks for detail. On a product page that is the image gallery, as one of the slides, or a panel beside the specifications. Give it enough room. A model shown in a small box is harder to use than a photograph.

Tell the visitor it can be turned. A short label or a hand icon is enough, since many people will otherwise take it for a still image. On a phone, check that a finger drag on the model turns it and a drag outside it still scrolls the page. Keep ordinary photos on the page as well. Search engines, social previews and visitors on older devices rely on them.

E-commerce platforms and marketplaces

Store platforms and marketplaces handle 3D differently. Some accept a 3D file among the product images. Some need an app or a change to the theme. Marketplaces publish their own technical requirements for the file type, the file size and how the model is built, and they revise them.

We do not list those requirements here, because they change. Read the platform's current help pages, or ask your developer, and send us the requirements with the brief. We build the model to them. See AR-ready 3D models.

When the model itself is the problem

If the viewer is in place and the result still looks poor, the cause is nearly always the model. Common faults are a product that looks flat because the materials were not set up for real-time display, colours that do not match the real product, visible flat faces on curves, and a file too heavy to load.

A model made for the web is built for that purpose from the start: to real dimensions, with clean geometry, with materials checked in the viewer under neutral light, and tested on a phone. That is what our 3D models for websites service delivers. For models of a whole product range, see 3D product modelling.

Questions

How do I add a 3D model to my website?

Export the model as a GLB file, upload it, and add a viewer tag to the page that points to the file. The model-viewer component is one such viewer. Add a poster image so that something shows while the model loads.

What is a GLB file?

A GLB file is a 3D model packed into one file, with its shape, materials and textures. It is the single-file form of the glTF format, and web browsers can display it.

Which 3D model format does Shopify accept?

Platforms set and revise their own rules, so check Shopify's current help pages for the accepted file types and size limits. GLB is the usual format for 3D on the web, and we build to whatever the platform asks for.

How large should a 3D model be for a website?

As small as it can be while the product still looks right. There is no single limit. It depends on the product, the page and your visitors' connections. Fewer polygons, Draco compression and smaller textures are how the size comes down.

Can I use my CAD file or a rendering model directly?

Usually no. Those files are far heavier than a browser can load, and their materials are set up for other software. The model is rebuilt for the web from the same dimensions.

Will the same model work for AR?

Yes, if it was built to real dimensions. The GLB is used for AR on Android, and a USDZ copy is made for iPhone. Tell us at the start so the model is prepared for both.

Does a 3D model slow the page down?

It does not have to. With a poster image, and loading set to wait until the model is in view, the page opens with an ordinary image. The model downloads only when it is needed.

Keep going

Get in touch

Tell us the product, the page it is for and the platform you sell on. We reply with a quote.