Skip to content

Embedding in Your Website

Use <rv-embed> to place a prepared GLB twin inside your page. The lightweight viewer renders the model and runs its supported simulation in the visitor’s browser. Your page controls the surrounding text and link to the full application.

Build the Community library with npm run build:embed and serve the complete dist-embed/ directory at /embed/. Add your model and poster, then include:

<script type="module" src="/embed/rv-embed.js"></script>
<rv-embed
src="/models/machine.glb"
poster="/images/machine.webp"
look="studio"
interactive="drag"
hide="#frame-node-id,#table-node-id"
background="transparent"
aria-label="Interactive machine model"
style="width: 100%; height: 420px">
</rv-embed>

Replace the paths with your files. Replace hide with authored NodeIds from your model, or remove it. Give the element a height so its canvas has room to render.

AttributeValues and behavior
srcGLB URL; changing it loads a new model
posterImage shown until the rendered model is ready
lookstudio adds room reflections, soft shadows and a shadow ground; omit for default lighting
interactiveorbit-on-click (default), none, full, or drag
hideComma-separated authored NodeIds such as #frame-id,#table-id
backgroundCSS color; default #1a1d21; transparent blends into your page
runwhen-visible (default) or manual; automatic loading waits for visibility and respects reduced motion
dpr-capPositive pixel-ratio cap; default 1.5
directorName of a director script authored in the model

none disables navigation, full enables it immediately, and orbit-on-click waits for a click or tap. hide uses IDs stored in the GLB, rather than names or paths. It hides parts before model preparation while preserving their hierarchy. Missing IDs produce a browser console warning.

To run a model’s virtual PLC programs and mechanism motion inside the embed, use rv-embed-pro: see Live PLC and mechanisms in embeds.

For a prominent hero, put a normal poster image in the initial HTML with explicit dimensions, eager loading and fetchpriority="high". Let that image be the Largest Contentful Paint (LCP) while the live view starts later. Keep the live view in the same fixed-size box to avoid layout shifts.

Load the live module after the page’s load event and an idle opportunity. On mobile devices, with Save-Data enabled or reduced motion requested, keep only the poster and a link to the full application. Implement these rules in your website: the embed handles visibility and reduced motion, but does not itself provide mobile or Save-Data poster-only gating.

For SEO, treat Googlebot as unable to render the WebGL scene as indexable page content. Put machine descriptions, benefits and links in ordinary HTML; the poster and canvas enhance that text.

Link to the same published document in the full viewer. Replace the example document ID with one in your deployment:

<a href="https://web.realvirtual.io/demo/?doc=YOUR_DOCUMENT_ID&amp;mode=commissioning&amp;entry=usecase#cam=4,3,4,0,0,0"
target="_blank" rel="noopener">Open full application</a>

#cam=px,py,pz,tx,ty,tz passes the camera position and target in scene coordinates. The full viewer applies the six finite numbers after its scene and start view are ready. Invalid values are ignored.

To pass the current view, retain the underlying viewer from the rv-ready event’s detail.viewer, then update the link when it opens:

const values = [
...viewer.controls.object.position.toArray(),
...viewer.controls.target.toArray(),
];
link.hash = `cam=${values.join(',')}`;

This opens the same model and camera view; it does not transfer simulation state.

Upload the complete build directory with its layout intact, including chunks, Draco decoders, WASM assets and third-party notices. Copying just the entry JavaScript file breaks dependency loading. Serve it over HTTP(S).

Serve JavaScript with a JavaScript MIME type and WASM as application/wasm. For modules, models or dependencies on another host, configure CORS there to allow your website’s origin. Check final URLs in the browser network panel. Your model’s referenced assets must also be reachable. Community licence obligations still apply when you self-host.

Host the embed build on the same origin as your page where you can. Browsers do not start web workers from another origin; the embed then prepares models on the main thread, which works but takes longer for large models.