How To Assign a Texture to a Singe Face of a Box

Hello Everyone,
This is my first post here.
I am still learning the how-to’s of BabylonJS and I am stuck at a something
Is there a possible way by code to assign a texture to only one face of a box?
https://playground.babylonjs.com/#M6Z7UW#1

Here is the PG I am working on, what I am trying to achieve is that I want the “AAA” texture to only display on the side facing the camera.

Thanks in advance :smiley:

Hi @steveS and welcome to the forum. You can find all about textures on different box faces here - Apply Material to Individual Faces - Babylon.js Documentation

and here is an example from your PG https://playground.babylonjs.com/#M6Z7UW#2

1 Like

Thank you very much :smiley:

Hi @JohnK, is it possible to assign also different texture to different faces?
From the manual it seems it’s possible only tu apply UV texture. For example, having a cube as a rooom i’d like to apply one texture on the bottom face, another texture to the walls and another to the top. Is it possible?

The image used must contain all 6 textures. You cannot use 6 different texture files.

1 Like

Ok Thanks, in this case if i use uScale and vScale to make a tile texture what’s the effect? For example i use a texture for the floor that i replicate to make the illusion of tiles. Is it still possible even with UVimages?

For more flexibility make your room with 6 planes and a texture for each

I’d like to use a box because i really like the feature for hiding walls (side orientation = backside).
Anyway thank you for the suggestion :+1:

You can get the same result with planes. Here is a starter, need to add roof and floor

Tiling on one wall https://www.babylonjs-playground.com/#316IKG#1

Could also use tiled planes Creating A Tiled Plane | Babylon.js Documentation or tiled box Creating A Tiled Box | Babylon.js Documentation

2 Likes