Skip to content

Commit c8ff94a

Browse files
authored
Update engine installation and migration instructions (#35)
* Update engine installation and migration instructions * Update engine installation and migration instructions
1 parent 1aec8b7 commit c8ff94a

2 files changed

Lines changed: 72 additions & 21 deletions

File tree

docs/engine/overview.md

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,65 @@ sidebar_position: 1
99
If this is your first time working with 8th Wall, we strongly recommend starting with or referencing an [example project](https://github.com/8thwall/8thwall/tree/main/examples).
1010
:::
1111

12-
## Integration
12+
## Loading the Engine
1313

14-
### Loading the Engine
14+
### Option 1: Script tag
15+
16+
```html
17+
<script src="https://cdn.jsdelivr.net/npm/@8thwall/engine-binary@1/dist/xr.js" async crossorigin="anonymous" data-preload-chunks="slam"></script>
18+
```
19+
20+
### Option 2: npm
21+
22+
```bash
23+
npm install @8thwall/engine-binary
24+
```
25+
26+
You will need to copy the included artifacts into your dist folder, for example in webpack:
27+
28+
```js
29+
new CopyWebpackPlugin({
30+
patterns: [
31+
{
32+
from: 'node_modules/@8thwall/engine-binary/dist',
33+
to: 'external/xr',
34+
}
35+
]
36+
})
37+
```
38+
39+
You can then load the SDK by adding the following to index.html:
40+
41+
```html
42+
<script src="./external/xr/xr.js" async data-preload-chunks="slam"></script>
43+
```
44+
45+
When importing the package, you will get a simple helper for accessing XR8 once it is loaded. This promise will only resolve if the script tag is included in the HTML.
46+
47+
```js
48+
import {XR8Promise} from '@8thwall/engine-binary'
49+
50+
XR8Promise.then((XR8) => XR8.XrController.configure({}))
51+
```
52+
53+
### Option 3: Full Download
1554

1655
1. Download the [8th Wall Engine Binary](https://8th.io/xrjs) and unzip it into your project folder
17-
2. Add the 8th Wall Engine as a script tag to the `<head>` of your `index.html`. Add the `data-preload-chunks` attribute to the script tag, and depending on the type of experience you want to develop, set the `data-preload-chunks` to the appropriate value:
18-
* **World Tracking & Image Targets**: `data-preload-chunks="slam"`
19-
* **Face Effects**: `data-preload-chunks="face"`
20-
* **Sky Effects**: no `data-preload-chunks` required
56+
2. Add the 8th Wall Engine as a script tag to the `<head>` of your `index.html`.
57+
2158
```html
2259
<script async src="./path/to/xr.js" data-preload-chunks="slam"></script>
2360
```
2461

62+
## Preload Chunks {#preload}
63+
64+
The engine consists of two optional chunks, `slam`, and `face`. Depending on the type of experience you want to develop, you can add the `data-preload-chunks` attribute to the script tag:
65+
66+
* **World Tracking & Image Targets**: `data-preload-chunks="slam"`
67+
* **Face Effects**: `data-preload-chunks="face"`
68+
* **Sky Effects**: no `data-preload-chunks` required
69+
70+
2571
:::note
2672
`data-preload-chunks="face, slam"` is also supported for experiences using both world and face effects.
2773
:::
@@ -31,7 +77,7 @@ Alternatively, you can call `await XR8.loadChunk()` **before starting the engine
3177
await XR8.loadChunk('slam')
3278
```
3379

34-
### Integrating 8th Wall with A-Frame {#aframe}
80+
## A-Frame {#aframe}
3581

3682
8th Wall can be integrated with your A-Frame project in a few easy steps:
3783

@@ -50,7 +96,7 @@ await XR8.loadChunk('slam')
5096
See documentation on [A-Frame Components](/docs/api/engine/aframe/), [A-Frame Events](/docs/api/engine/aframeevents/) and [A-Frame Event Listeners](/docs/api/engine/aframeeventlisenters/) provided by the 8th Wall Engine.
5197
:::
5298

53-
### Integrating 8th Wall with three.js {#threejs}
99+
## three.js {#threejs}
54100

55101
To integrate the 8th Wall engine into a three.js project, use the [Camera Pipeline Module API](/docs/api/engine/camerapipelinemodule) to add functionality like drawing the camera feed, creating a three.js scene and enabling world tracking. You should also add a custom camera pipeline module which you use to set up the three.js camera and scene content.
56102

docs/migration/self-hosted.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,13 @@ The 8th Wall engine binary does **not support** cloud-dependent features or thos
1414
* Modules / Backends
1515
:::
1616

17-
To update a self-hosted project to use the 8th Wall engine binary:
17+
To update a self-hosted project to use the 8th Wall engine binary, remove the script tag for `apps.8thwall.com/xrweb` and replace it with:
1818

19-
1. Download [xr-standalone.zip](https://8th.io/xrjs) and unzip it into your project folder
20-
2. Remove the script tag for `apps.8thwall.com/xrweb` and replace it with `<script async src="./path/to/xr.js"></script>`
21-
3. Add `data-preload-chunks` to the script tag or call `await XR8.loadChunk()` in your code before starting the engine. See sections below for more details.
22-
23-
:::note
24-
`data-preload-chunks="face, slam"` is also supported for experiences using both world and face effects.
25-
:::
19+
```html
20+
<script src="https://cdn.jsdelivr.net/npm/@8thwall/engine-binary@1/dist/xr.js" async crossorigin="anonymous" data-preload-chunks="slam"></script>
21+
```
2622

23+
Alternative installation options can be found in the [Engine Overview](/docs/engine/overview).
2724

2825
## World Effects
2926

@@ -33,15 +30,20 @@ If you're using world tracking, add `data-preload-chunks="slam"` to the script t
3330

3431
If you're using face tracking, add `data-preload-chunks="face"` to the script tag or call `await XR8.loadChunk('face')` in your code before starting the engine.
3532

33+
:::note
34+
`data-preload-chunks="face, slam"` is also supported for experiences using both world and face effects.
35+
:::
36+
3637
## Image Targets
3738

3839
If you're using image targets, add `data-preload-chunks="slam"` to the script tag or call `await XR8.loadChunk('slam')` in your code before starting the engine.
3940

4041
### Configure Image Targets
4142

42-
Configure the image targets at the start of your experience.
43+
Targets no longer load automatically on startup. Previously auto-loaded targets will have a `"loadAutomatically": true` property in the json file, which may help you locate them, but it doesn't have a functional effect.
4344

44-
To enable image targets, call `XR8.XrController.configure` before any other code:
45+
46+
To enable image targets, call `XR8.XrController.configure` at the start of your experience:
4547

4648
```
4749
const onxrloaded = () => {
@@ -55,6 +57,9 @@ const onxrloaded = () => {
5557
window.XR8 ? onxrloaded() : window.addEventListener('xrloaded', onxrloaded)
5658
```
5759

58-
:::info
59-
Autoloaded targets will have a `"loadAutomatically": true` property in the json file.
60-
:::
60+
## Other cdn.8thwall.com Scripts
61+
62+
While no changes to cdn.8thwall.com are expected until Feb 2027, you may want to switch to the following actively developed packages:
63+
64+
- XRExtras: https://www.npmjs.com/package/@8thwall/xrextras
65+
- Landing Page: https://www.npmjs.com/package/@8thwall/landing-page

0 commit comments

Comments
 (0)