You are reading the documentation for the version 2 of the ShapeDiver viewer API. Free support for this viewer version will be discontinued on June 1st, 2024.

Please refer to the version 3 documentation here. See also the migration guide from version 2 to version 3 here.

ShapeDiver 3D Viewer

You are reading the documentation of the public API of the ShapeDiver 3D viewer v2. This is the result of a complete software redesign of ShapeDiver's 3D viewer v1. It offers the following advantages over v1:

  • new API v2 making use of promises
  • support for multiple simultaneous sessions with one or several ShapeDiver models
  • drag & drop, selection, highlighting
  • advanced rendering and materials
  • advanced control of the 3D scene (geometry and lighting)
  • support for multiple viewports
  • file/blob parameter types
  • AR support soon to be there

Read more about ShapeDiver and 3D product configurators.

API

API v2

The new API v2 offers numerous advantages over API v1:

  • supports promises and provides direct feedback of the result of asynchronous operations
  • consistent naming convention
  • support for changing of materials, and updating/adding of geometry
  • support for drag & drop, selection, and highlighting
  • support for configuration of the 3D scene lighting
  • support for multiple viewports
  • file/blob parameter types

API v1

The API v1 is offered for backwards compatibility with the API of ShapeDiver's 3D viewer v1.

We discourage use of the API v1 for developing new applications.

Questions, feedback, bugs

Don't hesitate to ask questions and provide feedback, please use our forum for this purpose. Should you find a bug, please report it in our forum or email us.

Notice for developers

The JavaScript API objects might contain additional members or functionality which are not documented here. Do not use such undocumented functionality. Such additional functionality will likely be changed or removed by us between releases or patches without further notice.

Browser support

The ShapeDiver 3D viewer v2 supports the following browsers:

  • Chrome
  • Firefox
  • Edge
  • Safari
  • Internet Explorer 11
  • Modern Smartphones and tablets, Android and iOS

External dependencies

  1. THREE.js

    WebGL based library used to create and display animated 3D computer graphics on a Web browser

  2. axios

    Alternative promise based standalone HTTP-client to replace jQuery

  3. verb-nurbs - optional

    verb is a library for creating and manipulating NURBS surfaces and curves in many languages including JavaScript

Release Notes

