Textures

Hi,

Are UV coordinates applied per face and not per vertex? If this is so, does this mean a shared vertex can have different UV coordinates?

Thanks

All coordinates are applied per-vertex. This includes UVs.
There are no ‘faces’ in shader input at all.

So, if I have two quads, with shared vertices, these will share the same texture?

No, they will share same texture coordinates. Texture itself is taken from material’s settings.

Ok, so if building a 2d tile game were we have one big texture that holds the tiles, if using shared vertices assigning textures from this big texture won’t work, i.e. if quad1 has shared vertices with quad2 but want these two to have different textures, they cannot share vertices?

For that they need to lie in different submeshes(one mesh can have several submeshes). Different submeshes can use different materials.

Why would you do that? Whole point of “big texture that holds the tiles” which is called texture atlas is that you can change tile being drawn by changing UV of vertices. So why would you use shared vertices?
Make a lot of quads each of which having its own vertices with its own UVs and merge them into single mesh - that’s the whole point of doing it.

Ok, I have one mesh now, size of the screen made up of quads not using shared vertices and each quad had different u,v coordinates coming for a 2d array for the map. This mesh gets redrawn each frame and when moved to left 32 pixels (size of a tile), I just update the mesh with the next u,v coordinates.