Chroma Key Material

Have you ever said to yourself "This image sequence/Image is cool! I wish I could key out this background color."? Well you're in luck! Now you can import this nifty material into Lens Studio and key out any blue-screen and green-screen color in a texture.

Import Material

All you have to do is import the ChromaKey.lsmat file (link below) into your project. Just right click in the resources panel and navigate to Add, Import files and select the file from the location you downloaded it to. The file will come with the material and a sample texture for you to test with!

Applying The Material

Now you can apply the material to any object you want. typically this is a 2D mesh like a plane or a billboard or a 2D Sprite. To do this, click on the material field in the Inspector tab for your object’s Mesh Visual component and choose the material from your Resources.

Material Parameters

So here's what you can do with the material.

Key Color: This is the color you want to key out (remove) from the image

Threshold: This slider controls how much of the color you want to remove. A higher number will remove a wider range of colors similar to the Key Color

Slope: This slider smooths out the threshold and can soften the effect of the color removal

Main Texture: This is the main texture for you material

Green Suppress: This will desaturate remaining green values in the image

Blue Suppress: This will desaturate remaining blue values in the image

Keying and Suppression

By sliding the Threshold slider and the Slope slider you can control how much of the color you want to remove. You can select the color you want to remove by clicking on the Key Color box and choosing the color from your image.

Suppression is used to desaturate any remaining color similar to the color you want removed. Sometimes pixels near the ones you want to keep have these subtle values that don't quite fall in the spectrum of the color you want keyed out. In this case a method of "color suppression" is used for these remaining pixels. It's important to note that setting this value too high will eventually desaturate the colors you want to keep, so watch out for that.





Wrap Up

And that's it! It's worth noting that this material is an unlit material and is primarily designed for flat textures that need some color keyed out of their source. This also works with animated textures such as image sequences. We hope you have fun with this!