# Different wallpaper on each face of the cube

**URL:** <https://discourse.threejs.org/t/different-wallpaper-on-each-face-of-the-cube/23649>\
**Category:** Questions\
**Tags:** geometry\
**Created:** [February 19, 2021, 10:56am UTC](https://discourse.threejs.org/t/different-wallpaper-on-each-face-of-the-cube/23649 "2021-02-19T10:56:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qjr](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/qjr/32/13574_2.png) [@Qjr](https://discourse.threejs.org/u/Qjr)\
**Post date:** [February 19, 2021, 10:56am UTC](https://discourse.threejs.org/t/different-wallpaper-on-each-face-of-the-cube/23649/1 "2021-02-19T10:56:43Z")

</div>

Hello  
How the hell would I set the wallpaper different for each face of the cube?  
There is no such thing as faces in version 125.  
I am looking and looking and I cannot think of anything.

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [February 19, 2021, 10:59am UTC](https://discourse.threejs.org/t/different-wallpaper-on-each-face-of-the-cube/23649/2 "2021-02-19T10:59:38Z")

</div>

> [@Qjr](#):
>
> How the hell would I set the wallpaper different for each face of the cube?

Just for clarification: Do you want to apply a texture per side of the cube or per triangle? Unfortunately, the term _cube face_ has a different semantic depending on the developer.

---

<div class="post-metadata">

**Author:** ![Qjr](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/qjr/32/13574_2.png) [@Qjr](https://discourse.threejs.org/u/Qjr)\
**Post date:** [February 19, 2021, 11:22am UTC](https://discourse.threejs.org/t/different-wallpaper-on-each-face-of-the-cube/23649/3 "2021-02-19T11:22:40Z")

</div>

I use.  
geometry.setIndex ();  
To save on creating vertices.  
I want to be able to assign a different wallpaper to each wall.  
I turn off some walls and want to be able to dynamically decide on the wallpaper.  
As now it has been solved in version 125 because it is not very transparent and not intuitive.

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [February 19, 2021, 11:41am UTC](https://discourse.threejs.org/t/different-wallpaper-on-each-face-of-the-cube/23649/4 "2021-02-19T11:41:09Z")

</div>

Okay, I thought would work with `BoxGeometry`. In this case, you can just apply an array of materials where each material is mapped to one side of the box.

If you generate the geometry by yourself, you have to generate [groups](https://threejs.org/docs/index.html#api/en/core/BufferGeometry.groups) data in order to support multi-materials. The idea is to use the `addGroup()` method to specify what parts of the geometry should be rendered by a given material. Exemplary calls look like so:

```javascript
geometry.addGroup( 0, 3, 0 );
geometry.addGroup( 3, 3, 1 );

```

Since you working with an indexed geometry, the first two parameters refer to indices in your case. The third parameter is the material index. The above code means the first triangle (defined by the first three indices in your index buffer) is rendered with the first material and the second triangle is rendered with the second material.
