Skip to content

Commit 8cf4d38

Browse files
authored
Update image target docs (#27)
* Update image target docs * Update image target docs * Update image target docs * Update image target docs * Update image target docs
1 parent 59fe0f1 commit 8cf4d38

25 files changed

Lines changed: 105 additions & 299 deletions

docs/api/engine/xrcontroller/configure.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,22 @@ Parameter | Type | Default | Description
1616
disableWorldTracking [Optional] | `Boolean` | `false` | If true, turn off SLAM tracking for efficiency. This needs to be done **BEFORE** [`XR8.run()`](/docs/api/engine/xr8/run) is called.
1717
enableLighting [Optional] | `Boolean` | `false` | If true, `lighting` will be provided by [`XR8.XrController.pipelineModule()`](pipelinemodule.md) as `processCpuResult.reality.lighting`
1818
enableWorldPoints [Optional] | `Boolean` | `false` | If true, `worldPoints` will be provided by [`XR8.XrController.pipelineModule()`](pipelinemodule.md) as `processCpuResult.reality.worldPoints`.
19-
imageTargets [Optional] | `Array` | | List of names of the image target to detect. Can be modified at runtime. Note: All currently active image targets will be replaced with the ones specified in this list.
19+
imageTargetData [Optional] | `Array` | | List of image targets to track, see [image target data](#image-target-data). Note: All currently active image targets will be replaced with the ones specified in this list.
2020
leftHandedAxes [Optional] | `Boolean` | `false` | If true, use left-handed coordinates.
2121
mirroredDisplay [Optional] | `Boolean` | `false` | If true, flip left and right in the output.
2222
scale [Optional] | `String` | `responsive` | Either `responsive` or `absolute`. `responsive` will return values so that the camera on frame 1 is at the origin defined via [`XR8.XrController.updateCameraProjectionMatrix()`](updatecameraprojectionmatrix.md). `absolute` will return the camera, image targets, etc in meters. When using `absolute` the x-position, z-position, and rotation of the starting pose will respect the parameters set in [`XR8.XrController.updateCameraProjectionMatrix()`](updatecameraprojectionmatrix.md) once scale has been estimated. The y-position will depend on the camera's physical height from the ground plane.
2323

2424
**IMPORTANT:** `disableWorldTracking: true` needs to be set **BEFORE** both [`XR8.XrController.pipelineModule()`](pipelinemodule.md) and [`XR8.run()`](/docs/api/engine/xr8/run) are called and cannot be modifed while the engine is running.
2525

26+
### Image Target Data {#image-target-data}
27+
28+
Property | Type | Description
29+
--------- | ---- | -----------
30+
imagePath | `String` | The path or URL to fetch the tracked image from. For best results, use a portrait, 480x640, grayscale image.
31+
type | `String` | 'PLANAR', 'CYLINDER', or 'CONICAL'
32+
properties | `Object` | Properties of the crop and geometry of the target. This should be generated by image-target-cli or the desktop app.
33+
metadata [Optional] | any | This property can be used to attach any additional data for use by the application.
34+
2635
## Returns {#returns}
2736

2837
None
@@ -45,5 +54,9 @@ XR8.run({canvas: document.getElementById('camerafeed')})
4554
## Example - Change active image target set {#example---change-active-image-target-set}
4655

4756
```javascript
48-
XR8.XrController.configure({imageTargets: ['image-target1', 'image-target2', 'image-target3']})
57+
XR8.XrController.configure({
58+
imageTargetData: [
59+
require('../image-targets/my-target.json'),
60+
],
61+
})
4962
```

docs/engine/guides/image-targets.md

Lines changed: 68 additions & 228 deletions
Large diffs are not rendered by default.

docs/studio/guides/xr/image-targets.mdx

Lines changed: 22 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Use the [image target example project](https://github.com/8thwall/studio-image-t
1414
<br></br>
1515
<br></br>
1616

17+
![](/images/studio/image-target-intro.gif)
18+
1719
## Enabling Image Targets
1820

1921
To enable image targets in your project, you must use a World camera.
@@ -27,62 +29,24 @@ To enable image targets in your project, you must use a World camera.
2729

2830
If you do not plan to use World Tracking in your project, you can use the **Disable World Tracking** setting to improve performance.
2931

30-
## Generating Image Target Files {#generating-image-target-files}
31-
32-
To use image targets in your project, you must generate some required assets with a command line interface (CLI). These files contain image target metadata needed by the engine.
33-
34-
:::tip
35-
See [documentation on Image Target CLI](https://github.com/8thwall/8thwall/blob/main/apps/image-target-cli/README.md) for more details on cropping and cylindrical/conical image targets.
36-
:::
37-
38-
1. Open a terminal window and run `npx @8thwall/image-target-cli@latest`
39-
2. Answer the prompts, following the examples below:
40-
41-
```bash
42-
Enter the path to the image file:
43-
44-
~/Downloads/target1.png
45-
```
46-
47-
```bash
48-
Select the image type:
49-
1) flat (default)
50-
2) cylinder
51-
3) cone
52-
53-
1
54-
```
32+
## Adding Image Targets
5533

56-
```bash
57-
Use default crop? [Y/n]:
58-
59-
y
60-
```
34+
### Upload the Image Target
6135

62-
```bash
63-
Enter the output folder:
36+
Locate the **Image Targets** panel at the bottom left of the Studio Interface. Click on the **( + )** to add a flat, cylindrical, or conical image target.
6437

65-
~/Documents/8th Wall/my-project/image-targets
66-
```
67-
68-
```bash
69-
Enter a name for the image target:
38+
````mdx-code-block
39+
<img src={require('/images/studio/image-target-upload.png').default} width="400px"/>
40+
````
7041

71-
target1
72-
```
42+
### Configuring the Image Target
7343

74-
On generation, the following will be outputted to the specified folder:
44+
Customize the image target's tracking region and metadata.
7545

76-
* Metadata within a JSON file
77-
* Original image
78-
* Cropped image
79-
* Thumbnail image (263x350)
80-
* Luminance image (grayscale, 480x640)
81-
* Geometry image (for conical)
46+
````mdx-code-block
47+
<img src={require('/images/studio/image-target-config.png').default} width="400px"/>
48+
````
8249

83-
:::note[Important]
84-
Make sure the output folder was specified as a folder named `image-targets` at the root of your 8th Wall project. See [Verifying Project Structure](#verifying-project-structure) for more details.
85-
:::
8650

8751
## Configuring Image Targets
8852

@@ -100,40 +64,25 @@ const onxrloaded = () => {
10064
window.XR8 ? onxrloaded() : window.addEventListener('xrloaded', onxrloaded)
10165
```
10266

103-
## Verifying Project Structure {#verifying-project-structure}
104-
105-
1. Click the **Open Externally** button in the assets panel to open project code in your IDE
106-
107-
````mdx-code-block
108-
<img src={require('/images/studio/guides/image-targets/open-externally.png').default} width="400px"/>
109-
````
110-
111-
2. Verify the `image-targets` folder is at the **root** of the project, and that `app.js` is within the `src` folder
112-
113-
````mdx-code-block
114-
<img src={require('/images/studio/guides/image-targets/project-structure.png').default} width="400px"/>
115-
````
116-
11767
## Adding the Image Target Entity
11868

11969
To add an image target to your scene:
70+
12071
1. Click **( + )** in the Scene Hierarchy and select **Image Target**.
12172

12273
````mdx-code-block
12374
<img src={require('/images/studio/guides/image-targets/add-image-target.png').default} width="400px"/>
12475
````
12576

126-
2. Select the image target entity from the scene hierarchy and enter the name of the image target in the inspector.
77+
2. In the "Image Target" dropdown, select the image target resource you'd like to track.
12778

12879
````mdx-code-block
129-
<img src={require('/images/studio/guides/image-targets/image-target-name.png').default} width="400px"/>
80+
<img src={require('/images/studio/image-target-link.png').default} width="400px"/>
13081
````
13182

132-
The name of the image target entered in the inspector should match what was entered in the CLI when generating the image target files. You can double check the name of the image target by looking at the prefix of the image target assets and/or in the JSON file associated with the image target.
133-
13483
## Using Image Targets
13584

136-
When you add an image target to your project, an image target mesh will appear so that you can align and position other 3D content against the image target.
85+
When you add an image target to your project, an image target mesh will appear so that you can align and position other 3D content against the image target.
13786

13887
````mdx-code-block
13988
<img src={require('/images/studio/guides/image-targets/image-target-mesh.png').default} width="400px"/>
@@ -143,4 +92,8 @@ Ensure any entities you want to track to the image target are **children** of th
14392

14493
````mdx-code-block
14594
<img src={require('/images/studio/guides/image-targets/image-target-children.png').default} width="400px"/>
146-
````
95+
````
96+
97+
## Optimizing Tracking
98+
99+
Please reference [this guide](/docs/engine/guides/image-targets#optimizing-image-target-tracking) for details on how to improve tracking accuracy.
-16.8 KB
Binary file not shown.

static/images/conical.jpg

-4.82 KB
Binary file not shown.

static/images/cylindrical.jpg

-4.77 KB
Binary file not shown.
-949 KB
Binary file not shown.
-937 KB
Binary file not shown.
-846 KB
Binary file not shown.
-833 KB
Binary file not shown.

0 commit comments

Comments
 (0)