Warm tip: This article is reproduced from serverfault.com, please click

Using Video as texture with Three.js

发布于 2013-08-22 14:35:13

I am trying to create a simple rectangle with a .mp4 video as texture. As per three.js documentation(http://threejs.org/docs/#Reference/Textures/Texture) this should be straight forward.

When I am putting link of video, all I am getting is a black colored box with no texture on it. I have tested code by replacing video with a jpg image and it works fine. Can someone please explain me what I am doing wrong.

I have already seen the examples in which video is played by first linking it to a video element and then copy the frames on a canvas. I want to try the direct way as mentioned in the three.js documentation.

Questioner
Gaurav
Viewed
0
Alex Under 2013-08-23 04:00:18

Think of video as a sequence of images. So to "play" this video on your 3D object - you'll have to pass every single frame of that sequence to your material and then update that material.

Good place to start is here: https://github.com/mrdoob/three.js/wiki/Updates

And here: http://stemkoski.github.io/Three.js/Video.html