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);