Hi!
I’m trying to make a “Holographic” video with someone in front of a green screen. i would like to get rid of the greenscreen in the video and render the person only in it.
i already did some reasearch on Chroma keying but all the options are paid…
Anyone any idea of a free option to render my Movietexture without greenscreen ingame?
Worked it out!
Using a custom shader to render the cutout from the original MovieTexture renders a “hologram” like video
Shader "MovieWithSeperateAlpha" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} _Mask ("Culling Mask", 2D) = "white" {} _Cutoff ("Cutoff", Range (0,1)) = .5 }
SubShader
{
Tags {"Queue"="Transparent"}
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
Pass
{
CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
#pragma exclude_renderers gles
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
sampler2D _Mask;
struct v2f
{
float4 pos : POSITION;
float4 uv : TEXCOORD0;
};
half4 frag (v2f i) : COLOR
{
half4 color = tex2D(_MainTex, i.uv.xy);
half4 color2 = tex2D(_Mask, i.uv.xy);
return half4(color.r, color.g, color.b, color2.r);
}
ENDCG
}
}
Fallback "Transparent/Diffuse"
}
The _MainTex is the full video with green/blue screen
The _Mask is a the video rendered with UltraKey/ChromaKey usage and a Alpha Output which will output a
I made a post on the forums on how to create a chroma key shader. It get’s the job done and it’s free: http://forum.unity3d.com/threads/chroma-key-in-unity-5.359119/