Skip to content

Commit 307f85d

Browse files
evanmcarlsonEvan Carlson
andauthored
Update studio image target guide (#22)
* Update studio image target guide * Update image target guide * Update image target guide --------- Co-authored-by: Evan Carlson <evan@Evans-MacBook-Pro.local>
1 parent 3fc17b0 commit 307f85d

12 files changed

Lines changed: 92 additions & 50 deletions

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

Lines changed: 92 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ description: Image Targets allow you to set a flat, cylindrical or conical shape
55

66
# Image Targets
77

8+
:::tip
9+
Use the [image target example project](https://github.com/8thwall/studio-image-targets-example) as a reference to get started and confirm your project structure is set up correctly.
10+
:::
11+
812
## Introduction
913
{frontMatter.description}
1014
<br></br>
1115
<br></br>
1216

13-
![](/images/studio/image-target-intro.gif)
14-
15-
---
16-
1717
## Enabling Image Targets
1818

1919
To enable image targets in your project, you must use a World camera.
@@ -25,80 +25,122 @@ To enable image targets in your project, you must use a World camera.
2525
<img src={require('/images/studio/image-target-enable.png').default} width="400px"/>
2626
````
2727

28-
---
28+
If you do not plan to use World Tracking in your project, you can use the **Disable World Tracking** setting to improve performance.
2929

30-
## Adding Image Targets
30+
## Generating Image Target Files {#generating-image-target-files}
3131

32-
### Upload the Image Target
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.
3333

34-
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.
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+
:::
3537

36-
````mdx-code-block
37-
<img src={require('/images/studio/image-target-upload.png').default} width="400px"/>
38-
````
38+
1. Open a terminal window and run `npx @8thwall/image-target-cli@latest`
39+
2. Answer the prompts, following the examples below:
3940

40-
### Configuring the Image Target
41+
```bash
42+
Enter the path to the image file:
4143

42-
Customize the image target's tracking region and metadata.
44+
~/Downloads/target1.png
45+
```
4346

44-
````mdx-code-block
45-
<img src={require('/images/studio/image-target-config.png').default} width="400px"/>
46-
````
47+
```bash
48+
Select the image type:
49+
1) flat (default)
50+
2) cylinder
51+
3) cone
4752

48-
### Testing the Image Target
53+
1
54+
```
4955

50-
Scan the QR code to test the quality and tracking of your uploaded image target.
56+
```bash
57+
Use default crop? [Y/n]:
5158

52-
````mdx-code-block
53-
<img src={require('/images/studio/image-target-test.png').default} width="400px"/>
54-
````
59+
y
60+
```
5561

56-
### Adding the Image Target Entity
62+
```bash
63+
Enter the output folder:
5764

58-
You can add an image target to your scene by creating an **Image Target** entity.
59-
To do this, click **( + )** in the Scene Hierarchy and select **Image Target**.
65+
~/Documents/8th Wall/my-project/image-targets
66+
```
6067

61-
````mdx-code-block
62-
<img src={require('/images/studio/image-target-add.png').default} width="400px"/>
63-
````
68+
```bash
69+
Enter a name for the image target:
70+
71+
target1
72+
```
73+
74+
On generation, the following will be outputted to the specified folder:
75+
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)
82+
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+
:::
6486

65-
### Linking the Image Target
87+
## Configuring Image Targets
6688

67-
Link the image target entity to an uploaded image target.
89+
Create a file named `app.js` in the `src` folder (if you don't have one already). At the top of the file, configure image targets by providing paths to each image target's metadata JSON file.
6890

91+
```javascript
92+
const onxrloaded = () => {
93+
XR8.XrController.configure({
94+
imageTargetData: [
95+
require('../image-targets/target1.json'),
96+
require('../image-targets/target2.json')
97+
],
98+
})
99+
}
100+
window.XR8 ? onxrloaded() : window.addEventListener('xrloaded', onxrloaded)
101+
```
102+
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
69106

70107
````mdx-code-block
71-
<img src={require('/images/studio/image-target-link.png').default} width="400px"/>
108+
<img src={require('/images/studio/guides/image-targets/open-externally.png').default} width="400px"/>
72109
````
73110

74-
---
111+
2. Verify the `image-targets` folder is at the **root** of the project, and that `app.js` is within the `src` folder
75112

76-
## Using Image Targets
113+
````mdx-code-block
114+
<img src={require('/images/studio/guides/image-targets/project-structure.png').default} width="400px"/>
115+
````
77116

78-
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.
117+
## Adding the Image Target Entity
79118

80-
---
119+
To add an image target to your scene:
120+
1. Click **( + )** in the Scene Hierarchy and select **Image Target**.
121+
122+
````mdx-code-block
123+
<img src={require('/images/studio/guides/image-targets/add-image-target.png').default} width="400px"/>
124+
````
81125

82-
## Simulating Image Targets
126+
2. Select the image target entity from the scene hierarchy and enter the name of the image target in the inspector.
83127

84-
Studio’s **Simulator** allows you to test your image target experience remotely by simulating movement using **WASD** controls.
128+
````mdx-code-block
129+
<img src={require('/images/studio/guides/image-targets/image-target-name.png').default} width="400px"/>
130+
````
85131

86-
### Using the Simulator with Image Targets
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.
87133

88-
To simulate movement and content placement around an image target added to your scene:
134+
## Using Image Targets
89135

90-
1. Make sure your **Camera Settings** are set to **World**
91-
2. Press **Play** to open the Simulator
92-
3. Use the **Simulator environment options** (bottom left selector) to find your desired Image Target
93-
4. Use the **WASD keyboard shortcuts** to simulate movement. *(You must first click on the Simulator panel before using the keyboard)*
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.
94137

95-
**Movement Keys:**
138+
````mdx-code-block
139+
<img src={require('/images/studio/guides/image-targets/image-target-mesh.png').default} width="400px"/>
140+
````
96141

97-
- `W` = Forward
98-
- `A` = Left
99-
- `S` = Backward
100-
- `D` = Right
101-
- `Q` = Up
102-
- `E` = Down
142+
Ensure any entities you want to track to the image target are **children** of the image target entity.
103143

104-
Moving around the image target with WASD will trigger the **Image Found** event to simulate successful image target tracking.
144+
````mdx-code-block
145+
<img src={require('/images/studio/guides/image-targets/image-target-children.png').default} width="400px"/>
146+
````
118 KB
Loading
32.1 KB
Loading
285 KB
Loading
21.7 KB
Loading
19.5 KB
Loading
66.5 KB
Loading
-157 KB
Binary file not shown.
-885 KB
Binary file not shown.
-3.02 MB
Binary file not shown.

0 commit comments

Comments
 (0)