Currently, I am utilizing three.js version r73 and have implemented a fragment shader that showcases video frames with code like this:
gl_FragColor = texture2D( iChannel0, uv);
My objective is to introduce another uniform (let's call it iChannel1) that stores the video frame displayed at an earlier stage. The plan is to use this for motion capture, edge detection, and similar functions.
Despite my efforts, I have not been successful in achieving this goal.
I believe I need to duplicate the video texture somehow using JavaScript and then assign it to iChannel1, but I am unsure of how to grab a frame.
One option could be capturing the canvas content, but there might be unwanted noise present on the canvas. I specifically require the video frame, not the surrounding canvas. Additionally, going through the canvas capture process seems inefficient. It feels like there should be a straightforward API call to capture the current video frame effectively for creating a texture used by iChannel1.
I explored UniformsUtils as well, but it didn't provide the solution I was seeking either.