Mesh.GetUVs Vector3 and Vector4?

Hi, why do we have those Vector3 and Vector4 in the mesh.GetUVs?
Is this an easy way for having extra space so we can fill in our relevant data related to each xy?
Or someday I will find a surprise instead of those 0f, 0f?

Just curious, thank you!

Mesh UVs are effectively just arbitrary numerical data the mesh holds. It just happens to be that it’s usually used as texture UVs, and that we only use the first two components of the Vector4 that data actually exists as. Most shaders simply ignore the zw components of the UVs, and likely only use the first and maybe second UV channels (light maps use the second UVs for example). In reality the light map UVs could have been stored in the zw components of the first UV, but for legacy reasons (older Mobile GPUs, and very old pre DirectX 9 desktop GPUs) there were significant performance implications in doing so that are no longer a concern.

So, yes, you can use those last two components to add anything you want.

1 Like

Thank you, I’m reading UVs around here and I never saw zw have any value.