Version Release date Notes
------ -------------- ------------------
2.0.6 2018-07-01 API v2 available
------ -------------- ------------------
2.0.7 2018-08-22 Browser testing
------ -------------- ------------------
2.0.8 2018-08-30 Parameter history API
------ -------------- ------------------
2.1.0 2018-10-12 Multiple viewports, browser tested
------ -------------- ------------------
2.2.0 2018-11-23 oauth2 support
fixed iOS texture problems
fixed rendering of transparent objects
drag/selection/hovering handler now supports touch events
------ -------------- ------------------
2.3.0 2018-12-20 improved rendering for transparent objects
gems rendering
fixes to responsive layout of viewer and controls/settings containers
iframe API reflector supports addEventListener
diverse bugfixes
------ -------------- ------------------
2.4.0 2019-01-21 export dialog bugfix
CommPlugin error message improvements
viewport resizing fix
rendering bugfixes
------ -------------- ------------------
2.5.0 2019-02-01 anchor object documentation improvements and bugfix
------ -------------- ------------------
2.6.0 2019-03-01 THREE.LineSegments and THREE.LineLoop are supported now in addition to THREE.Line
IE11 support restored
Live transformations API
Fixed crash when loading empty scene
Pass on scroll events in case zooming is disabled
Added further properties to AnchorEventData
Support for settings for multiple viewports
new setting ignoreSuperseded for CommPlugin
fix in constructor SDVApp.ParametricViewer to allow an empty container array to be passed
new camera settings for auto adjusting and revert at mouse up
glb loader now uses browser cache
Settings widget light intensity sliders max value increased to 5
CommPlugin sent export requests instead of export-cache requests
Export modal dialog did not show message to user in case of download export not resulting in a downloadable file
Material defined for SceneAsset takes precedence over materials defined in SceneAssetItems.
------ -------------- ------------------
2.7.0 2019-03-15 bugfix in implementation of scene.updatePersistentAsync: all assets were being updated unnecessarily and faded out/in
bugfix in implementation of File parameter: default value was ignored
new setting scene.material.environmentMapResolution allows to configure image resolution used for environment map
performance improvement: environment map 'default' was always being loaded, even if another one was configured for a model
performance improvement: environment map and material preset images have been optimized for lower size
API documentation updates regarding supported image types
bugfix to drag & drop of transparent objects
bugfix to draggable objects restricted to a plane: the plane origin was being updated while dragging
bugfix: shadows were always being activated on change of light intensity
------ -------------- ------------------
2.8.0 2019-04-01 - bugfix in SDVReflector: return values containing an Error object did not pass through the iframe barrier,
this has been solved by passing the error message only and recreating an error object using that message
(information about the source location of the error gets lost, but the error message is preserved)
- API documentation: added clarifications about the exact firing criterion for some events
- Performance improvement: lowered resulting build size of the viewer bundle
- new API function scene.toggleGeometry for showing or hiding geometry based on scene paths
- prevent rendering of a single frame with opacity 1 when fading in geometry
------ -------------- ------------------
2.9.0 2019-04-12 - switched to using a forked version of THREE.js
- diverse significant performance optimizations regarding THREE.js
- material presets are loaded from central library on first usage
------ -------------- ------------------
2.10.0 2019-05-02 - new and improved implementation of the controls used for parameters and settings
please note that the following dependencies are not required anymore to be separately loaded for using the controls:
-- Font Awesome (https://viewer.shapediver.com/external/font-awesome.min.css) (not used anymore)
-- JQuery (https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js) (will be loaded on demand)
-- Spectrum color picker (https://viewer.shapediver.com/external/spectrum.js) (will be loaded on demand)
-- Sortable.js (https://viewer.shapediver.com/external/Sortable.js) (internalized)
- support for rendering of gems, see api.scene.GemMaterialV1
- SVG images passed as data URI are now expected to be base64 encoded using the method as described on the following line, which adds support for Unicode characters
- methods for base64 encoding and decoding of DOMStrings are available as api.utils.btoaUTF8 and api.utils.atobUTF8
- controls and settings panel now available in fullscreen mode, add property sdv-fullscreen='true' as shown in section usage
- bugfix: changed default text anchor positioning from 'top'/'left' to 'center'/'center'
- bugfix related to anchor elements and api.scene.convertTo2D for IE11
------ -------------- ------------------
2.10.1 2019-05-06 - garbage collection improvements
- bugfix: avoid unnecessary computation of intersections, dramatically improving framerate in case of anchors
- bugfix: color for lines working again
- iOS problem fix: usage of multiple spotlights was causing shader problems
------ -------------- ------------------
2.11.0 2019-05-25 - Tag3d data type API documentation improvement
- adjustable cube map resolution for gem rendering
- support for multiple viewer instances embedded directly
- API reflector supports multiple viewers embedded using iframe
- support for using viewer headless
- update to latest version of UIkit
- prevent beauty rendering kicking in between several updates in direct succession
- fix to iframe and demo pages: opening head tag was missing
- bugfix: bumpAmplitude and pointSize settings were not working correctly
- bugfix: further performance improvement regarding adding and removing anchors
- bugfix: fullscreen mode did not work in case of iframe embedding
- bugfix: corrected depth sorting for transparent objects
- bugfixes and improvements regarding the newly implemented controls used for parameters and settings
- bugfix: pass through touch events in case rotation is disabled
------ -------------- ------------------
2.12.0 2019-05-29 - A new setting Parameter Validation allows to operate the parameter widget in a mode which asks the user to commit or cancel changes to parameter values before sending a computation request.
- This can be activated using the settings widget, or by setting the viewer constructor parameter commitParameters, see SDVApp.ParametricViewer.
- bugfix: camera setting Top View did not get restored properly in case it was stored as default for a model
- bugfix: the camera default position and target did not get stored in case of the orthographic camera (Top View)
------ -------------- ------------------
2.13.0 2019-06-07 - Release of the ShapeDiver Viewer AR API
- The functionality for applying transformations to viewports and plugins has been extended to support an array of transformations instead of just a single one.
Refer to setTransformation, applyTransformation, getTransformation, and resetTransformation in api.scene
- bugfix: avoid additional render calls while operating in continuous rendering mode
- bugfix in api.scene.resume: activate orbit controls only if they should be according to the settings
- fixed documentation of api.getRuntimeId()
------ -------------- ------------------
2.14.0 2019-07-19 - new light API allows to define light scenes, and adds new light types
- CAUTION: changes to the light API are breaking
- controls for lights allow to configure lights from the settings panel
- added support for loading glTF 2.0 files, see SceneAssetItemFormat GLTF
- new property format for scene assets, making it easier to filter scene assets by the format of their content
- extension of the material format MaterialV2 and MaterialV3 by a line material, allowing to configure dashed lines
- CAUTION: the dashed line material is currently not supported for indexed line or line segment geometry
- CAUTION: dashed lines do not work in all browsers, e.g. IE11
- removal of unnecessary property runtimeId from ANCHOR_ADD and ANCHOR_REMOVE events (property scenePath can be used instead to uniquely identify anchors)
- bugfix: shadows were not updated properly during live transformations
- bugfix: live transformations were stopped on hover off
- bugfix: live transformations were failing in case of assets with empty content
- bugfix: the database of preset materials contained a wrongly configured materials
- bugfix: long parameter names were causing the parameter widget to become too wide
- bugfix: setTransformation and applyTransformation did not adjust the scene (shadow camera, lights, etc)
- improved documentation of properties of anchor events (coordinate properties containerX, containerY, clientX, clientY, pageX, pageY)

Version

  • Version: 2.14.0
  • Build date: 2019-09-13T08:31:20.513Z
  • Branch: 2.14.0
  • Commit: 79c3d554e30c32f94506ca499f6a127b76fab060

ShapeDiver 3D Viewer, Copyright © 2015-2019 ShapeDiver GmbH. Documentation generated by JSDoc 3.5.5 on Fri Sep 13th 2019 using the DocStrap template.