.. index:: Compositor Nodes; Keying Screen
.. _bpy.types.CompositorNodeKeyingScreen:

******************
Keying Screen Node
******************

.. figure:: /images/node-types_CompositorNodeKeyingScreen.webp
   :align: right
   :alt: Keying Screen node.

The Keying Screen node creates plates for use as a color reference for keying nodes.
It generates gradients from sampled colors on motion tracking points on movie clips.
It can be used to deal with uneven colors of green screens.


Inputs
======

Smoothness
   Specifies the smoothness of the keying screen.


Properties
==========

Movie Clip
   The selectable clip data-block used as input for the gradient colors.
Tracking Object
   Tracking Object to generate the gradient.
   You will probably want to create new a tracking object
   in the :ref:`Object <movie-clip-tracking-properties-object>` panel,
   because tracks used for gradients can not actually be used for camera/object tracking.
   After this tracks might be placed in places where gradient colors should be sampled.
   These tracks could be tracked or moved manually,
   so gradients would be updating automatically along the movie.
   Tracks might have an offset for easier tracking of feature-less screens.


Outputs
=======

Screen
   Gradient image output.


Example
=======

Consider a node setup for green screen removal, using
a :doc:`Color Key </compositing/types/keying/color_key>`:

.. figure:: /images/compositing_types_matte_keying-screen_key-usage.png
   :width: 480px

Often, lighting is uneven across the backdrop.

.. figure:: /images/compositing_types_matte_keying-screen_source.jpg
   :width: 480px

   Example from the `Mango Open Movie <https://mango.blender.org/>`__, Tears of Steel.

That can result in a bad matte.

.. figure:: /images/compositing_types_matte_keying-screen_bad.jpg
   :width: 480px

   Example of a poor mask: Some of the backdrop is opaque,
   and some parts of the gun in the foreground are transparent.

If you increase the tolerances on the Color Key node, it will accept
more shades of green to mask out. But it may also incorrectly mask out more of
the foreground.

Instead of increasing the range of accepted shades to be masked out,
the Keying Screen node lets you change what shade of green (or other color) to used
for different parts of the image.

Start in the :doc:`Movie Clip Editor </editors/clip/index>`.
Open the Sidebar region and Toolbar to show tracking configuration.
Tracks used for gradients are not useful for camera solving, because they do not track well.
So create a new object track in the *Objects* selector.
Place tracking markers on the clip to sample different parts of the backdrop.

.. figure:: /images/compositing_types_matte_keying-screen_trackers.jpg
   :width: 480px

These tracks may be tracked or moved manually, so gradients can be updated
over time. If the marker is not enabled for a frame, it will not be used creating
the gradient. (Such as the red-colored marker on the arm in the screenshot above)

Once the tracks are created, add the node to your compositing setup,
and select the tracking object used for the backdrop.

.. figure:: /images/compositing_types_matte_keying-screen_usage.png
   :width: 480px

   Node configuration with *Keying Screen*'s generated gradient
   plate connected to the Color input of the Keying node.

.. figure:: /images/compositing_types_matte_keying-screen_generated.jpg
   :width: 480px

   Gradient plate generated by *Keying Screen*.

The resulting image now has a better matte.

.. figure:: /images/compositing_types_matte_color-spill_example-after.jpg
   :width: 480px
