Loading Partial Morphs
I've been meaning to become proficient at writing Blender addons, so I've started to write something because I've always wanted one character's eyes, another's nose, another's mouth, etc... I dislike Python with a passion, still suck at it, and Blender's API has a lot of hidden complexity, but I have a proof of concept.
What the addon allows to do is this: You can load a morph, and have it show up as a shape key, allowing you adjust the strength with a slider.
"So what, we can already do that..." I can hear you saying.
But you can also define a vertex group on the object, and the morph will affect only those vertices.
"That's not going to blend very well at the transition and look horrible..." I can hear you saying.
But it also has a "falloff" slider with a smooth sigmoid function that you can play with.
- After installing/enabling the plugin as usual, it is under the Misc tab on the T-Panel. You select a G8F that you've imported via OBJ at base resolution, and preserving vertex order, as if you were going to make a morph.
- Create a vertex group for the area you'd like to isolate. The morph will only affect these vertices.
- Select a morph file. Currently, only morphs defined by vertex offsets are supported. This seems to be the most common for head morphs, but morphs defined in terms of other morphs don't work.
- Set the vertex group to the one you created.
- In the Object Data Properties, on the Shape Keys tab, find you new morph and adjust the strength to taste. As the falloff is probably currently 0, it will affect the entire object.
- Back in the addon, slowly raise the falloff (you probably want to hold the shift key while moving the slider for more precise control ) until the changes are localized around your vertex group in an aesthetically pleasing way. You probably want to mute any modifiers, like subd.
- Distance is not implemented yet, it allows to choose how the "distance" that drives the falloff is calculated. It may not even be that useful.
- Freeze morph is not implemented yet, but it'll generate a morph file you can have DS load.
Tested (sort of) with Blender 3.0, 3.1.2 and 3.30 alpha. Please let me know what you guys think.
Comments
If I understand correctly, we can already do that in blender with a morph weightmap. Below an example where I applied the G8F body builder fbm to one arm of the figure.
Yes, I saw that but I needed to get Blender to do as much of the work of moving vertices as possible and create another vertex group based on the one selected, that includes the falloff attentuation. I didn't think it'd be very user-friendly if the addon modified the existing vertex group.
But the most useful thing, I think, is the falloff. Sometimes the shape key doesn't look good around the edges of the vertex group, especially where the mesh is denser and with more curvature, e.g. the lips and nose. I think it works because the mesh is relatively sparse at the transition around the shoulder.
You've made me think of a possible improvement: Create another vg and implement the falloff in vertex colors.
Thanks for your comment.
It's a custom weightmap you can smooth the borders as you wish in weight paint. The geometry density is not a factor. Or I miss what you're meaning so a practical example would help everyone to understand the benefits over the blender tools. You could do a comparison that works with the plugin but it's not possible to do with the standard morphs.
Hi Padone,
No, I'd say you are understanding correctly. There is nothing the addon can do that Blender can't already, so your analusis is fair. I do think there is an advantage over weight painting because the falloff is a simpler, one-dimensional parameter that can be used to smooth the transition. Simply move the slider until it looks right. You don't ever even have to change modes. Weight painting seems like an overwrought approach when the only concern is the transition edge. I'll always take a procedural solution over an artistic one.
As usual your comments are well received, but also appreciate that while I find this tool easier, and it solved my morph problem, I was trying to teach myself how to write an addon as a didactic matter, more than necessarily a practical one.
I've also added x,y, and z biases to nudge the shape key in directions, and still respect the fallof to blend smoothly. Soon, I'll add a "live link" that will get rid of the hassle of exporting from DS to Blender and back, with all the correct settings, using a re-write of Sagan in anticipation of DS5.
Thanks again for your input.
Ok that was to understand things, I'm always very interested in your work. As for automatic smoothing I simply use: weight > smooth, very easy to adjust as desired.
I don't always have anything to say, but I always listen to the info you give to others.
And I've never investigated the weights menu in weight paint mode... I've already got the morph I wanted that started all of this, but just to learn something new, I'll try it your way and see how it compares.