Universal Chroma Key Shader provides you a simple shader to achieve the chroma key compositing effect on any texture, including movie textures.
It makes the selected color of your texture (image, video or webcam capture) transparent, so you can easily remove the background. You can place any other content behind or in front, also using the shader, so you can get your desired composition.
Examples of uses:
- Removing the background of a video to simulate another background
- Get textures with transparency using JPG files instead of bigger PNGs with alpha
- Create 3D parallax.
- You can select the color to be removed (most often used is green, but any color can be assigned). -You can control the color tolerance to remove similar colors
- You can control the strength of the cutoff -You can change these values on runtime
- You can use the shader multiple times in the same scene
Included in the package:
- The shader
- Sample scene
- Windows and Mac Standalone
- It should work in all platforms.
To change programatically on runtime the behavior of the shader, you can do it on this way:
renderer.material.SetFloat("_Sens", 0.2f); renderer.material.SetFloat("_Cutoff", 0.4f); renderer.material.SetColor("_Color", new Color(0f, 1f, 0f));