Chroma Key
Updated
Makes one color of a video transparent, for green or blue screen footage.
- Type
comp-chroma-key- Script class
ChromaKeyComponent- Per entity
- One
- Version
- 1.0.0
Read about it in Video and streams: what it does, how to use it from a script, and examples.
Properties
Section titled “Properties”The props the runtime declares for this component, with their defaults and accepted ranges.
| Prop | Default | Range |
|---|---|---|
color |
"auto" |
|
edgeCleanup |
0.25 |
0 ≤ x ≤ 1 |
edgeShrink |
0.5 |
0 ≤ x ≤ 2 |
similarity |
0.4 |
0 ≤ x ≤ 1 |
smoothness |
0.15 |
0 ≤ x ≤ 1 |
spill |
0.6 |
0 ≤ x ≤ 1 |
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
A green-screen presenterA presenter filmed on a green screen is keyed into the scene by a Chroma Key on the Video entity; a script sets the key colour and switches the key, a blue key or automatic measurement from the keyboard.
Click the scene, then press K to turn the key off and on, B to key a blue screen instead, and A to let the key measure the screen colour itself. Drag to orbit the camera, scroll to zoom.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(ChromaKeyComponent); if (component) log(component.props);}