top of page

A vertex ID transfer utility for 3ds Max

I recently publish a tool that allows users to transfer vertex ID from one mesh to another provided that they share the same topology. This wasn't possible before in Max.

The tool is not limited by different shape or UV of the models.

Tool's UI

Transfer Vertex ID tool works like the vertex transfer utility inside of Maya, so users are presented with a familiar workflow.


Let's see the tool in action



Looking back at my journey


My journey with 3ds Max started way back in 2014, when I first started 3D. Had someone told me that I would be writing utilities for the program that did not exist before, I would have laughed at their face and then at myself. Having barely succeeded in graduating high school with computers, I quickly dropped out of college to pursue CGI and 3D art.


At first it was max, but just modelling then slowly I would learn about animation. The problem with being self taught is that in the beginning you have no idea what to learn.


In 2019, I moved to Maya for a job. The fact that I was learning a new software while having some experience of 3D helped me understand the fundamentals of computer graphics more. That's when I started learning about vectors, transform matrices, different coordinates system. I started looking at shader languages, and creating procedural shaders for both Unreal and Arnold. The fact that Maya's scripting is way more documented than that of Max helped a newcomer learn it better and get comfortable with it.


By 2021, I had learnt python and Maya's api and was able to create a rig transfer utility for Metahuman by Epic games. It was the first open source and free tool that allowed users to do that and it was a great hit. This aroused my interest into creating more scripts to help artists do their job better.


Writing the script


I thought about writing this tool since the very beginning, as I could not believe that such basic thing would be missing from a popular DCC app like 3ds Max. The only thing I could find was https://cganimator.com/mcg-reordervertsbyproximity/ a MCG script was written by Changsoo Eun back in 2017. The script worked by proximity in local space or by meshes having the same UV. This was a huge limitation because the meshes had to look the same in order for this to work.


I wanted to work around these limitations knowing that if it was possible in Maya and blender it would work for Max too. I went to bangkok to teach people about character pipeline and the problem of vertex reordering arose a lot. And since the office used Max, they would tranfer the mesh to blender, use a plugin there, reorder the vertex in blender and bring the mesh back to max. This pushed me to write the script even more, but I was only able to do this last week as both job and life got in the way.


How it works


The script in works by dividing the task in a few steps:

  1. Get neighboring vertices of each vertex in both the mesh using BFS.

  2. Ask user to select three neighboring vertices in order, first three in the source mesh and then three in the target mesh.

  3. Using BFS algorithm and backtracking it would search the neighbor of each vertices, see what the user had mapped initially and create a map for each of the vertex so that all vertices from source mesh is mapped to each vertex in the target mesh.

  4. Create a new mesh with the mapped vertices.


Writing the algorithm was the easy part. Implementing was a tough nut to crack, specially since it was my first time using maxscript, outside of using it to make some quick scripts comprising of a couple of lines.


The first problem I encountered was selecting the vertices in order. Max does not store the information of selection order, so I had the option to choose a callback script that I can activate, or storing the information one by one. I chose the latter, thinking it would be easier for the end user.


The second wall I hit, was creating a new mesh with the mapped vertices. It was harder than it looked. Since max does not actually support giving vertices its own ID, meant I had to create a mesh with all the vertices in order in the right world space coordinate. The problem was working with editable meshes and it would often create meshes, without the right order of edges to go with it. I am sure an expert could do it, but for me it was hard. My next solution was to export the meshes in OBJ, use the information and change the order in the obj file using python (called from pymxs inside of maxscript).


But alas, max has a bug that even if you set the right INI file for obj export settings and used noprompt, it would still prompt the end user the first time. That was a big no no for me, I did not want the end user's experience spoilt.


That's when I started looking into fbx. The article here https://banexdevblog.wordpress.com/2014/06/23/a-quick-tutorial-about-the-fbx-ascii-format/ really helped me. I implemented all the features and created a UI with the help of Dave Wortley's tool available here https://davewortley.wordpress.com/2017/07/30/interactive-rollout-builder-for-3ds-max/ but the results I was getting was not correct. The problem was the fbx exporter was exporting the selected meshes even with the right mesh node being passed on as argument.


Having solved that, all that was left to do was to create the right transform information for the mesh that will be imported. I found that the local transform information for objects are stored inside Objects >> Meshes >> properties70 so I had that copied from the target file and pasted into source before importing. A little bit of cleanup and the script was ready in a few days to be tested and published.


Check out my github to download it or click the link below.




Commentaires


bottom of page