Transfer mesh to Shapekey
Jovanni
Posts: 87
Hello everyone. Many Daz Studio users know that we can simulate clothing in Marvelous Designer and then load it as a morph in Daz Studio for existing clothing in the scene.
The morph is loaded relative to the current position of the vertices. But how can we achieve the same result in Blender? When I copy the mesh as a shapekey, the clothes fly off to the side and deform significantly.
I assume this is due to the Armature modifier. The shapekey seems to be created from the base shape rather than the current vertex positions. I'm not entirely sure. Is there a way to accomplish this in the same way it works in Daz Studio?
Comments
try exporting two versions - one before simulation, one after. Load both as shape keys, but set the ebfore one to -1 and the after to +1. That should just layer the simulation effect on top of the base pose (it's what Reverse Deformations in Daz Studio does, in effect).
Hi @Jovanni
If I am understanding you correctly, I made a Blender addon that can load the simplest morphs (the ones that are just vertex deltas, and don't more bones or reference other morphs) and create a shapkey.
It is fairly untested and has never run on any system other than mine, but I just tried it on a piece of clothing (I had only used it on G8F before), and it worked with the vendor's morphs for it.
You might give it a try... it'll be under the Misc tab in the N-panel, called "Partial Morph Loader". Select your object, ignore all the other settings, and just set the first option, "Morph File" and browse to the morph dsf or duf. It may try to use a relative path, so make sure the path is correct. I run Blender on Linux, so if you use Windows, you may encounter some Linux-isms that don't work on Windows. I tried in on 3.4.1 and the created shapekey works perfectly.
Hope it works for you.
Thanks for the advice, Richard Haseltine. That sounds like the way to go. The second Shapekey puts the clothes back where they belong, but the Shapekey doesn't match the morph 100%. There is still mesh distortion.
I've tried disabling the other Shapekeys, but to no avail. It seems that these distortions are caused by the Armature modifier. When I create Shapekeys on clothes without an Armature, everything works perfectly with no distortion at all.
The only workaround I've found is to copy the clothes and remove the Armature modifier from them.
Then, I create Shapekeys on the clothes with the Armature and save them as OBJ files. Finally, I apply them to clothes without an Armature. It's quite a painful process, but it works.
Still, I have to find a way to make it work with the Armature modifier
Hi @TheMysteryIsThePoint,
I tried to install your add-on but for some reason, the checkbox isn't checked after installation in my version of Blender, which is 3.3.1. I have to stay with this version until I finish my project. As I understand from your comment, your add-on imports the morph from the .duf file. However, I only have one obj file that I want to morph into another object.
@Jovanni
So, you have an object in Blender, and an OBJ file that is the same object, but morphed? And you want a shapekey that transitions the original object to the OBJ?
If so, that's pretty easy to do with a Python script. Can you verify that I'm understanding your problem correctly?
@TheMysteryIsThePoint
Yes, you are right. I should clarify that creating shapekeys for an object without an armature modifier is not a problem.
However, if the object has an armature modifier, the result of creating a shapekey is very strange.
Even the reverse deformation method suggested by Richard Haseltine can't completely solve the problem.
If you have any scripts, I would like to try them.
OK, I understand now. Have you tried duplicating the armature (if the armature is parenting both the figure and clothing), parenting the clothing to the new armature, and in pose mode on the clothing's armature, selecting the armature and hitting ctrl-A, and choosing "Apply Pose as Rest Pose"?
I think the problem is that the shape key is applied to the rest pose positions. Setting the shape key value to -1 cancels it out visually, but does not affect the rest pose positions.
@TheMysteryIsThePoint
I did what you said. After that action, the clothes moved to the side. Or did I do it at the wrong time? Anyway, I did some experimenting. My temporary solution is to copy the garment and remove the armature modifier and all shapekeys from it.
I use the clothes with the armature only for previewing and disable them for rendering. I apply the necessary morphs to the clothes without the armature and enable them for rendering. It seems like a bit of a mess compared to Daz Studios, but... there you go.
Applying shapekeys on top of each other is unintuitive. If there are multiple shapekeys on a cloth and I create a new one from the morph, it works relative to the base shape, not the current resulting shape.
To fix this, I have to create a new shape from mix, leave its value =0, and then create a new shape from the morph. And you need to change its relativity from the basic shape to the mix shape. In general, I have to press a lot of buttons to get it to work.
Sorry, that's all I got :)
My workflow is to export an animated figure via Alembic with Sagan at base res, and import that into Marvelous designer. I simulate that and export the results to Blender via Alembic. I then import a higher res animation into Blender, again via Sagan, and lay it over the MD Alembic, and the results are always perfect.
I should point out that I haven't yet figured out how to retopo garments that are not native MD garments. There's got to be a way, but I haven't figured it out. Native MD garments are not a problem.