Using Video as texture with Three.js

淺唱寂寞╮ 提交于 2019-12-22 09:01:25

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/18383470/using-video-as-texture-with-three-js

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!