I am experimenting with applying a real-time camera feed onto a rotating cube using
THREE.ImageUtils.loadTextureCube()
.
So far, I have successfully applied a basic texture from my video to a MeshLambertMaterial
:
var geometry = new THREE.CubeGeometry(100, 100, 100, 10, 10, 10);
videoTexture = new THREE.Texture( Video ); // "Video" is my <video> element
var material = new THREE.MeshLambertMaterial({ map: videoTexture });
Cube = new THREE.Mesh(geometry, material);
Scene.add( Cube );
You can view the result at
Now, I want to use this video stream to create a brushed metal texture. However, when attempting to create a different type of material, I encountered an error:
var videoSource = decodeURIComponent(Video.src);
var environment = THREE.ImageUtils.loadTextureCube([videoSource, // left
videoSource, // right
videoSource, // top
videoSource, // bottom
videoSource, // front
videoSource]); // back
var material = new THREE.MeshPhongMaterial({ envMap: environment });
The error received was:
blob:http://localhost/dad58cd1-1557-41dd-beed-dbfea4c340db 404 (Not Found)
It appears that loadTextureCube() expects image parameters but does not accept videoSources.
As a beginner in Three.js, I am wondering if there is a workaround for this issue?
Thank you, jmpp