UV mapping not working as expected

I am trying to map an texture onto a plane manually created with custom mesh. So I followed the docu (Create Custom Meshes - Babylon.js Documentation) and should be simple enough.
But somehow I am confused by the uv mapping of the texture, it does not behave as expected or I just have my brain twisted really bad ;).
From what I understand:

  • The vertices contain an array of indices of points were each 3 indices form a triangle
  • The uvs contain an array of u and v positions were each 2 correspond to a vertice and thus 6 uvs entries should describe the texture of one rectangle in the vertices array.

Here is the playground with comments on what I think it should do:
https://www.babylonjs-playground.com/#5ZCGRM#290

My god, I am stupid. Obviously it doesn’t makes sense that the u,v position are mapped to the vertecies but to the positions… Works just fine ; )

1 Like