# Green Screen Virtual Studio

Real-time Green Screen Virtual Studio is a specialized production setup used in film, television, and other media industries. It involves shooting a subject or scene against a cyclorama, which is replaced with your real-time rendered image by Reality 5.3 using <mark style="color:yellow;">**`RealityKeyer`**</mark>.

### Process

* Select the **Example Project** from the **Renderers** section inside the Reality Hub **Launcher** module.

<div align="left"><img src="https://1481147318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fm7K18wy4t0ZT0jAPo8rR%2Fuploads%2FdaINsF6s4Y9rF3awV4Dk%2Fimage.png?alt=media&#x26;token=f268d35d-d0f0-4fd6-9f20-b18948ed3d4b" alt="Launch With Option" width="100%"></div>

* Select Reality 5.3 in the **Launch With** section as illustrated above.
* Click on the **Launch** button.

<div align="left"><figure><img src="https://content.gitbook.com/content/RazR6THh3EAtvpLMGCP1/blobs/lrYaqxnnx0GP43x8ShYQ/image.png" alt=""><figcaption><p>Engines on <a href="../user-guide/nodegraph-actions/nodegraph/node-details-panel">Node Details Panel</a></p></figcaption></figure></div>

* Go to the Engines tab, drag and drop the <mark style="color:yellow;">**`UE5`**</mark> node into the Nodegraph canvas.

<div align="left"><figure><img src="https://content.gitbook.com/content/RazR6THh3EAtvpLMGCP1/blobs/JYDersEKuvObC73ZXc7v/image.png" alt=""><figcaption><p>Engine Functions</p></figcaption></figure></div>

* Select the <mark style="color:yellow;">**`UE5`**</mark> in the nodegraph canvas.
* Click on the UE5 in the **Nodes** section.
* Click on the **Spawn Reality Camera** and **Spawn Reality Projection Cube** buttons as illustrated above.

<div align="left"><figure><img src="https://content.gitbook.com/content/RazR6THh3EAtvpLMGCP1/blobs/CQKH7aOih8dHzCAswQow/image.png" alt=""><figcaption><p><mark style="color:yellow;"><strong><code>AJA</code></strong></mark> Nodes</p></figcaption></figure></div>

