Multiple texture coord on custom mesh

Hi all,

I’m facing an issue for texturing a custom mesh. My mesh covers a block of a few tiles, and I would like to texture the tiles differently.
To reduce vertices number, and to connect properly the (non square) tiles together, a single vertex is part of up to 4 tile faces (think of the X vertex in the following schema, where faces A B C D should be texture mapped to different part of the image)
| | |
| A | B |
| | |
| | |
| C | D |
| | |

So I want to texture each face with a different part of my texture image. If texture coords were given for each face, that would be straight forward, but according to the doc one vertex can have one uv coordinate associated, so how to handle this case the best ?

  • Use 4 vertex by faces, allowing multiple vertices in the same position ? It seems to me the least efficient
  • Handle texture mapping in the material shader?
  • Use a different texture image for each face texture, and wrap it for tiles with the same type? I would need to create extra vertices only for tiles with different types then.

Unfortunately you need to duplicate the vertices. If you think about it the only property they are sharing is physical space (and maybe normal) so it’s not actually that wasteful. In fact it’s how flat shading etc is done anyway.

Hell yeah, in fact the only property they are not sharing is the texture coord…
But it makes sense, indeed. Except for 6*4 vertices for a cube instead of 8, it makes a big difference to me…

Sometimes by designing your texture right you can reduce the number (i.e. some vertices can share texture co-ordinates), I can understand your hesitation but honestly unless it goes crazy number of vertices is not a limiting factor.