> For the complete documentation index, see [llms.txt](https://stage-precision.gitbook.io/grid/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://stage-precision.gitbook.io/grid/spatial-interactive-experiences/building-an-interactive-tracking-project/generate-depth-images.md).

# Generate Depth Images

For this guide, we will generate a depth image using a **Camera Projection**.

Camera Projection provides a straightforward way to define which part of the three-dimensional point cloud should appear in the resulting image.

{% hint style="info" %}
Image Rendering also supports **Polygon Object Projection** and **Source Point Projection** for workflows based on mesh UVs or a dedicated projection origin.

These projection modes are covered separately in the **Image Rendering** reference.
{% endhint %}

***

## Add a Camera

First, add a Camera Object that will define the view used for the depth image.

1. Right-click an empty area of the **Project Tree**, or click the **+** button.
2. Search for the required **Camera** Object.
3. Add it to the project.

   <div align="left"><figure><img src="/files/B5OqqNPRTg3qZw9lZwu1" alt="" width="274"><figcaption></figcaption></figure></div>
4. Position and orient the Camera in the Viewport so that it covers the required area.

   <figure><img src="/files/UL69xHT7zHUNL0JBq4rb" alt=""><figcaption></figcaption></figure>

The Camera can use either a **perspective** or **orthographic** projection depending on the application.

{% hint style="success" %}
You can switch the **Viewport directly into the Camera view** and navigate from there.

This is often the easiest way to position and frame the Camera, as the Camera follows the Viewport while you navigate. It allows you to set up the projection while looking directly at the image area that will later be used by Image Rendering.
{% endhint %}

<figure><img src="/files/t7AWAFrpoNDbt9ILLFZY" alt=""><figcaption></figcaption></figure>

Its configuration also defines properties used by Image Rendering, including:

* Resolution
* Near clipping
* Far clipping

<figure><img src="/files/79gmte5ehKPrYOX358Y9" alt=""><figcaption></figcaption></figure>

For example, an orthographic top-down Camera can be useful for generating a depth image of people moving across a floor, while a perspective Camera can represent the tracked environment from a specific viewing position.

***

## Add Image Rendering

Image Rendering is added as an Input Filter on the Point Cloud Volume.

To add it:

1. Select the **Point Cloud Volume** in the Project Tree.
2. Open **Pipeline** in the Inspector.
3. Locate **Input Filters**.
4. Click the **+** button.
5. Open **Rendering**.
6. Select **Image Rendering**.

<div align="left"><figure><img src="/files/F7bEEZQtCRQhWRgpkFmf" alt="" width="335"><figcaption></figcaption></figure></div>

Image Rendering operates on the point cloud at its current position in the Input Filter chain.

For most projects, place it **towards the end of the Input Filter list** so that the generated image uses the already cleaned and filtered point cloud.

{% hint style="info" %}
Input Filters are processed from top to bottom.

The position of Image Rendering in the list therefore determines which stage of the point cloud is used to generate the image.
{% endhint %}

***

## Open the Image in a Viewer

Before configuring the projection, open the generated image in a dedicated **Viewer**.

This makes it much easier to see immediately how changes to the Camera and Image Rendering settings affect the result.

To add a Viewer:

1. Open **View** in the main application menu.
2. Select **Viewer**.
3. Dock the new Viewer anywhere in the Grid Studio layout.
4. Right-click the empty Viewer area.
5. Select the Image Provider created by the **Image Rendering** filter.

<figure><img src="/files/EDcn9q0nZBGyuhvbnyYz" alt=""><figcaption></figcaption></figure>

\>

The Viewer now displays the current output of the Image Rendering filter in real time.

{% hint style="success" %}
Keep the **3D Viewport** and the **Image Rendering Viewer** visible at the same time.

This allows you to position the Camera in the 3D environment while immediately seeing the resulting depth image next to it.
{% endhint %}

***

## Configure the Camera Projection

In the **Image Rendering** filter:

1. Set **Projection Mode** to **Camera Projection**.
2. Assign the Camera Object to **Projection Camera**.

<figure><img src="/files/MxPLvt5d4mUhakCFTEls" alt=""><figcaption></figcaption></figure>

The Image Rendering filter now uses the selected Camera to project the three-dimensional point cloud into a two-dimensional image.

Move or adjust the Camera while observing the resulting image until the required physical area is framed correctly.

The Camera defines the projection, resolution, and clipping range, while the Image Rendering filter controls how the point-cloud measurements are drawn into that image.

***

## Fine-Tune the Depth Image

Once the Camera Projection is working, fine-tune the generated image while keeping both the **3D Viewport** and the **Image Rendering Viewer** visible.

The most useful controls for this step are:

* **Camera Near Clipping**
* **Camera Far Clipping**
* **Point Size**
* **Erode / Dilate**
* **Smooth**

Adjust these parameters while watching the resulting image update in real time.

<figure><img src="/files/yGL2OeKLJucK3fBHP4nM" alt=""><figcaption></figcaption></figure>

### Adjust the Depth Range

Use the Camera's **Near Clipping** and **Far Clipping** to define which part of the physical depth range should contribute to the generated image.

This is useful for isolating the relevant interaction space and removing measurements that are too close to or too far away from the Camera.

### Adjust the Point Coverage

Use **Point Size** to control how large individual measurements are rendered into the image.

Increase the value when gaps between points need to be reduced, but avoid making the rendered points unnecessarily large.

Use **Erode / Dilate** to further control how the rendered point regions shrink or expand.

A small amount of **Smooth** can then help reduce hard or irregular edges.

{% hint style="success" %}
Tune the Camera clipping range first, then adjust Point Size, Erode / Dilate, and Smooth.

This keeps the image focused on the correct physical depth range before changing how the individual measurements are visually expanded or softened.
{% endhint %}

The goal is not necessarily to create the smoothest-looking image, but to produce a representation that contains the right spatial information for the receiving system.

***

## Output the Depth Image

The **Image Rendering** filter exposes its result as an **Image Provider**.

To send this image to another system, create a **Media Input** Object and configure its Sender.

### Add a Media Input

1. Right-click an empty area of the **Project Tree**, or click the **+** button.
2. Search for **Media Input**.
3. Add it to the project.

<div align="left"><figure><img src="/files/ezVhGa2Ylr7k6AIbuZBl" alt="" width="297"><figcaption></figcaption></figure></div>

### Configure the Sender

Select the **Media Input** Object and open **Sender** in the Inspector.

1. Enable **Sender Enabled**.
2. Select the required **Device**.
3. Under **Image Provider**, select the provider created by the **Image Rendering** filter.

<div align="left"><figure><img src="/files/BfQXxoL2DnQYcXdhYyq2" alt="" width="317"><figcaption></figcaption></figure></div>

The selected Device determines how the image is sent from Grid Studio.

Depending on the available media configuration, this can be used for outputs such as:

* **NDI**
* **SDI**

The exact Device configuration depends on the selected output technology and hardware and is covered separately in the corresponding media documentation.

***

## Verify the Output

Once the Sender is enabled, verify the signal in the receiving system.

The complete image pipeline is now:

**Point Cloud Volume → Image Rendering → Image Provider → Media Input → NDI / SDI → External System**

If the image arrives correctly, changes made to the Camera, clipping range, Point Size, Erode / Dilate, or Smooth are reflected in the outgoing image in real time.

This makes it possible to continue tuning the depth image while observing the final result directly in the receiving application.
