UE5 & Maya: Cross-Platform Atlasing Tool

This tool implements texture atlasing for assets inside a level in UE5. While working on my Procedural Coral Tool, I spent some time researching optimization methods in Unreal Engine, at which point I came across the concept of texture atlasing. I wanted to implement a tool that would pipe the assets from Unreal into Maya Standalone, perform texture atlasing and any other functions, and import the new asset(s) and textures into engine.

I started off by first implementing texture atlasing using Maya's transfer textures. Leading up to that, for every mesh a material would be created and its texture would be assigned. Then the UVs would be laid out, and finally the textures would be transferred from the old UV set to the new one. This process would be repeated for every texture set. Finally the old UV set would be deleted and the atlas mesh would be exported.

I used multiple helper functions to keep my code more modular.

Once I got the Maya part working, I started working with the Unreal Python API to get selected actors and their textures and export everything out. For every selected actor, I first extracted all of its textures, exported them out using the TextureExporterPNG, and then exporter the actor using the LevelExporter.

Finally, I had to link up the two components of my tool by calling a Maya standalone subprocess from the Unreal script. This function first iterates through the folder, gets all the texture names in line with the naming convention I set as well as the list of actors exported, and then ports these over to the Maya atlasing script, which exports the atlased texture and mesh.

As an example, I used the tool to atlas a few rocks which were arranged in the Unreal level to form walls. These images show the original meshes and their UVs (overlapping in this case as these assets are similar), and the atlased meshes and UVs along with textures.