I’m using MediaPipe to apply face blendshape scores to a 3D avatar’s morph targets in Three.js.
The avatar is rendered to a canvas element, and I use canvas.captureStream() to extract the video stream from that canvas.
However, the stream I receive sometimes shows rendering issues, like in the screenshot below. The face mesh appears distorted or broken.
After testing, I found that this issue only occurs on certain machines and seems to be directly related to the canvas having display: none or the Scene.background being set to a color.
When I change the canvas to display: block or set the background to an image, the issue completely disappears and the rendered output in the stream appears correctly.
Sometimes display: none act as if the element has been removed from the DOM. Try with visibility: hidden or opacity: 0; or both, if the canvas is taking space, create a .hidden css class with position to absolute, and moves it off-screen.
@Fennec@Chaser_Code I tried using opacity: 0, visibility: hidden, or setting position to absolute and moving it off-screen. However, none of these methods solved the problem.