# Portalgraph App Creation Tutorial

This page is intended for developers and explains how to create the simplest possible Portalgraph app. It covers how to use your PC's built-in camera or an external USB webcam and view the result with anaglyph (red-blue) 3D glasses.

Portalgraph is capable of displaying content using a single binary regardless of the combination of hardware used — whether that is a 3D projector, 3D television, or standard monitor with red-blue glasses, and whether tracking is done via camera or VIVE Tracker. This tutorial covers the standard monitor + red-blue glasses + camera tracking setup, but apps you create will also work in other configurations.

### Requirements

* A PC with a webcam capable of running Unity (with a GPU, or an Intel Core series CPU from within the past five years or equivalent)
* Portalgraph runtime installed: <https://portalgraph.itch.io/portalgraph-runtime>
* Portalgraph Personal <https://portalgraph.itch.io/portalgraph-personal>
* Unity 6 or later
* Red-blue 3D glasses

## Asset Usage

#### Creating a Project

If you have not already done so, create a new project from Unity Hub. Select **Universal 3D** as the template (Built-in and HDRP are also supported).

<figure><img src="https://1057988615-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR4jDeJrvuIogaygztZi7%2Fuploads%2Fwv1o54qKd33MjeIoiNNY%2Fimage%20(3).png?alt=media&#x26;token=886f09b3-45f9-4375-9028-f81e5ec34485" alt=""><figcaption></figcaption></figure>

## **Importing Assets**

### Importing Portalgraph asset

From the menu, go to **Assets → Import Package → Custom Package**, select **portalgraph.unitypackage**, and import the assets into the project.

### Setting TextMesh Pro

Import the Essential Resources for TextMesh Pro. From the menu, go to **Window → TextMeshPro → Import TMP Essential Resources** and click to import.

<figure><img src="https://1057988615-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR4jDeJrvuIogaygztZi7%2Fuploads%2FzXD0f5QNa4jQvSNiU8z2%2Fimage%20(2).avif?alt=media&#x26;token=0fa8dbf2-b8dd-423a-8c59-1b339377739b" alt=""><figcaption></figcaption></figure>

## Creating the Scene

Create a scene in Unity and place the Portalgraph prefab from the Project window at coordinates **(0, 0, 0)**. Place **Assets/Portalgraph/PortalgraphURP\_2023-6** into the scene. The coordinates of **Portalgraph/ScreenCenter** will serve as the center point of the display screen.

<figure><img src="https://1057988615-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR4jDeJrvuIogaygztZi7%2Fuploads%2FfNOJEQeTZvmedrK9Fx8F%2Fimage%20(4).png?alt=media&#x26;token=56b86c28-2ef6-4d15-a772-fd844a1d0444" alt=""><figcaption></figcaption></figure>

**※ The prefab to use varies depending on your Unity version and rendering pipeline:**

* **Built-in:** Portalgraph
* **URP with Unity 2022 or earlier:** PortalgraphURP\_2020-22
* **URP with Unity 2023 or 6+:** PortalgraphURP\_2023-6
* **HDRP:** PortalgraphHDRP

<figure><img src="https://1057988615-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR4jDeJrvuIogaygztZi7%2Fuploads%2FeIryG41g4t1rQzVw8zVA%2Fimage%20(3).avif?alt=media&#x26;token=0675e0a6-5446-4442-a513-1fb547cb8a2a" alt=""><figcaption></figcaption></figure>

Also, delete the Main Camera that was originally in the scene, as it is no longer needed.

<figure><img src="https://1057988615-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR4jDeJrvuIogaygztZi7%2Fuploads%2FbUxGSB0Zr7ffrZg6M39k%2Fimage%20(5).png?alt=media&#x26;token=38f5c612-3a28-427a-86b0-a684a2a67c69" alt=""><figcaption></figcaption></figure>

Place a Cube at coordinates **(0, 0, 0)** with a size of **(0.1, 0.1, 0.1)**. ※ In Portalgraph, objects appear in the real world at the size you specify in Unity. Since displayed objects must be smaller than your PC screen, set the size to **(0.1, 0.1, 0.1)**.

<figure><img src="https://1057988615-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR4jDeJrvuIogaygztZi7%2Fuploads%2F15lxcKlfrP5rDSqBou5V%2Fimage%20(4).avif?alt=media&#x26;token=4554d71d-ae15-4bfe-8dc8-817cce4cd01c" alt=""><figcaption></figcaption></figure>

### **Building**

Click **File → Build Settings** from the menu.

