3DPremium

3D Product Showcase

Interactive 3D .glb on your product page: 360° drag-to-rotate, AR on mobile, deferred loading and integrated CTA.

model-viewer3DAR

Updated

This effect is part of Effect.Labs — 846 vanilla effects, some free, some premium. 3D has 50 effects, including 8 free. Explore the category →

3 usage examples

Main product page — limited edition luxury watch — 3D Product Showcase example 1

① Main product page — limited edition luxury watch

WhenHero section of a dedicated product page for a unique piece or limited edition: the 3D model spans the full available width, the bottom-left overlay shows the product name, the crossed-out original price and the sale price, and the Add to cart button is clickable. A discount badge appears in the top left corner.
WhyA real interactive 3D model replaces the static photo carousel and gives visitors the feeling of holding the product. Auto-rotation catches the eye and sets the page apart from an ordinary product listing; on mobile, the AR button lets customers place the watch on their real desk.
SettingsAttributes camera-orbit="25deg 78deg 105%" and field-of-view="30deg" for a slight overhead angle. exposure="1.05" and shadow-intensity="1" for warm lighting. Badge .p3d-badge with the discount rate in the top left corner.
Product grid — two 3D product cards side by side — 3D Product Showcase example 2

② Product grid — two 3D product cards side by side

WhenA product listing where each card shows a 3D model rotating gently, with name and price in an overlay. Two cards fit side by side within 540 px wide; each has its own [data-p3d] wrapper and the auto-rotation resumes independently for each card.
WhyA grid of animated 3D cards draws attention without overloading the page; each gently rotating model conveys depth and quality far above a flat photo grid. The script loads model-viewer only once, regardless of how many cards are on the page.
Settingsauto-rotate-delay="600" to start rotation after a short delay. rotation-per-second="10deg" for a slow catalog spin. Minimal overlay: .p3d-name + .p3d-price only, without badge or AR button.
Brand page — editorial craftsmanship showcase — 3D Product Showcase example 3

③ Brand page — editorial craftsmanship showcase

WhenAn About page or storytelling section for an artisan brand: the 3D model fills a full-width section on a dark background, with no price overlay, and a brand headline and tagline partially overlaid at the bottom.
WhyPlacing the model in an editorial context (no e-commerce CTA) demonstrates the product's level of finish and the brand's technical mastery — more powerful than a series of studio photographs. The slow rotation and careful lighting communicate a quality promise.
SettingsRemove .p3d-cta and .p3d-badge. Set camera-orbit="0deg 90deg 110%" for a neutral front view. rotation-per-second="6deg" for a very slow spin. Replace the scene background with a darker, more neutral gradient.

How it works

The core component is a <model-viewer> tag (Custom Element registered by model-viewer.min.js) inside .p3d-scene. The camera-controls attribute enables drag-to-rotate (mouse or touch); auto-rotate starts automatic spin on load, with rotation-per-second="22deg"; auto-rotate-delay="0" removes the initial delay. disable-zoom blocks pinch gestures to avoid interfering with the page's vertical scroll; touch-action="pan-y" keeps native scrolling active on mobile.

model-viewer.min.js is an ES module (~530 KB) loaded on demand: an IntersectionObserver with rootMargin="200px" watches each [data-p3d] and injects the <script type="module"> tag as the scene approaches the viewport — then disconnects. A boolean flag loaded prevents double loading when multiple scenes coexist on the same page. On browsers without IntersectionObserver, the script is injected immediately on page load.

The ar attribute on <model-viewer>, combined with ar-modes="webxr scene-viewer quick-look", enables the AR button. On click, the script calls mv.activateAR(): WebXR first (Android Chrome 79+), then Scene Viewer (Android with Google Play Services), then Quick Look (iOS Safari 12+). The AR button (.p3d-ar) is a plain <button> positioned absolutely; it can be hidden if mv.canActivateAR is false.

The poster slot contains the loading state shown while the .glb is downloaded and parsed. --poster-color: transparent removes the slot's default white background. The attributes exposure="1.05", shadow-intensity="1" and camera-orbit="25deg 78deg 105%" set global lighting, contact shadow and initial camera position; field-of-view="30deg" reduces perspective distortion for a near-telephoto look.

Accessibility

  • Keyboard navigation: model-viewer's camera-controls exposes a visible focus ring and accepts arrow keys (left/right: yaw rotation, up/down: elevation) to rotate the model — no extra ARIA needed.
  • Reduced motion: under prefers-reduced-motion: reduce, the script removes the auto-rotate attribute before the first render — the 3D piece remains interactive and rotatable by drag, but automatic rotation is disabled.
  • Model description: the alt attribute on <model-viewer> is announced by screen readers in place of the visual render. The text should describe the product concisely (e.g. "Brushed-steel chronograph watch, 3D 360° view").
  • AR button: the .p3d-ar button is a native <button type="button">; on browsers without AR (mv.activateAR absent), clicking has no visible effect. To hide it cleanly, listen to model-viewer's ar-status event or check mv.canActivateAR after load.
  • No-WebGL fallback: the poster slot guarantees a readable message when 3D rendering is unavailable (old browser, no GPU, permission denied). The .p3d-cta button remains accessible at all times as it lives outside the model-viewer component.

