Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8948073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:54:28+00:00 2026-06-15T12:54:28+00:00

I’m trying to apply a THREE.ImageUtils.loadTextureCube() using the real time camera onto a spinning

  • 0

I’m trying to apply a THREE.ImageUtils.loadTextureCube() using the real time camera onto a spinning cube.

Until now, I managed to apply a simple texture using my video to a MeshLambertMaterial :

var geometry = new THREE.CubeGeometry(100, 100, 100, 10, 10, 10);
videoTexture = new THREE.Texture( Video ); // var "Video" is my <video> element
var material = new THREE.MeshLambertMaterial({ map: videoTexture });
Cube = new THREE.Mesh(geometry, material);
Scene.add( Cube );

That’s OK and you can see the result at http://jmpp.fr/three-camera

Now I’d like to use this Video stream to have a brushed metal texture, so I tried to create another kind of material :

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 });

… but it throws the following error :

blob:http://localhost/dad58cd1-1557-41dd-beed-dbfea4c340db 404 (Not Found) 

I guess loadTextureCube() is trying to get the 6 array parameters as an image, but doesn’t seems to appreciate a videoSource instead.

I’m beginning with three and wondered if there is a way to do that ?

Thx,
jmpp

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:54:29+00:00Added an answer on June 15, 2026 at 12:54 pm

    There are two ways I could see. First, if you just want the same image but with some specular highlights/shininess then just change

    var material = new THREE.MeshLambertMaterial({ map:texture});
    

    to

    var material = new THREE.MeshPhongMaterial({ 
             map: texture , 
             ambient: 0x030303, 
             specular: 0xffffff, 
             shininess: 90
    });
    

    and play with the ambient, specular, shininess settings to find what you like.

    Second, if you really want to add effects to the video image itself, you could draw the image to a canvas, manipulate the pixels, and then set the texture image to that new image. This could also be done with custom shaders, avoiding the canvas step, but there are already libraries for applying image filters to elements, so I’d stick with that. That would work something like this:
    You would need a canvas to draw to <canvas id='testCanvas' width=256 height=256></canvas> Then with javascript

    var ctx = document.getElementById('testCanvas').getContext('2d');
    texture = new THREE.Texture();
    
    // in the render loop
    ctx.drawImage(Video,0,0);
    var img = ctx.getImageData(0,0,c.width,c.height);
    // do something with the img.data pixels, see 
    // this article http://www.html5rocks.com/en/tutorials/canvas/imagefilters/
    // then write it back to the texture
    texture.image = img;
    
    texture.needsUpdate = true
    

    Updated!

    Actually, you can do it as an envMap, you just need to force the video to be a power of 2 with same width/height. Videos stream in to chrome as 640×480, so you still need to draw a canvas, but only to crop/square the image. So I got this to work:

     // In the access camera part
     var canvas = document.createElement('canvas')
         canvas.width = 512;
         canvas.height = 512;
     ctx = canvas.getContext('2d');   
    
     // In render loop 
     ctx.drawImage(Video,0,0, 512, 512);
     img = ctx.getImageData(0,0,512,512);
     // This part is a little different, but env maps have an array 
     // of images instead of just one
     cubeVideo.image = [img,img,img,img,img,img];
     if (Video.readyState === Video.HAVE_ENOUGH_DATA)
         cubeVideo.needsUpdate = true;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.