Skip to content

It's a demo made in Godot demonstrating Chroma key via shaders. Chroma key, commonly known as the “green screen” or “blue screen” effect, allows you to remove a specific color from an image or video and replace it with another background

License

Notifications You must be signed in to change notification settings

Ymanawat/Chroma-Key-Shader-Godot-4

Repository files navigation

Chroma Key Shader

This is a shader script for Godot Engine that implements a chroma key effect. Chroma keying is a technique used to remove a specific color (usually green or blue) from an image or video, making it transparent and allowing other content to show through.

The shader provides RGB Comparison options for the chroma key effect. Chrome_key_shader

Usage

  1. Create a Sprite node or a VideoStreamPlayer on which you want to apply the effect.
  2. Create a new ShaderMaterial from the material properties of the node.
  3. Attach the shader script control.gdshader to the ShaderMaterial.
  4. Adjust the shader's properties to control the chroma key effect:
    • transparent_color: The target color to be replaced with transparency (in RGB format).
    • pickup_range: The distance allowed from the chroma key color in RBG space (0.0 to 1.0).
    • fade_amount: The amount of fading effect applied to the color and nearest pixels (0.0 to 1.0).
  • The RGB Comparison option gives sharper results, but the code is more straightforward and shorter.
  • The HSL Comparison option provides smoother shading but involves a slightly larger code due to the custom HSL conversion function implemented in the shader.

Credits

The original video I used is provided by pexels (https://www.pexels.com/video/a-man-with-a-green-background-9488367/)

The original shader script was inspired by Reddit user's post.

About

It's a demo made in Godot demonstrating Chroma key via shaders. Chroma key, commonly known as the “green screen” or “blue screen” effect, allows you to remove a specific color from an image or video and replace it with another background

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published