Browser compatibility

model-viewer uses WebGL (and WebGL 2.0 for some lighting effects) for rendering. The component is available as a Custom Element in all modern Chromium-based browsers. AR: WebXR (Chrome Android 79+), Scene Viewer (Android with Google Play Services), Quick Look (Safari iOS 12+). IntersectionObserver since Chrome 51, Firefox 55, Safari 12.1.

Chrome 79+✓ Full (3D + AR via WebXR, measured)
Firefox 72+✓ Full 3D view (AR not available)
Safari 15.4+✓ 3D view + AR Quick Look (not measured)
Edge 79+✓ Full (Chromium engine)
Mobile iOS 12+✓ 3D view + AR Quick Look (not measured)
Android Chrome 79+✓ Full (3D + AR via Scene Viewer)

Without WebGL or network access, model-viewer stays on the poster slot screen — the loading message and CTA button remain visible. Without IntersectionObserver, the model-viewer script is loaded immediately instead of being deferred.

The code

HTML structure to paste into your page (the CSS + JS come with your purchase):

index.html — structure
<div class="fx-0809-root">
  <div class="p3d-scene" data-p3d="">
    <span class="p3d-badge">…</span>
    <button type="button" class="p3d-ar" data-p3d-ar="">…</button>
    <model-viewer class="p3d-mv" data-p3d-mv=""
      src="/assets/models/watch.glb"
      alt="…"
      camera-controls="" auto-rotate="" auto-rotate-delay="0" rotation-per-second="22deg"
      interaction-prompt="none" disable-zoom="" touch-action="pan-y"
      shadow-intensity="1" exposure="1.05" camera-orbit="25deg 78deg 105%" field-of-view="30deg"
      ar="" ar-modes="webxr scene-viewer quick-look">
      <div class="p3d-poster" slot="poster" aria-hidden="true">
        <span class="p3d-emoji">…</span>
        <span>…</span>
      </div>
    </model-viewer>
    <div class="p3d-overlay">
      <div class="p3d-name">…</div>
      <div class="p3d-price"><s>…</s>…</div>
      <button type="button" class="p3d-cta">…</button>
    </div>
    <div class="p3d-hint" aria-hidden="true">…</div>
  </div>
</div>

One-time payment, no subscription — the code is yours forever

Customize

Options passed to the API or data-* attributes:

Option / propertyDefaultEffect
3D file — src attribute on <model-viewer> /assets/models/watch.glb Replace with any .glb or .gltf file hosted on the same domain (or with CORS enabled). .usdz files are supported for iOS Quick Look via the ios-src attribute. Common 3D tools (Blender, Cinema 4D, Sketchfab) export to .glb.
Promo badge — content of .p3d-badge −40% Free text: discount rate, "New", "Exclusive"… Leave empty or remove the element to hide the badge.
Rotation speed — rotation-per-second attribute 22deg Reduce to 8deg for a barely perceptible spin on an editorial page; increase to 40deg for a dynamic demo effect.
Camera position — camera-orbit attribute 25deg 78deg 105% Three values: azimuth (rotation around vertical axis), elevation, distance. "0deg 90deg 100%" gives a neutral front view; "45deg 60deg 90%" a high diagonal perspective.
Lighting — exposure and shadow-intensity attributes 1.05 / 1 exposure from 0.8 to 1.2 adjusts overall brightness. shadow-intensity from 0 to 2 controls the contact shadow on the floor (0 = no shadow).
AR activation — ar attribute on <model-viewer> present Remove the ar attribute to disable AR entirely and hide the .p3d-ar button. AR requires HTTPS; on HTTP the browser blocks it regardless of this attribute.
Loading poster — poster slot ⌚ emoji + "Loading 3D product…" Replace with a high-resolution PNG or JPG of the product for immediate visual feedback before the .glb is ready. Prefer an image at the same aspect ratio as the model-viewer viewport.

FAQ

Yes. The src attribute on <model-viewer> accepts any .glb or .gltf file hosted on the same domain (or with CORS enabled). For AR on iOS, add a .usdz file via the ios-src attribute. Common 3D tools (Blender, Cinema 4D, Sketchfab) export to .glb.
After model-viewer loads, the load event exposes mv.canActivateAR (boolean). Listen to that event and show or hide the button accordingly: mv.addEventListener('load', () => { arBtn.hidden = !mv.canActivateAR; }). AR also requires HTTPS, so the button can be hidden server-side based on the protocol.
No. The IntersectionObserver with rootMargin="200px" only triggers the model-viewer load when the scene approaches the visible viewport. If the visitor leaves the page without ever reaching the section, neither model-viewer.min.js (~530 KB) nor the .glb file is downloaded.