<figure><img src="https://1057988615-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR4jDeJrvuIogaygztZi7%2Fuploads%2F4mn6EgkUMo6lHKkgEU5Z%2Fimage%20(6).png?alt=media&#x26;token=51143349-8153-4d13-af71-627c9a64e734" alt=""><figcaption></figcaption></figure>

In the **Scene List** tab, click **Add Open Scenes** to add the current scene to **Scenes in Build**, then go to the **Windows** tab and click **Build**.

<figure><img src="https://1057988615-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR4jDeJrvuIogaygztZi7%2Fuploads%2FblstLPpgayCMiFU9jevI%2Fimage%20(7).png?alt=media&#x26;token=a985345d-75ff-4357-bd94-dfa49f7b3e66" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1057988615-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR4jDeJrvuIogaygztZi7%2Fuploads%2FNDzTVTet7ZlTNFyj4Agy%2Fimage%20(8).png?alt=media&#x26;token=21a02d63-df29-4501-b3fa-8cefbf2f9997" alt=""><figcaption></figcaption></figure>

Click 'Add Open Scenes' to add the current scene to 'Scenes in Build', and then click 'Build' to build.

<figure><img src="https://content.gitbook.com/content/R4jDeJrvuIogaygztZi7/blobs/ZZutha4sHd76taoQxJV1/image.png" alt=""><figcaption><p>Click 'Add Open Scenes' to add the current scene to 'Scenes in Build', and then click 'Build'.</p></figcaption></figure>

## Running

Running a Portalgraph application requires the Portalgraph runtime to be installed. After installing the runtime, run the output executable and the camera tracking app will launch automatically.

<figure><img src="https://1057988615-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR4jDeJrvuIogaygztZi7%2Fuploads%2FA1nDXLosPt4BWl9WlCsx%2FcameraEn.png?alt=media&#x26;token=9d7d8056-a3c7-4143-b84f-eecf1e202a95" alt=""><figcaption></figcaption></figure>

Select the webcam to use from the camera dropdown and click **"Apply"** to begin tracking your face position. Click **"Calibrate"** to start a countdown — position yourself so that your eyes are 50 cm directly in front of the camera and wait for the values to be set automatically.

<figure><img src="https://1057988615-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR4jDeJrvuIogaygztZi7%2Fuploads%2FqCY3PFx4uBpvcvIy5lsh%2Fspaces_aJCTlOkQcgkhVMLcuHBm_uploads_CB72gJJtC3gZNAc2iyek_image.webp?alt=media&#x26;token=7b0386ee-7b7e-489b-8166-fe6392c8fb07" alt=""><figcaption></figcaption></figure>

Return to the screen of the app you created. If this is your first time running Portalgraph, a screen size input dialog will appear automatically. (If it does not appear, press F12 and click **"Next" → "Camera"**.) Enter the values, press **OK**, and close the next settings screen.

<figure><img src="https://1057988615-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR4jDeJrvuIogaygztZi7%2Fuploads%2FQfCTc4qX6BC9Bjgl4KJ5%2FScreenshot%202024-11-09%20160131.png?alt=media&#x26;token=7df38b0b-2cea-4c75-a62a-e0287fd5bc0c" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1057988615-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FR4jDeJrvuIogaygztZi7%2Fuploads%2FxKdmsVj6QWus33PPFfQk%2Fimage%20(10).png?alt=media&#x26;token=9e084754-c294-4e96-9d31-a5713f5fc778" alt=""><figcaption></figcaption></figure>

You now have a Portalgraph application that can be viewed in 3D from any angle. Put on your anaglyph (red-blue) 3D glasses and enjoy the experience.

**Controls:**

* **W A S D R F** — Move forward/back/left/right/up/down (hold Shift for slow movement)
* **Q E T G Z C** — Rotate left/right, up/down, and tilt (hold Ctrl to rotate in 90° increments)
* **1 2** — Change scale (hold Shift to slow down)
* **3** — Reset scale

Adjust the camera position, angle, and scale to suit the size and orientation of your screen.

***

**Troubleshooting**

**If the camera tracking app does not work**, install the latest VC++ Runtime: <https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170>

**If nothing is displayed:** Is the Cube placed in the scene set to a size of **(0.1, 0.1, 0.1)**? Portalgraph displays objects at their actual size, so anything larger than the screen cannot be displayed. Try pressing the **1** key to reduce the scale.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://portalgraphvr.gitbook.io/portalgraph-document-en/quick-start-developper/portalgraph-app-creation-tutorial.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
