2
$\begingroup$

Blender has a Corrective Smooth modifier, which is nice. I’m building a character for realtime, so I can’t use it directly. But I figured I’d take advantage of it by using it to create corrective shapekeys. The modifier does have an “Apply as Shapekey” button after all, and it would be a good basis for further manual tweaking.

However, the button doesn’t seem to work.

For Corrective Smooth to do its thing it needs an Armature above it in the stack. However, with the Armature modifier there, it fails with an “Applied modifier was not first, the result may not be as expected” message.

So basically, how can you apply Corrective Smooth as a Shapekey? Is it just a completely useless button that can’t ever work, or is there something I'm overlooking?

$\endgroup$
2
  • $\begingroup$ It's not an error- just a warning message. You will find the shape keys here: docs.blender.org/manual/en/latest/animation/shape_keys/… . If I click on the "Apply as Shapekey" button (with an armature modifier above) the Blender creates a new shape key, but it is the same as the basis. I don't think this could be work. $\endgroup$
    – FFeller
    Commented May 28, 2019 at 19:32
  • $\begingroup$ That's what I mean by "fails". It doesn't do anything useful. $\endgroup$ Commented May 28, 2019 at 19:34

2 Answers 2

2
$\begingroup$

This is a quirk of how the Apply as Shapekey works. The mechanism is outside the specific modifier's logic.

Essentially when you click Apply as Shapekey blender takes the unmodified mesh and adds just the modifier that your are applying to the mesh, then uses the resulting shape. For corrective smooth, this means nothing happens, as corrective smooth needs other deformation in order to do anything.

There is however a workaround for this. Blender comes bundled with and addon called Corrective Shape Key which can generate a shape from the whole combined mesh as a corrective shape. To do this you need to first use the addon to create a duplicate for editing, and then disable the corrective smooth, and then add the dupe back as new shape using the addon's functionality to reverse transforms.

$\endgroup$
2
  • $\begingroup$ That's a nice reply, thanks, but not marking this as solved just yet because the addon doesn't seem like it works with 2.8 at the moment. $\endgroup$ Commented May 29, 2019 at 3:22
  • $\begingroup$ Thats annoying, I don't think there should be anything much in there that would make porting it hard. $\endgroup$
    – Sazerac
    Commented May 29, 2019 at 3:57
2
$\begingroup$

I needed to apply the whole modifier stack as shape keys as well. Here is how i did:

def create_shape_key_from_object_snapshot(self, context, obj, shape_name):

    def object_duplicate_flatten_modifiers(obj, shape_name):
        depth = context.evaluated_depsgraph_get()
        eobj = obj.evaluated_get(depth)
        mesh = bpy.data.meshes.new_from_object(eobj)
        name = shape_name
        new_object = bpy.data.objects.new(name, mesh)
        new_object.data = mesh
        bpy.context.collection.objects.link(new_object)
        return new_object

    #snapshot the mesh
    shape_obj = object_duplicate_flatten_modifiers(obj, shape_name)
    shape_obj.select_set(state = True)
    context.view_layer.objects.active = obj
    #create shapekey on object
    bpy.ops.object.join_shapes()
    #remove shape object
    bpy.data.objects.remove(shape_obj)

Maybe this will help someone. Basically the same way it was done in the corrective shape key addon. (https://developer.blender.org/T65258)

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .