Morph Madness!
Fixing Exploding Morphs
Marik's Egyptian Choker is currently in production. It is the first accessory I've made that involves assignment to more than one bone and morphs for fat, fit and thin states. So there is a learning curve, and it is during that learning curve that interesting and unexpected things can happen.
As with my other content, I'm making the choker fit sims of all ages and genders--that's 8 different bodies.
Adding fat, fit and thin morphs multiples this number to 27 different bodies.
I'm also making 3 levels of detail for each of these. The number comes to 81 different bodies, 81 different bodies for which I need to tightly fit a cylinder around the neck and avoid clipping.
That's a lot of work. I can see why most custom content creators stick with one age, gender and detail level. At least, they did in the past. Our tools are getting better day by day, and that may partly be because of creative, ambitious and somewhat obsessive people like me.
There are usually multiple ways to solve the same problem. Some ways are faster than others. This I've learned from working in Blender3D. You can navigate to a button with your mouse or hit the keyboard shortcut. You can use proportional editing to fiddle around with a mesh or you can use a combination of modifiers.
If I am going to be creating 81 chokers, I don't want to be fiddling around on each one of them for an hour. I need something automated, repeatable and non-destructive so I can make adjustments later without having to start over from the beginning. I need to work smart rather than just work hard.
This is where modifiers and geometry nodes come in. After you develop a stack to work with one body, the same process pretty much works for the others as well. That is how it became easier for me to model each of the 81 chokers from scratch rather than to use proportional editing to fit a copy from one body to the next.
But I was about to confront an explosive problem…
Anyone who has worked with morphs before probably knows where this story is headed. There is a good reason to copy the base mesh and then use proportional editing to refit it to the fat, fit and thin bodies. That reason has to do with vertex index numbers.
You see, every vertex in your mesh has a number assigned to it so that the computer can keep track of it. Normally, the order of these numbers doesn't really matter much. I had never even thought about them before I loaded my base mesh and morphs into TSRW, touched those sliders to drag between morph states, and watched my mesh disintegrate into a mess of jagged, black fangs.
A morph is made up of directions for each vertex in a mesh on where to go if the sim is fat or thin or fit. The vertex index number determines which vertex gets which set of directions. If the vertices of your base mesh are numbered differently than the vertices of your morph, the wrong directions are sent to the vertices, and they end up going everywhere but the right places.
It is morph madness!
When a base mesh is copied and then the vertices are just nudged around with proportional editing, the numbering remains the same. When you make each morph from scratch, the numbering varies widely.
How, then, could I get each one of those 81 meshes to be numbered in exactly the same way?
Their structures and UV maps were the same, but their size and proportions varied a lot from body to body. Furthermore, I'd used the Edge Split modifier to sharpen edges, which results in disconnected geometry and double vertices.
Sorting the elements with native functions did not yield uniform results because of the varying proportions.
The Blender Add-On by bartoszstyperek called Copy Verts Ids presented a possible solution, but it was bewildered by the disconnected geometry and gave unpredictable results.
Fix your SHAPE KEYS! - Blender 2.8 tutorial by Danny Mac 3D
I had an idea of how I wanted the vertices to be numbered, ascending along one edge ring at a time, but short of selecting one vertex at a time and sending it to the end of the stack with the native Sort Elements > Selected function, there was no way to do this.
Of course, selecting 27,216 vertices one-at-a-time was even more unacceptable to me than the idea of fiddling with 81 meshes in proportional editing mode.
So… I decided to learn how to script an Add-On for Blender and create the tool I needed myself.
A week and 447 polished lines of code later, I had this satisfying button to press that would fix my problem.
Here are the index numbers before and after pressing that wonderful button.
My morphs are not exploding anymore, and I am so happy I didn't give up on this project or give myself carpal tunnel syndrome with hours of fiddling.
Marik's Egyptian Choker is coming along nicely now. I haven't avoided fiddling entirely, but now it only involves resizing to fix clipping issues during animation.
Unfortunately, I'll have to push the release date to next month, but now, I have developed my first Blender Add-On and maybe, after a bit more testing, it could be as useful to other creators in the community as its been to me.
See more of my work: Check out my archive.
Join me on my journey: Follow me on tumblr.
Support my creative life: Buy me a coffee on KoFi.
68 notes
·
View notes