# Composite

> Stack up to four layers over a base at the base's size with blend mode, opacity, position and scale per layer.

Source: https://docs.tune.toys/nodes/video.composite/

Composite stacks up to four layers over a base, with blend mode, opacity, position and scale for each layer.

## What it does

The output is the size of the base. Each layer, `layer1` to `layer4`, is placed over the base in order. Per layer, Blend picks how it combines (0 to 3), Opacity fades it, X and Y move it and Scale resizes it. Each input takes exactly one stream.

## When to use it

Use it to put a keyed camera over a backdrop, overlay text or paint, or build picture-in-picture.

## Ports

<!-- ports:start -->

| Port     | Direction | Signal | Lanes |
| -------- | --------- | ------ | ----- |
| `base`   | Input     | Video  | 1     |
| `layer1` | Input     | Video  | 1     |
| `layer2` | Input     | Video  | 1     |
| `layer3` | Input     | Video  | 1     |
| `layer4` | Input     | Video  | 1     |
| `video`  | Output    | Video  | 1     |

<!-- ports:end -->

## Parameters

<!-- parameters:start -->

| Parameter  | Label     | Range     | Default | Unit | Scale  | Notes                                                                                   |
| ---------- | --------- | --------- | ------- | ---- | ------ | --------------------------------------------------------------------------------------- |
| `blend1`   | Blend 1   | 0 to 3    | 0       |      | linear | Blend mode of layer 1 over what is below. Choices: 0 Over, 1 Add, 2 Multiply, 3 Screen. |
| `opacity1` | Opacity 1 | 0 to 1    | 1       |      | linear | Opacity of layer 1.                                                                     |
| `x1`       | X 1       | -1 to 1   | 0       |      | linear | Horizontal offset of layer 1 as a fraction of the base width.                           |
| `y1`       | Y 1       | -1 to 1   | 0       |      | linear | Vertical offset of layer 1 as a fraction of the base height.                            |
| `scale1`   | Scale 1   | 0.05 to 8 | 1       | ×    | log    | Scale of layer 1 about its centre.                                                      |
| `blend2`   | Blend 2   | 0 to 3    | 0       |      | linear | Blend mode of layer 2 over what is below. Choices: 0 Over, 1 Add, 2 Multiply, 3 Screen. |
| `opacity2` | Opacity 2 | 0 to 1    | 1       |      | linear | Opacity of layer 2.                                                                     |
| `x2`       | X 2       | -1 to 1   | 0       |      | linear | Horizontal offset of layer 2 as a fraction of the base width.                           |
| `y2`       | Y 2       | -1 to 1   | 0       |      | linear | Vertical offset of layer 2 as a fraction of the base height.                            |
| `scale2`   | Scale 2   | 0.05 to 8 | 1       | ×    | log    | Scale of layer 2 about its centre.                                                      |
| `blend3`   | Blend 3   | 0 to 3    | 0       |      | linear | Blend mode of layer 3 over what is below. Choices: 0 Over, 1 Add, 2 Multiply, 3 Screen. |
| `opacity3` | Opacity 3 | 0 to 1    | 1       |      | linear | Opacity of layer 3.                                                                     |
| `x3`       | X 3       | -1 to 1   | 0       |      | linear | Horizontal offset of layer 3 as a fraction of the base width.                           |
| `y3`       | Y 3       | -1 to 1   | 0       |      | linear | Vertical offset of layer 3 as a fraction of the base height.                            |
| `scale3`   | Scale 3   | 0.05 to 8 | 1       | ×    | log    | Scale of layer 3 about its centre.                                                      |
| `blend4`   | Blend 4   | 0 to 3    | 0       |      | linear | Blend mode of layer 4 over what is below. Choices: 0 Over, 1 Add, 2 Multiply, 3 Screen. |
| `opacity4` | Opacity 4 | 0 to 1    | 1       |      | linear | Opacity of layer 4.                                                                     |
| `x4`       | X 4       | -1 to 1   | 0       |      | linear | Horizontal offset of layer 4 as a fraction of the base width.                           |
| `y4`       | Y 4       | -1 to 1   | 0       |      | linear | Vertical offset of layer 4 as a fraction of the base height.                            |
| `scale4`   | Scale 4   | 0.05 to 8 | 1       | ×    | log    | Scale of layer 4 about its centre.                                                      |

<!-- parameters:end -->

### Blend 1 (`blend1`)

Blend mode of layer 1, 0 to 3.

### Opacity 1 (`opacity1`)

Opacity of layer 1.

### X 1 (`x1`)

Horizontal position of layer 1, -1 to 1.

### Y 1 (`y1`)

Vertical position of layer 1, -1 to 1.

### Scale 1 (`scale1`)

Size of layer 1, logarithmic.

### Blend 2 (`blend2`)

Blend mode of layer 2.

### Opacity 2 (`opacity2`)

Opacity of layer 2.

### X 2 (`x2`)

Horizontal position of layer 2.

### Y 2 (`y2`)

Vertical position of layer 2.

### Scale 2 (`scale2`)

Size of layer 2.

### Blend 3 (`blend3`)

Blend mode of layer 3.

### Opacity 3 (`opacity3`)

Opacity of layer 3.

### X 3 (`x3`)

Horizontal position of layer 3.

### Y 3 (`y3`)

Vertical position of layer 3.

### Scale 3 (`scale3`)

Size of layer 3.

### Blend 4 (`blend4`)

Blend mode of layer 4.

### Opacity 4 (`opacity4`)

Opacity of layer 4.

### X 4 (`x4`)

Horizontal position of layer 4.

### Y 4 (`y4`)

Vertical position of layer 4.

### Scale 4 (`scale4`)

Size of layer 4.

## Tips

- Unconnected layers are ignored.
- Use [Transform](https://docs.tune.toys/nodes/video.transform/) to prepare a layer's size first.
- Video needs the browser's WebGPU video engine. The Player and exports do not run video yet and report it unavailable. To see a video output, bind a live Screen in the Frame to it.

## See also

[Chroma key](https://docs.tune.toys/nodes/video.chroma-key/), [Video crossfade](https://docs.tune.toys/nodes/video.crossfade/), [Image](https://docs.tune.toys/nodes/video.image/), [Video](https://docs.tune.toys/concepts/video/), [Control lanes](https://docs.tune.toys/concepts/control-lanes/).