* Add <mark style="color:yellow;">**`AJAIn`**</mark> and <mark style="color:yellow;">**`AJAOut`**</mark> nodes to the Nodegraph canvas.
* Right-click on the <mark style="color:yellow;">**`AJAIn`**</mark> node and select an input channel from [Node Context Menu](https://zerodensitydocumentation.gitbook.io/docs/reality-5.3-sp1/reality-5.3-sp1/user-guide/nodegraph-actions/nodegraph/node-context-menu).
* Right-click on the <mark style="color:yellow;">**`AJAOut`**</mark> node and select an output channel.
* Connect the corresponding <mark style="color:green;">**`SingleLink`**</mark> output pin of the <mark style="color:yellow;">**`AJAIn`**</mark> node to <mark style="color:green;">**`SingleLink`**</mark> input of the <mark style="color:yellow;">**`AJAOut`**</mark> node. (In our example we utilized <mark style="color:green;">**`SingleLink 2`**</mark> and <mark style="color:green;">**`SingleLink 3`**</mark>)

<figure><img src="https://content.gitbook.com/content/RazR6THh3EAtvpLMGCP1/blobs/T329KvocJdJK0Kopxa5P/image.png" alt=""><figcaption></figcaption></figure>

* Right click on the <mark style="color:green;">**`SingleLink 2`**</mark> and utilize [APM](https://zerodensitydocumentation.gitbook.io/docs/reality-5.3-sp1/reality-5.3-sp1/user-guide/nodegraph-actions/nodegraph/advanced-preview-monitor).
* Add a Tracking Node (in our example it is the <mark style="color:yellow;">**`Xync`**</mark> node) into canvas.

<div align="left"><img src="https://1481147318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fm7K18wy4t0ZT0jAPo8rR%2Fuploads%2FtNEz80RFlcdbN4FfsmJm%2Fimage.png?alt=media&#x26;token=890f4fb0-9e6d-4892-b64d-0767f2e1df7c" alt="Transform Mapping Properties" width="100%"></div>

* Go to the <mark style="color:yellow;">**`Xync`**</mark> node property, click on the <mark style="color:red;">**`Enable`**</mark> checkbox.

### Changing the Transform Mapping <a href="#changing-the-transform-mapping" id="changing-the-transform-mapping"></a>

<div align="left"><figure><img src="https://content.gitbook.com/content/RazR6THh3EAtvpLMGCP1/blobs/u5mdQVMXRZ1yC5GCV8m3/image.png" alt=""><figcaption><p><mark style="color:yellow;"><strong><code>Xync</code></strong></mark> Node | <mark style="color:blue;"><strong><code>Transform Mapping</code></strong></mark> Property Group</p></figcaption></figure></div>

Depending on your studio setup, you may be required to change the <mark style="color:blue;">**`Transform Mapping`**</mark> property group settings.

In our example, we have to change the <mark style="color:red;">**`NegateX`**</mark>, <mark style="color:red;">**`NegateZ`**</mark>, <mark style="color:red;">**`CoordinateSystem`**</mark>, and <mark style="color:red;">**`NegatePan`**</mark> properties, as illustrated above.

### Breaking Track

In order to get Lens Distortion data, you need to use the <mark style="color:yellow;">**`Break Track`**</mark> node.

![Break Track Node](https://1481147318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fm7K18wy4t0ZT0jAPo8rR%2Fuploads%2F5S3o102bzZL6DVQkivXj%2Fimage.png?alt=media\&token=68b02e90-fe5c-480a-8f5a-358af1be2f05)

* Create a <mark style="color:yellow;">**`Break Track`**</mark> node.
* Connect the <mark style="color:yellow;">**`Xync`**</mark> node's Track <mark style="color:green;">**`Output`**</mark> pin to the <mark style="color:yellow;">**`Break Track`**</mark> node's <mark style="color:green;">**`Input`**</mark> pin.

<figure><img src="https://content.gitbook.com/content/RazR6THh3EAtvpLMGCP1/blobs/U9UhWAHRs3sJuf4MxCUO/image.png" alt=""><figcaption><p><mark style="color:yellow;"><strong><code>Cyclorama</code></strong></mark> Node Connections</p></figcaption></figure>

* Create an <mark style="color:yellow;">**`Undistort`**</mark> node.

{% hint style="info" %}
Undistorting the image taken by your studio camera is necessary because almost every camera lens has some degree of optical distortion. On the other hand, the <mark style="color:yellow;">**`Cyclorama`**</mark> node creates a 3D shape that isn't affected by lens distortions. To make sure the Cyclorama and camera image match up correctly, it's crucial to use the undistortion process.
{% endhint %}

* Go to the **Properties** of the <mark style="color:yellow;">**`Undistort`**</mark> node.
* Right-click on the <mark style="color:red;">**`Distortion`**</mark> property and select the "**Show as Input"** option.
* Connect the <mark style="color:green;">**`Lens Distortion`**</mark> output of the <mark style="color:yellow;">**`Break Track`**</mark> node to the <mark style="color:green;">**`Distortion`**</mark> input pin of the <mark style="color:yellow;">**`Undistort`**</mark> node.
* Connect the <mark style="color:green;">**`SingeLink`**</mark> output pin of the <mark style="color:yellow;">**`AJAIn`**</mark> node to the <mark style="color:green;">**`In`**</mark> input pin of the <mark style="color:yellow;">**`Undistort`**</mark> node.
* Connect the <mark style="color:green;">**`Out`**</mark> output pin of the <mark style="color:yellow;">**`Undistort`**</mark> node to <mark style="color:green;">**`Video`**</mark> input of the <mark style="color:yellow;">**`Cyclorama`**</mark> node.
* Connect the <mark style="color:green;">**`Track`**</mark> output pin of the <mark style="color:yellow;">**`Xync`**</mark> node to <mark style="color:green;">**`Track`**</mark> input of the <mark style="color:yellow;">**`Cyclorama`**</mark> node.

<figure><img src="https://content.gitbook.com/content/RazR6THh3EAtvpLMGCP1/blobs/gokKUXo2zkuE8IFnotbv/image.png" alt=""><figcaption><p><mark style="color:yellow;"><strong><code>RealityKeyer</code></strong></mark> Node Connections</p></figcaption></figure>

* Create a <mark style="color:yellow;">**`RealityKeyer`**</mark> node and two <mark style="color:yellow;">**`Distort`**</mark> nodes.
* Right-click on each <mark style="color:yellow;">**`Distort`**</mark> node's <mark style="color:red;">**`Distortion`**</mark> property and select the "**Show as Input"** option.
* Connect the <mark style="color:green;">**`Render`**</mark> output pin of the <mark style="color:yellow;">**`Cyclorama`**</mark> node to the <mark style="color:green;">**`In`**</mark> input pin of the <mark style="color:yellow;">**`Distort`**</mark> node.
* Connect the <mark style="color:green;">**`Mask`**</mark> output pin of the <mark style="color:yellow;">**`Cyclorama`**</mark> node to the <mark style="color:green;">**`In`**</mark> input pin of the second <mark style="color:yellow;">**`Distort`**</mark> node.
* Connect the <mark style="color:green;">**`Lens Distortion`**</mark> output pin of the <mark style="color:yellow;">**`Break Track`**</mark> node to the <mark style="color:green;">**`Distortion`**</mark> input pin of the **first** <mark style="color:yellow;">**`Distort`**</mark> node.
* Connect the <mark style="color:green;">**`Lens Distortion`**</mark> output pin of the <mark style="color:yellow;">**`Break Track`**</mark> node to the <mark style="color:green;">**`Distortion`**</mark> input pin of the **second** <mark style="color:yellow;">**`Distort`**</mark> node.
* Connect the <mark style="color:green;">**`Out`**</mark> output pin of the first <mark style="color:yellow;">**`Distort`**</mark> node to the <mark style="color:green;">**`Clean Plate`**</mark> input of the <mark style="color:yellow;">**`RealityKeyer`**</mark> node.
* Connect the <mark style="color:green;">**`Out`**</mark> output pin of the second <mark style="color:yellow;">**`Distort`**</mark> node to the <mark style="color:green;">**`Clean Plate Mask`**</mark> the input of the <mark style="color:yellow;">**`RealityKeyer`**</mark> node.
* Connect the <mark style="color:green;">**`SingleLink 2`**</mark> output pin of the <mark style="color:yellow;">**`AJAIn`**</mark> node to the <mark style="color:green;">**`Input`**</mark> input pin of the <mark style="color:yellow;">**`RealityKeyer`**</mark> node.

### Utilizing Portal Ping and Routing Features <a href="#utilizing-portal-ping-and-routing-features" id="utilizing-portal-ping-and-routing-features"></a>

At this stage, by its nature, the nodegraph gets complicated and hard to read as illustrated above. To overcome such issues, you can utilize a [Portal Pin](https://zerodensitydocumentation.gitbook.io/docs/reality-5.3-sp1/reality-5.3-sp1/user-guide/nodegraph-actions/nodegraph/portal-pin) and [Reroute](https://zerodensitydocumentation.gitbook.io/docs/reality-5.3-sp1/reality-5.3-sp1/user-guide/nodegraph-actions/nodegraph/reroute) feature.

<div align="left"><figure><img src="https://content.gitbook.com/content/RazR6THh3EAtvpLMGCP1/blobs/7pgg55psYBekmCOn7bsl/image.png" alt=""><figcaption><p>Adding Portal Pin</p></figcaption></figure></div>

* Right-click on the <mark style="color:green;">**`SingleLink 2`**</mark> output pin of the <mark style="color:yellow;">**`AJAIn`**</mark> node and select the "**Copy Pin"** option
* Right-click on an empty space inside the Nodegraph Canvas and select & paste the previously copied pin as a portal pin as illustrated above.

![Portal Pin Example](https://1481147318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fm7K18wy4t0ZT0jAPo8rR%2Fuploads%2FsYA7mkuDBGaalaINbjKd%2Fimage.png?alt=media\&token=c3580c2d-8b17-4952-ae40-9665104b178b)

The <mark style="color:yellow;">**`AJAIn`**</mark> node's <mark style="color:green;">**`SingleLink 1`**</mark> output pin becomes a <mark style="color:yellow;">**`Portal`**</mark> as illustrated above and can be used anywhere inside the nodegraph with the same functionality. Portal Pin also inherits any changes in the main node.

<figure><img src="https://content.gitbook.com/content/RazR6THh3EAtvpLMGCP1/blobs/OknScngKZOjrUOptIqW1/image.png" alt=""><figcaption><p>Node Network Example with Pin Portal and Reroute Features</p></figcaption></figure>

* Connect the <mark style="color:yellow;">**`SingleLink 2`**</mark> portal pin to <mark style="color:green;">**`In`**</mark> input pin of the <mark style="color:yellow;">**`Undistort`**</mark> node.
* Right-click on an empty space in the nodegraph canvas and paste the <mark style="color:yellow;">**`SingleLink 2`**</mark> portal pin again.
* Connect the second <mark style="color:yellow;">**`SingleLink 2`**</mark> portal pin to the <mark style="color:green;">**`Sync`**</mark> input pin of the <mark style="color:yellow;">**`Xync`**</mark> node.
* By following the previous behavior, convert the <mark style="color:green;">**`Lens Distortion`**</mark> output pin of the <mark style="color:yellow;">**`Break Track`**</mark> node into the portal pin.
* Paste and connect the <mark style="color:yellow;">**`Lens Distortion`**</mark> portal pin to the corresponding input pins of nodes.
* Add **Rerouting** between node connections you desire.

<figure><img src="https://content.gitbook.com/content/RazR6THh3EAtvpLMGCP1/blobs/u67DjNWoo0qV000KXsrR/image.png" alt=""><figcaption><p>Green Screen Virtual Studio Pipeline Example</p></figcaption></figure>

* Add a second <mark style="color:yellow;">**`Undistort`**</mark> node to nodegraph.
* Right-click on the <mark style="color:red;">**`Distortion`**</mark> property and select the "**Show as Input"** option.
* Connect the <mark style="color:green;">**`Lens Distortion`**</mark> output pin of the <mark style="color:yellow;">**`Break Track`**</mark> node to the <mark style="color:green;">**`Distortion`**</mark> input pin of the <mark style="color:yellow;">**`Undistort`**</mark> node or create another <mark style="color:yellow;">**`Lens Distortion`**</mark> portal pin and connect it to the <mark style="color:green;">**`Distortion`**</mark> input pin of the <mark style="color:yellow;">**`Undistort`**</mark> node.

{% hint style="warning" %}
If you are doing VR (Virtual Reality) projects, at this point, you have to connect RealityKeyer node's Output pin directly to the Video input of the Composite Passes node.&#x20;
{% endhint %}

* Connect the <mark style="color:green;">**`Output`**</mark> pin of the <mark style="color:yellow;">**`RealityKeyer`**</mark> node to the <mark style="color:green;">**`In`**</mark> input pin of the <mark style="color:yellow;">**`Undistort`**</mark> node.
* Connect the <mark style="color:green;">**`Out`**</mark> output pin of the <mark style="color:yellow;">**`Undistort`**</mark> node to the <mark style="color:green;">**`Projection Cube Video Input`**</mark> input of the <mark style="color:yellow;">**`UE5`**</mark> node.
* Create another <mark style="color:yellow;">**`Xync Track`**</mark> portal pin and connect it to the <mark style="color:green;">**`Reality Camera Track`**</mark> input of the <mark style="color:yellow;">**`UE5`**</mark> node.
* Create a <mark style="color:yellow;">**`Composite Passes`**</mark> node.
* Connect the <mark style="color:yellow;">**`RealityKeyer`**</mark> node's <mark style="color:green;">**`Output`**</mark> pin to <mark style="color:green;">**`Video`**</mark> input pin of the <mark style="color:yellow;">**`Composite Passes`**</mark> node.
* Create another <mark style="color:yellow;">**`Xync Track`**</mark> portal pin and connect it to the <mark style="color:green;">**`Track`**</mark> input pin of the <mark style="color:yellow;">**`Composite Passes`**</mark> node.
* Connect the <mark style="color:green;">**`RealityCamera Scene`**</mark> output pin of the <mark style="color:yellow;">**`RE5`**</mark> node to the <mark style="color:green;">**`Render`**</mark> input of the <mark style="color:yellow;">**`Composite Passes`**</mark> node.
* Connect the <mark style="color:green;">**`Output`**</mark> output pin of the <mark style="color:yellow;">**`Composite Passes`**</mark> node to <mark style="color:green;">**`SingleLink`**</mark> input pin of the <mark style="color:yellow;">**`AJAOut`**</mark> node.

<figure><img src="https://content.gitbook.com/content/RazR6THh3EAtvpLMGCP1/blobs/R0mRQSvw0Ao7MW7KQ8NU/Brand%20Mind%20Live%20Virtual%20Studio.jpg" alt=""><figcaption><p>Image Courtesy of Brand Mind Live Virtual Studio</p></figcaption></figure>

<figure><img src="https://content.gitbook.com/content/RazR6THh3EAtvpLMGCP1/blobs/jFyho9KpWKsaHMoAnXKA/BETV%20-%20Dreamwall.png" alt=""><figcaption><p>Image Courtesy of BETV - Dreamwall</p></figcaption></figure>
