Learn if a mesh has the second UV channel

Hi guys,

sorry for a noob question. How can I learn if a mesh has the second UV channel? Is there a method inside Babylon to define if a mesh has the second UV channel or get a list of UV channels in a mesh?

Thank you

1 Like

You can use mesh.isVerticesDataPresent(VertexBuffer.UV2Kind) to know if the mesh has this attribute data setup

1 Like

Thank you for a quick answer, unfortunately this throws an error that VertexBuffer is not defined. The editor then added the following line automatically:

const { VertexBuffer } = require(“babylonjs”);

But then the console throws another error that require is not defined.

What am I doing wrong?

1 Like

so use mesh.isVerticesDataPresent(“uv2”)

1 Like

If you’re writing vanilla browser javascript, you should be able to use BABYLON.VertexBuffer.UV2Kind like on the playground. :slightly_smiling_face:
https://playground.babylonjs.com/#7QQ3M5#2

1 Like

Yeah, thanks! That worked for me!

1 Like