Get specific uv island

Hi, is there any way I can get a specific uv island after marking seams, unwrapping and mesh import into bjs? I want to animate only 1 of the uv island’s scale and offset properties. Please point me to a doc/api/pg, I suspect I might have become blind. =)

Many thanks in advance.

What do you mean by uv island? Like uv set?

UV are hosted by meshes (and you can have multiple sets).
The texture is then deciding which uv set to use with texture.coordinatesIndex property

The offset and scale are controlled by texture.uOffset, texture.vOffset, texture.uScale and texture.vScale

Just to clarify using the below figure.

when you say uv set, I presume that it refers to the boxes highlighted in green ? So a cube, depending on how it was unwrapped can have multiple uv sets ? I’m looking to access an uv island (eg: highlighted in orange, bottom pic). In this case, the uv island is a single face of the cube, but for complex meshes, a single uv island could consist of multiple faces from said mesh.

We have no concept of uv island then. But you can simply call mesh.getVerticesData("uv") to get an array of floats representing your UV data and then manipulating it

1 Like

ok, I will look into that. Thanks!

@phaselock : I see, from the images above, you are using Blender 2.8+, so here is a suggestion you may or may not find useful. Add a second material with a texture of some kind to your cube (or other mesh). This second material can have exactly the same parameters in Blender - just a different name.

When you look at the babylon file you will now see something like this:




Look at the code, and you will notice that it will allow you to play with u/v offsets, uv scales etc for both the different materials.

The image below was created that way, but after export, I then just changed the u/v scale in code for one of the materials (single face at the top).

Stay Safe, gryff :slight_smile:


1 Like

I’m not exporting blender material to bjs but this is nifty. I will keep in mind, thanks!