> 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/touch-designer-integration/camera-tracking/camera-rig.md).

# Camera Rig

Configure the generated camera rig, select your scene geometry, and preview the rendered result with lens distortion and a world grid.

The camera rig connects the SPNet Camera CHOP to a TouchDesigner camera, renders your scene, and applies lens distortion to the resulting image.

It is created automatically beside the SPNet Camera CHOP. Its viewer displays the final image.

Use the rig's parameters to control the scene and camera behavior. Camera selection, network settings, output resolution, and overscan are configured on the source SPNet Camera CHOP.

### Camera page

| Parameter           | Default       | Description                                                          |
| ------------------- | ------------- | -------------------------------------------------------------------- |
| SPNet Camera Source | Creating CHOP | References the SPNet Camera CHOP providing the camera and lens data. |
| Use Position        | `On`          | Follows the received camera position.                                |
| Use Rotation        | `On`          | Follows the received camera orientation.                             |
| Use FOV             | `On`          | Follows the received horizontal field of view.                       |
| Manual Position     | `0, 0, 0`     | Camera position in meters, used when Use Position is off.            |
| Manual Rotation     | `0, 0, 0`     | Camera XYZ rotation in degrees, used when Use Rotation is off.       |
| Manual FOV          | `60`          | Horizontal field of view in degrees, used when Use FOV is off.       |

#### Mixing live and manual controls

Position, rotation, and field of view can be controlled independently.

For example, you can follow the tracked camera's position and rotation while using a fixed field of view:

1. Leave **Use Position** and **Use Rotation** enabled.
2. Disable **Use FOV**.
3. Set **Manual FOV** to the required angle.

The rig continues to apply overscan to the selected field of view.

### Lens page

| Parameter  | Default | Description                                                        |
| ---------- | ------- | ------------------------------------------------------------------ |
| Use Center | `On`    | Applies the received optical center shift.                         |
| Use Lens   | `On`    | Applies the received radial lens distortion to the rendered image. |

#### Use Center

Center shift offsets the optical center of the image.

The rig converts the received center shift using the camera's panel dimensions. Disable Use Center to use a centered projection.

#### Use Lens

Use Lens enables radial distortion using the camera's K1, K2, and K3 coefficients.

Disable it to view the scene without radial distortion. Overscan cropping remains active, keeping the final output framing consistent.

{% hint style="info" %}
To compare distortion on and off, view `out1` and toggle Use Lens.
{% endhint %}

### Scene page

| Parameter  | Default                | Description                                        |
| ---------- | ---------------------- | -------------------------------------------------- |
| Geometry   | Source network pattern | Selects the Geometry COMPs included in the render. |
| Lights     | Source network pattern | Selects the Light COMPs used by the render.        |
| Debug Mode | `Off`                  | Adds a world grid and axis arrows to the scene.    |

#### Geometry

Enter absolute paths or matching patterns for the Geometry COMPs you want to render.

To render one object:

```
/project1/geo1
```

To render multiple objects, separate their paths with spaces:

```
/project1/geo1 /project1/geo2
```

To select geometry in a network using a pattern:

```
/project1/*
```

The selected objects retain their transforms, materials, and render settings.

#### Lights

Use the same path format to select Light COMPs.

Lighting depends on the materials assigned to your geometry. A Constant MAT is useful for testing because it displays its color or texture without scene lighting.

### Debug Mode

Enable Debug Mode on the Scene page to add:

* A floor grid measuring `12 × 12` meters.
* Grid cells measuring `1 × 1` meter.
* World-axis arrows measuring `2` meters.

The floor lies at world `Y = 0`.

| Color | Axis                                                       |
| ----- | ---------------------------------------------------------- |
| Red   | Positive X                                                 |
| Green | Positive Y                                                 |
| Blue  | Grid Studio positive Z, mapped to TouchDesigner negative Z |

The debug geometry passes through the same camera, render, and distortion stage as your scene. It uses unlit materials and does not require lights.

The camera must face the grid for it to be visible. Enabling Debug Mode leaves the camera pose unchanged.

{% hint style="info" %}
The internal `debug` component is included through the Render TOP's geometry selection. Its geometry does not need a wired connection to the render.
{% endhint %}

### Internal nodes

Enter the rig to inspect its setup.

| Node         | Purpose                                                                |
| ------------ | ---------------------------------------------------------------------- |
| `camera`     | Camera COMP driven by the rig's live or manual controls.               |
| `render_raw` | Renders the selected scene before lens distortion.                     |
| `lens_top`   | Native SPNet Distortion TOP applying distortion and overscan cropping. |
| `out1`       | Final image for use elsewhere in your project.                         |
| `debug`      | Contains the optional grid and axis geometry.                          |
| `help`       | Text DAT containing a local reference for the rig.                     |

The image-processing chain is:

```
render_raw → lens_top → out1
```

### Preview and output

View the rig's node viewer or its internal `out1` TOP to see the final result.

Use `out1` as the image source for further processing, compositing, or output in TouchDesigner.

With overscan enabled, `render_raw` covers a larger scene area than the final image. Use `out1` for comparisons that require the final framing.

{% hint style="info" %}
The Camera COMP's 3D viewer shows the scene before post-render lens distortion. View `out1` to check the distorted result.
{% endhint %}
