How to apply a texture to only one side of a cube in three.js?

hello,
I want to apply an image as a texture to one side of a cube.
I will place a simple cube in the scene and apply a texture to the top of the cube.
How can I get to the goal in three.js?

You can use an array of 6 materials instead of one material. In this way each material will correspond to one of the six sides of the cube. Here is an example where a texture is applied to the top side. See lines 63-73:

https://codepen.io/boytchev/full/jOvaeKg

image

1 Like

Thanks! It works! :smiley:

1 Like