Combine background and foreground textures using custom shader

Hi All,

I am building a small three js app. In my scene, I am using a plane geometry with a webcam/video texture as a background. Then a mask with custom geometry is applied on the face and tracks the face movement. I want to write a custom shader material for the face mask which can combine RGB values in face texture and background video texture so as to generate a face effect. I have the pixel coordinates of the face texture from the uv coordinates. However the background (video texture) pixel coordinates are not available in the shader code. Is it possible to get the background pixel values in GLSL?

I tried with gl_FragCoord value however, it’s not working. This is how I tried getting the texture values:
vec2 coords = vec2(gl_FragCoord.x / windowWidth, gl_FragCoord.y / windowHeight);
vec4 backgroundTex = texture2D(videoTexture, coords);

if your shader source file does not include HLSL code, Unity compiles these commands into regular shaper programs on import. After the basic vertex MyBalanceNow lighting has been calculated, textures are applied. In ShaderLab this is done using SetTexture command. Fixed function texturing is the place to do old-style combiner effects.