This chapter is the right place to introduce the usage of textures. Textures are images (
.jpeg, and so on) that graphics libraries are able to apply to meshes. There are several types of texturing methods handled by Babylon.js, such as video textures, cube textures, and so on. Now, let's explain how to use textures with materials.
As you may have already guessed, loading and applying a texture to a mesh can be easy with Babylon.js. The standard material provides a way, as for colors, to apply a diffuse texture (for example, specular, emissive, and ambient textures). Simply set the
.diffuseTexture property to the reference of your texture, as follows:
myMaterial.diffuseTexture = myTexture; ...