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 7165809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:18:42+00:00 2026-05-28T14:18:42+00:00

I am trying to use Three.js to render a cube with 6 different images

  • 0

I am trying to use Three.js to render a cube with 6 different images on the faces.

The constructor of THREE.CubeGeometry looks like this:

THREE.CubeGeometry = function ( width, height, depth, segmentsWidth, segmentsHeight, segmentsDepth, materials, sides )

I can see from the code that “materials” is expected to be either a material, or an array of 6 different materials, but the materials passed in here never seem to be used when rendering.

Instead, the single material given to the Mesh constructor is used for all 6 faces.

var face_materials = ... <load 6 textures here>...
var cube_g = new THREE.CubeGeometry(400,400,400,1,1,1, face_materials); // <= ignored?
var cube = new THREE.Mesh(cube_g, some_material); // <= this is used instead

Even if I pass null or undefined as the “some_material”, it seems to override the face_materials and render nothing.

Is there a way to make this work using CubeGeometry? Or do I have to create the 6 faces separately and add them to the scene?

  • 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-05-28T14:18:43+00:00Added an answer on May 28, 2026 at 2:18 pm

    You need to use THREE.MeshFaceMaterial for the mesh. Here’s example code:

    var materials = [];
    for (var i=0; i<6; i++) {
      var img = new Image();
      img.src = i + '.png';
      var tex = new THREE.Texture(img);
      img.tex = tex;
      img.onload = function() {
        this.tex.needsUpdate = true;
      };
      var mat = new THREE.MeshBasicMaterial({color: 0xffffff, map: tex});
      materials.push(mat);
    }
    var cubeGeo = new THREE.CubeGeometry(400,400,400,1,1,1, materials);
    var cube = new THREE.Mesh(cubeGeo, new THREE.MeshFaceMaterial());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use jquery to switch between three images once you click on
I'm trying to figure out how to render an object (a cube) with different
I'm trying to use the StringEscapeUtils.escapeXML() function from org.apache.commons.lang... There are two versions of
I am trying to use this code in my QT app QMap<QString,QMap> but there
I'm trying to use g.render in a grails service, but it appears that g
I'm trying to use the PHP json_encode function to encode some JSON to send
I'm trying to use the default_url in my application but I store the images
I'm trying to use Direct3D to render 2D graphics, as recommended by everyone since
I'm trying to use AudioUnit to render a range of high-frequency sounds for a
I'm trying to use SharpDX to create a simple maze-like 2D program using DirectX.

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.