I am importing a mesh to my playground let’s say a box. Now I am able to identify the vertices that form a face of the mesh. I want to use this vertices information to apply a texture or image to the face of the mesh. I went through this doc
but did not understand how can I achieve this
You will need to set uv coordinates to your vertices. You normally do it in an external tool (like Blender).
Here’s an in-depth explanation of uvs:
To set them programmatically, simply create an array with the (u,v) coordinate for each vertex and call mesh.setVerticesData("uv", uvArray)
to apply them to the mesh.
Thanks for the reply @Evgeni_Popov. This works when we want the entire image to be applied on a surface. What i’m trying to do is to apply different textures to each face. so after applying image on one face i would like to apply another image on another face. Is there any way to do this in Babylon or do i need to write custom shaders in webGL to achieve this sort of behaviour from the mesh?