Can you fit an external image into the face of a mesh?

So my question is straightforward, I have a very thin mesh created by passing 4 vertices, the mesh has a material that shows an external image that in the image shown is a building plan, the small big problem that the image is not fitting the face of the mesh at all, instead some bits of the image are outside of the face at all.

Is there any way to fit the texture inside of the face? is something about UVs?

Reference image:

Hope this helps

A more straightforward way to apply an image to one face of a thin mesh, either all the image or part of an image.

sorry for the late response, I just saw the playground, on friday I was actually trying to do a custom mesh, I did it with the vertices that I was trying to work with and even tried to adjust the normals of the mesh but for some reason I’m still struggling to show the texture image. here is the PG, is there something wrong with how I did the normals? or did I missed something?

On mobile so only had a quick look. Seems all the facet triangles lie in xz plane so normals should be of form (0, 1, 0) or (0, -1, 0), ie along y not z.

Also you need to set uv array to display image


ok, thanks for the normals correction, it was one of the issues, still I’m trying to figure out how to understand UV mapping on babylon, not gonna lie, for a beginner is kinda confusing. I’ll let you know if I manage to display the texture correctly.

So, as I’ve been trying to make UV’s work out, I’m kinda stuck on it. After I corrected the normals I started to research a bit on UVs (yeah, now I understand U and V means X and Y in 2D coordinates), the issue here is that I cannot understand how to apply the UV mapping on my shape, most examples are shapes with one facet and not two.

I send my PG in case you want to look into my UV mapping try.

in the end was my bad, I adjusted the lighting bad on the playground making the texture looking always black, so about UVs I finally found the idea of them and not gonna lie it was easy after finding that the lights were messing with the texture.

Anyways, here is the playground for people who are new and stuck with UV’s, ask away if you are new here and want to knew more about how I solved this.

Thanks @JohnK btw, you really helped me on this one! specially with the normals.