Unity green background cutout plugin

This article is an article for translating its documentation and helping you use it. If you need a plug-in, please join the group: 891555732 Please
note: Plug-ins are for research only, not for commercial use

ChromaKeyKit offers a wide range of chroma key color options for background removal. Asset contains the MultiShaderKit (MSK) component, which allows additional shaders to be added to the material. Also using the tools of chroma, blur and mask, you will be able to make sequences of shaders, each of which is applied to the previous result. it gets you the best results

1. USAGE (use)

1.CONNECTION

1).Shader only

The fastest way is to use one of the ChromaKey Alpha shaders ("ChromaKey Alpha Simple", "ChromaKey Alpha General", ...) to the material. It will behave like unlit chrome.

2).MSK Bridges

To connect MSKController to texture sources, use MSK bridges. By default, the assets contain MSKBridgeVideoPlayer for the Video Player component and MSKBridgeWebCamPlayer for the WebCamPlayer component. You can create your own bridge, using method to get texture from source and method of MSKController:

  • SetSourceTexture(Texture texture)  – used when the texture instance reference changes;
  • RenderIn()  - uses a render iterator to own texture, and returns it;
  • RenderOut(RenderTexture rt)  – for one rendering iteration to rt;

2.KEY COLOR → ALPHA / BACKGROUND

Unlike ChromaKey_Alpha, the background component changes the key color to the background color.
It works well for images with transparent objects, fine details, etc.:

1).Background Color

align=left&display=inline&height=244&name=image.png&originHeight=488&originWidth=1700&size=532404&status=done&style=none&width=850)

2).Background Texture

image.pngUse the corresponding shader or bind MSKController + ChromaKey Bg component ("ChromaKey BgColor" or "ChromaKey BgTexture").

3.Best quality

Use component sequence:
image.png

1).Add component MSKController

ComponentsSize is set to 3

2). Add ChromaKey Alpha component

Add a ChromaKey Alpha Simple or ChromaKey Alpha General component, put it into MSKController, and place it in the first position of the component;

3).Add Blur_ component

Add the Blur Simple or Blur General plug-in, set the corresponding material, and put it into the second component of MSKController;

4). Add MaskAlpha_ component

Add MaskAlpha_Simple / MaskAlpha General/MaskAlpha Expert components, put them in the component's MSKController, in the third position;
image.png

you can also use the prefab components "
Renderer-VideoPlayer-ChromaKey**" or "ChromaKey-Blur-Mask". In this case you can choose any shader of the material to use.

2. CHROMA KEY KIT 2.0

1.MSK CONTROLLER

MSKController - Consistently applies shaders from MSKComponents to source materials. Shaders will be applied in the order they are in the array "components".

2.CHROMA KEY COMPONENTS

Sets the value of its shader property. The component's shader is replicated with BlendMode turned off for correct rendering.

1).ChromaKeyAlphaSimple (MSKComponent)

  • KeyColor  - the color that will be transparent as a result;
  • DChroma  - chromaticity difference of key and source;
  • DChromaT  - chroma tolerance;
  • ChromaKeyShader  - Set MSK / ChromaKey / BlendOff / ChromaKey Alpha Simple;

2).ChromaKeyAlphaGeneral (MSKComponent)

  • DLuma  - chromaticity difference of light source and key;
  • DLumaT  - Luma tolerance;

3).ChromaKey_BgColor (MSKComponent)

  • BgColor - the color that will be placed instead of the key color;
  • Chroma  - result: Chroma close to source(0) -> close to Bg(1);
  • Luma  - result patch: close to light source (0) -> close to Bg (1);
  • Saturation  - result color saturation: close to 0 (0) -> close to result saturation (1);
  • Alpha  - BgColor result alpha;

4).ChromaKey_BgTextureColor (MSKComponent)

BgTex - the texture will be placed instead of the key color;

3.BLUR COMPONENTS

1).Blur_Simple (MSKComponent)

BlurXY  - the difference between X and Y used when filtering the image (X = Y);
BlurShader  - set a shader MSK/Blur/BlendOff... in this section;

2).Blur_General (MSKComponent)

BlurX  - distance of X to use when filtering the image;
BlurY  - spread of Y to use when filtering the image;
BlurIterations  - number of times to repeat the filtering operation (lower values ​​= faster);

3).Blur shaders

image.png
**

4.MASK COMPONENTS

1).MaskAlpha_Simple (MSKComponent)

MaskShader - Set MSK/Mask/BlendOff/MaskAlpha_Simple;

2).Mask Alpha_General (MSKComponent)

  • AlphaPow - Pow of alpha value;
  • MaskShader  - Set MSK/Mask/BlendOff/MaskAlpha_General;

3). MaskAlpha_Expert  (MSKComponent)

  • AlphaEdge  - Alpha gradient edge;
  • AlphaPow  - Alpha strength;
  • MaskShader  - Set MSK/Mask/BlendOff/MaskAlpha_Expert;

5.FILTER COMPONENTS

1).FilterHSBC (MSKComponent)

  • BaseColor  - color multiplier;
  • TintColor  - tint tint;
  • Hue  - hue (0 -> 360);
  • Saturation  - color saturation;
  • Brightness  - color brightness;
  • Contrast  - color contrast;
  • FilterShader  - set MSK/Filter/BlendOff/FilterHSBC;**

Guess you like

Origin blog.csdn.net/dengshunhao/article/details/104902697