How can I "tile" a texture?

I have a texture for the ground that I want to use, except it is a single tile that I want to repeat/tessellate multiple times across the Ground mesh.

How do I accomplish this instead of the default behaviour which seems to be stretching the texture so that it covers the entire Ground?

I can think of two ways, neither of which seem like they’ll be performant;

  • create multiple Ground meshes and tile them together
  • create a DynamicTexture and do the tiling/tessellating myself on the html5canvas

Is there a better way, maybe a way to tessellate a single texture when attaching it to a mesh?

Hi @sairens and welcome to the community!

You can use texture.uScale and vScale to tile a texture.

More information is available in this doc page.

6 Likes

how do i dynamically calculate like if i have a tile image of 320X320 and if i get the x,y,z of the mesh by using meshname.getBoundingInfo().boundingBox.extendSize.x; then i want to calculate the uScale and vScale is that possible for me do map tiles on a wall like in real life with out statically calculating for each image is there a way

Could you create a new question with an associated playground of your current progress ?