Welcome to ig.Viewer
Display OpenConfiguration scenes in the Web and AR. Also supported: glTF and IGXC.
Quick Start
<!-- Import the component --> <script src="https://viewer.intelligentgraphics.ag/main.js"></script> <!-- Define an environment --> <div style="position:relative; width:500px; height:500px; border: 1px solid red;"> <!-- Use it like any other HTML element --> <ig-viewer src="https://raw.githubusercontent.com/intelligentgraphics/OpenConfiguration/master/examples/bed/scene.json"></ig-viewer> </div>
Attributes
floor
Defines the type of floor under the scene. 0: None 1: Mirror 2: Mirror depth 3: Mirror blur (default) 4: Mirror ? 12: Parquett mirror 13: Parquett mirror depth 14: Parquett mirror blur
lightSetup
Defines the setup of lights in the scene. URL to JSON (default)
src
The scene or model that will be shown. URL to glTF (example | file) URL to IGXC (example | file) URL to OC (example | file)
ar
The scene or model that will be shown in Android AR. If src is a glTF then defaults to src. URL to glTF (example | file)
useExtSettings
Defines if external settings should be used. Further explained below. default false
animation
Shows animation controls on the bottom of the viewer, when the scene or model has embedded animations. default true
dd
Support dragging and dropping of OC Zip, glTF and glb files. default false
External Settings
Settings can also be passed via global object window.GLOBAL_PARAMS or as URL query string.
They will be joined with following priority:
Query string < Global params < Attributes
All attributes can be passed plus the following.
lang
Defines the language, defaults to locale from navigator or "de-DE" (inactive for now)
Methods
The model viewer element exposes methods to manipulate the scene.
Demo
setSceneFromOC
This method overwrites the content of the viewer with the content of the provided OpenConfiguration scene object.
const viewer = document.querySelector("ig-viewer"); const setDonePromise = viewer.setSceneFromOC(ocScene);
updateSceneFromOC
This method updates the content of the viewer with the provided OpenConfiguration scene.
Products that already exist in the viewer will be updated and new products will be added.
The identity of the products is determined through the comId attribute within the product's state in the oc.
const viewer = document.querySelector("ig-viewer"); const updateDonePromise = viewer.updateSceneFromOC(ocScene);
highlightProduct
This method highlights the product with the specified comId.
const viewer = document.querySelector("ig-viewer"); viewer.highlightProduct("comId");
removeProduct
This method removes the product with the specified comId from the viewer.
const viewer = document.querySelector("ig-viewer"); const removeDonePromise = viewer.removeProduct("comId");
Events
sceneUpdateStart
Subscribe to events that signal the start of an update to the 3d scene.
const viewer = document.querySelector("ig-viewer"); viewer.addEventListener("sceneUpdateStart", () => {console.log("update started")})
sceneUpdateEnd
Subscribe to events that signal the end of an update to the 3d scene.
const viewer = document.querySelector("ig-viewer"); viewer.addEventListener("sceneUpdateEnd", () => {console.log("update ended")})
sceneClick
Subscribe to events that signal a click in the 3d scene. These events are emitted regardless of wether the user clicks on a object or the empty space. The event of type `SceneClickEvent` contains a `comId` field that either contains the commercial id of the clicked object or undefined.
const viewer = document.querySelector("ig-viewer"); viewer.addEventListener("sceneClick", (event) => {console.log(event.comId)})
History
Build 2025-09-01
- Update to threejs 158
- Emit event for scene clicks
Build 2024-05-16
- Add methods to manipulate the scene on the web component class
Build 2022-10-25
- Update libraries
Build 2022-10-05
- Update libraries
Build 2022-05-09
- Support multi animation deformation in OC
Build 2022-04-28
- Added toggle button for f30 front visibility
Build 2022-04-05
- Workaround Safari 15.4 bug #237906
Build 2022-03-04
- Add responsive Icon bar
Build 2022-02-14
- Fix GLB deformation
Build 2022-01-28
- Standalone usage of .js
- Drag and drop message
- Model size (file size) warning
- Embedded light map
Build 2022-01-21
- Drag and drop of OC Zips
- PBR materials
- Fake lights based on emission
- Animation control