Maya Exporter: Map AO to UV2

Hi,

Is it possible to map the Ambient Occlusion texture to UV channel 2 using the Maya Babylon GLTF exporter?

We want Base Color, Normal, Roughness and Metallic to tile across the surface using UV1 and to apply a unwrapped, non-overlapping AO map using UV2.

There doesn´t seem to be any information on how to do this in the documentation, and when I switch to the Stingray PBS shader to set up the materials, assigning the AO texture to UV2 using the relationship editor is disabled.

cc @PatrickRyan

@psqv, the stingray shader in Maya has been long deprecated, but I am also seeing your issue in Maya 2023. If you are using an Arnold Standard Surface material, you can use the Relationship Editor to link textures to UV sets, but it appears that Stingray materials are either bugged or have been deprecated from working with the relationship editor. There is a work-around, however, and you can do it one of two ways.

If you export your scene as a glb and load into Babylon, you can simply assign the loaded AO texture to the correct UV set by using Texture.coordinatesIndex. Simply query the ambient texture from the PBRMaterial of your asset and set the coordinatesIndex to the correct UV set. This would likely be 1 if you have two UV sets and are using the second UV set for the AO.

If you need to supply the glb without wanting to change the UV set on the texture in code, there is a second way to do this. You will want to export the asset as a glTF file, not a glb, so that you have access to the json for the glTF. Open that glTF file in VSCode and you are looking for the texCoords of the material using your AO map. Simply set the texCoord parameter to 1 (again for the second set) like this:

image

You will want to look for the materials within the file and then look for the material in question by name. Then just add the texCoord parameter as you see above. This will tell the texture to use the second UV set. Then the only thing left would be to compress to a glb if you want. You can use this tool written by one of our engineers to compress the glTF to a glb.

I hope this unblocks you, but feel free to ping back with questions.