Video background performance

What’s the best way (performance-wise) to draw 3d on top of video? The video should fill up the canvas.

I believe currently the simplest and the most performant way is to use HTML 5 video element in canvas parent as background.

1 Like

WebGPU has a nice way of dealing with videos but agree in WebGL extra composition might be cheaper than frame copy.

1 Like

Something like this? Manipulating video using canvas - Web APIs | MDN

Does it play nice with Babylonjs if some other mechanism is rendering video to the same canvas?

Trying to decipher your comment! Are you also saying that html 5 video element is the best bet for performance?

(reposting because I think my reply missed the @sebevan mention)

I don’t think you need these complications if I understand your question correctly.

  1. Make Babylon canvas transparent (clearColor.a = 0)
  2. Put the video as background of canvas parent div with the help of CSS.
1 Like

Alright! That was my initial interpretation but then I started thinking too much :slight_smile:

2 Likes