Shape keys and lattices

Hi,

I’ve looked all over for up-to-date tutorials covering animation with lattice deformations and shape keys, but I just can’t get going.

I have a mesh parented to a lattice. I basically want to animate this mesh inflating like a balloon.

I need to know what order things should be applied, and how the shape keys relate to the lattice. If I deform the mesh with the lattice and try to animate with shape keys, the lattice stays un-animated, so nothing changes, if I try to animate the lattice, well, I haven’t managed to get this to work either.

I’d be very grateful if anybody could point me in the right direction.

Thanks,

Tony

With Lattice selected hit I and choose ‘Lattice’. In F9 in the Lattice tab you can choose to use Relative or Absolute keys.

%<

Hmmm, you’ve got me confused but see if this helps.

Since you say “shape keys” I’ll assume you’re talking 2.4 (They were RVK/AVK before and little has really changed other than the way you work with them). Shape keys and lattice deform are quite different things.

To use lattice deform, you either:

Parent the object to lattice (select object then lattice. CTRL P > Lattice deform)You can use the parent method then go to the “Lattice parent deform” that appears in the modifers panel and press “make real” to make this a modifier or,

Don’t parent the objects. Just select the object (not the lattice) and apply a modifier:
OB: Lattice (or whatever your lattice Object name is) Note: This method doesn’t always work for me.

Note also that your object deforms more predictably if it is contained within the lattice.

To animate this you animate only the lattice. Add a key at frame 1: LocRotSize, then advance to frame 11, move the lattice (the object moves with it), resize it, rotate it and add another key: LocRotSize. Play the animation. The object does eveything the lattice does. You can even put the lattice on a separate layer so you can hide it while viewing the viewport animation.

You can also animate the object independently of the lattice too and this is where shape keys (among other things) could come in useful.

Go back to frame one. In Object mode, select the object (not the lattice) and activate the “shapes” panel (F9>shapes). Choose “Add Shape Key”. This sets a “Basis Key”, essentially a “rest pose” for shapes.

Then choose “Add Shape Key” again and you have “Key 1” available (you can rename it). Go into Edit mode. Grab a vertex or two and move them to deform the object. Go back into Object mode - the object returns to basis shape but Blender has stored the deformation in Key 1.

While on frame one and with Key 1 still active, grab the slider underneath the key and drag it forwards to 1.00, the shape deforms. Advance 10 frames and drag it back to 0.00 the shape returns to normal. Now play the animation. The shape will start deformed and return to normal… If you still have your lattice animation happening then your object should move, resize, rotate and deform all at the same time.

Complex shape deformations (such as facial movements and lip sync) are made using multiple shape keys, each key affecting one facial part (mouth_left_up, mouth_right_up, mouth_ top…, mouth_bottom… etc). Shapes can be applied over each other and Blender will calculate a result for any keys that compete for the same vertices.

I don’t know if there’s a way to make the lattice deformations into shape keys - I doubt it unless it can be scripted. In another thread I said that I didn’t think AVK was in the new release but I see shape keys have a “relative” button on by default. I guess if you turn this off you get AVKs (I’ve never used AVK so I can’t say much about it).

Hope this clarifies a little.

Technically, you should be able to set shape keys on a Lattice. However, there’s currently no Shapes panel for Lattice objects, so you’re limited to the interface that Fligh pointed out.

Ahhh, applying shape keys to the lattice. I didn’t read it that way.

Thanks everybody. This should be a big help. I had originally tried animating the lattice only, but for some reason I wasn’t getting it working. I’ll start again from the beginning. I’d then decided to use shape keys (on the mesh) to get the same effect, since it was a simple deform I was after. But in order to put the object into the shape I wanted to key, the lattice deform is what I wanted.

So back to trying to animate the lattice deform, and forget about shape keys for the moment. The comments here will be helpful. Thanks again.

t

I’m really not getting anywhere. Here’s a blend, if somebody could look at it and tell me what step I should take next.

When you open the blend, you should find the lattice I’m trying to animate in edit mode. I’ve got it scrunched up the way I want it to start.

If I try to keyframe this as is, hitting IKEY and “Lattice” I don’t see anything happen in the NLA window in the Lattice opject channel. Should I? Did anything get keyed anywhere?

Also, if I then tab out into object mode, my lattice pops into its undeformed shape. I don’t see why this should be. In this mode also, clicking IKEY > Lattice doesn’t do anything that I can see.

I don’t seem to be able to upload the blend file right now. I’ll edit the link in when I manage to get it up.

Thanks,

T

<edit>
Still not able to upload the file to either of the regular file hosting spots. If anybody thinks they can help and would like to see the blend, please pm me and I’ll mail it. thx

If all you’re trying to do is expand the lattice for a “grow” effect, then don’t choose “Lattice” key, just use a Size Key as if it were just any other object.

Squash it to size on frame 1. Then IKEY>Size. Then advance the frames and expand your lattice to full size then IKEY>Size again. That’s it.

Using the “Lattice” key is more like using RVKs (Shapes). As this is a “Shape” key it doesn’t work if you just resize the lattice in OBJECT mode. Shape keys have to be added in OBJECT Mode but created in EDIT mode as they are mesh-deformations, not object deformations. It sounds awkward - and it is - that’s why the new method was implemented for object shape keys.

For a simple expand, I recommend you use the first method (Ikey>Size) but if you want to deform in weird ways then start with an undeformed lattice in OBJECT Mode, then IKEY>Lattice, click “Relative” button (F9 Panel) then Hit IKEY again then enter EDIT mode and grab some vertices and deform the lattice. When you exit EDIT mode the lattice will return to normal but a key will be added to the Action Window with a slider.

For each shape key you want to add, Press IKEY in OBJECT mode, then immediately enter EDIT mode, deform the lattice, then exit EDIT mode to set the key.

Now on frame one, slide a key slider. Then advance frames and slide it back or forward or slide the other slider if you made two keys. Then animate. I haven’t used lattice keys before but this is the same way RVKs worked and my quick test worked okay (The “Slurph” slider adds a time delay to the keyframes - though I don’t know why :slight_smile: ). Old doc tutorials on RVKs should help with most of this as the method is almost identical.

Editing the Lattice Shape keys after you’ve made them is a whole different story :wink:

If all you’re trying to do is expand the lattice for a “grow” effect, then don’t choose “Lattice” key, just use a Size Key as if it were just any other object.

Good point. This isn’t quite what I’m going for, I’d like a much cartoonier deformation and ballooning, if I can get it. So lattice is definitely the tool I think I want to use… but failing that simply resizing the thing tiny would actually be a quick fix, given that the whole expansion only takes a few frames… Who’s gonna notice? And it would be better than no change at all.

but if you want to deform in weird ways then start with an undeformed lattice in OBJECT Mode, then IKEY>Lattice, click “Relative” button (F9 Panel) then Hit IKEY again then enter EDIT mode and grab some vertices and deform the lattice. When you exit EDIT mode the lattice will return to normal but a key will be added to the Action Window with a slider.

For each shape key you want to add, Press IKEY in OBJECT mode, then immediately enter EDIT mode, deform the lattice, then exit EDIT mode to set the key.

Aha… I haven’t tried it yet but this is starting to look like the kind of arcane knowledge I was hoping for! I’ve got a good feeling about this. IKEY in object mode, make change in edit mode, back to objec modet… Good grief. But now that you mention it, it sounds familiar. Thanks very much! I’ll report back when I try it.

T

Well, I made a little progress. I managed to make some sliders which would work on the lattice themselves, but I was not able to key them into the action window properly… well, I could key them, but I didn’t get the animation results I expected. At the moment the sliders all look right but when I animate it just goes through the whole animation in whatever shape it was in last, and seems to ignore the keys. I need to experiment more, I guess. So here are some specific questions

a) How do two slider channels interact when they have conflicting vertex location information? Does Blender compute some kind of halfway point or does it depend on which channel is on top of the other? I couldn’t see how to rearrange the order of the channels.

b) How can I delete channels? I can get rid of Actions by getting rid of the fake user, but channels within actions I don’t know how to get rid of. I have a bunch of unused sliders cluttering up my action and I want to get rid of them.

c) What’s the meaning of the “Basis” slider? I guess Basis represents the original shape of the lattice, but why a slider? 0 and 1 seem to be the same shape.

Sorry for being so slow to catch on. If I ever do fully get my head around this I will try to write a tutorial on it.

A Basis slider??? Noooooo!!! :slight_smile:

Hmmm, there shouldn’t be a basis slider. There could be a basis IPO, but no slider. So let’s try this:

Start with a new scene with just a cube in top view and the cursor at the centre. Add a Lattice. Resize the Lattice up so it is about 10-20% bigger than the cube (just enough to work comfortably with it). You can set the cube to deform if you wish but it doesn’t matter for the exercise.

Arrange your windows so you can see a Buttons window, an Action window and an IPO window with “SHAPE” selected in the drop-down menu - or you can switch between windows as we go if you need space.

Now, on Frame 1, with the Lattice still selected in Object mode, Press IKEY, choose Lattice. A Basis Key should appear in your IPO window with one flat orange line and a pink spline curve that does, errr, something ;).

In your Edit Panel (F9) press the “Relative” button and the word “Sliders” should appear in the Action window (The word "Basis seems to disappear from the IPO window - don’t ask! :slight_smile: ). You’ve just set your basis key.

Now, advance 10 frames (not too important but bear with me) and press IKEY again - choose Lattice. A blue line appears in the IPO window with a Key 1 label and a Key 1 slider appears in the Action window.

Tab into Edit mode. Grab one vertex on your lattice and drag it out to a point. Tab back into Object mode. You’ve set your first real key but nothing happens yet.

Advance 10 frames again and press IKEY > Lattice. Tab into Edit mode, grab a different vertex and drag it in or out somewhere. Tab back to Object Mode. That’s 2 keys. You should now have 2 sliders in the Action window and in the IPO window there should be one orange line and two blue lines (These are spaced vertically because we changed frames before keying. If we hadn’t, they’d be on top of each other which is a bugger to deal with).

Now we animate. Go to frame 1 (Shift-Left Arrow) and to the Action Window. We want the Lattice to start in the basis position. I like to do this by clicking on the slider for each key and make sure it’s on zero. Each click should set a key at frame 1. Now advance 10 frames and slide Key 1 to 1.00 and Click Key 2 to set 0.00 again. This forces Key 2 to remain unmoved while Key 1 deforms fully at this frame. Then advance 10 frames again, Slide Key 1 back to zero and Key 2 to 1.00. Then 10 more frames and slide Key 2 to zero.

Some of the above is redundant but you can delete redundant keys later. The important thing is that you have to set keys to zero to unset them and any key will immediately begin transforming from one key to the next, even if the next key is 1000 frames away and that’s why it’s often necessary to set a zero key (or duplicate a previous key) at certain points to prevent changes starting too early.

Keys can be dragged or duplicated (Shift-D) and dragged into other positions.

Your IPO window should now have curves showing full deforms at the appropriate key positions. If you edit one it will change the slider values.

Your animation should now play with the lattice starting undeformed then one point will extend then, as this point returns to basis, the other point will extend then return to normal.

If you set your cube to deform with your lattice, then it will animate too.

For a “boingy” sort of expansion, you could probably combine this sort of shape-key deformation with a simple Size Key expansion.

As for multiple keys, Blender does an averaging of keys on common vertices. This is great when you want someone to smile and talk at the same time.

See how you go with all that.

EDIT: More info about the lines in the IPO window… If you click on the top key in the list (mines now labelled “----”) you will see your blue and orange lines. If you select one of the blue lines, you’ll see your lattice deform to that key shape. If you now enter Edit mode you can edit this shape and when you exit Edit mode, it will store the new deformation in that shape key.

If you delete (XKEY) that blue line, you will delete the key. If your blue lines are all on top of each other, this is difficult. NOTE: If you rearrange the blue lines it will look like you’ve rearranged the keys but you haven’t - you’ve only rearranged the labels and I don’t advise it. I don’t know if you can rearrange the keys in the action window. /EDIT

Hi,

Thanks very much for the detailed walkthrough. That helped a lot. One thing was that I had not been looking at the shape IPOs as I’d been working before, and it helps.

At the moment, in the animation I’m working on, I’ve got an action with four shape IPO curves corresponding to four sliders, and no ‘—’ curve at all. I don’t know how I got into this state. I think having no ‘—’ might be part of why things aren’t working as advertised. I’d like to start over on this lattice with a clean slate and follow the steps you described. So how can I get rid of all these sliders and channels and start fresh?

I can’t just make a new blank action either, as I neglected to keep a blank action around to duplicate. All my actions have stuff in them now, and “NEW ACTION” simply creates a new duplicate of the current action. So I really need to be able to delete channels/keys/everything.

Thanks again for taking the time to give me such a thorough description.

T

Also, in the example you gave, is there any meaningful numerical relationship between the horizontal lines (I think correctly called “shape keys”) and the yellow/orange curves (shape IPOs)? That is, does their intersection represent anything? I think that the intersection of the shape key with the basis IPO would mean that at that point in time that shape should apply… In some “basis” situation? Although I’m very hazy on what the Basis IPO really represents. But what it means for the IPOs to intersect the shape key I don’t know at all.

Maybe I’m trying too hard with this stuff, but the fact that my animation isn’t working yet tells me that I clearly don’t understand things well enough…

Thanks again for all the replies,

T

<edit>
Apologies for successive posting. I’ll use the edit button in the future.

It’s a bit hard to “see” what you’re doing but Actions, as such, don’t really come into it. As far as I’m aware, “New Action” is for making and storing armature actions. I also noticed a small “Action” figure button next to the “Shapes” pop-up menu in the IPO window. Frankly, I don’t know what it does but mine isn’t pressed.

In your IPO window, what is the very top key called (in the list on the right, under the pin)? Mine was called Basis until I pressed the Relative buttoin, then it changed to ----. Note, this may not be correct behaviour. (I’m picking a lot of this up as I go and relying on what I learned aboput RVKs in 2.37)

In the IPO window, the coloured curves (the bezier curves) represent relative deformation at a given frame. If you select a key from the list, it’s curve will display and will rise to 1.00 where you’ve set a Key=1.00 with your sliders. So, while your Action window will show where each key is set, the IPO curve will show you the full range of transitions occurring throughout the animation. This can sometimes make it easier to spot why a deformation isn’t as you might expect at a given frame.

As for deleting actions, if you’ve been making them using “New Action”, then you probably just need to press the X next to the pop-up list for each one. You probably will also have to go into the datablock browser (Shift-F4), go to the root directory (…) open the Actions directory, select each action you don’t want and and press “F” to remove the fake user. Your Actions should now (I think) have a 0 against them in the browser window and the Actions pop-up list in the Action window. This indicates they are unused.

Save your file (give it a new name coz I don’t want to be responsible for stuffing your file up). Close the file and re-open it. Hopefully the actions have gone. Any key sliders you might have (if they didn’t get trashed too) should be removable by slecting their blue lines in the IPO>Shapes window and deleting those lines.

I wrote most of the above from memory and it isn’t something I do a lot so “buyer beware”.

You don’t need to “make” new Actions for your Lattice Shape Keys but when you do need a new Action (usually for bones) oyu can create a blank one by just selecting all the keys in a new Action and deleting them. Rename this Action “Blank” and then create all new actions from this (again, I haven’t done this much but I thinkit’s how I did it when I had to).

I wouldn’t worry too much about the Basis IPO. It basically just stores the undeformed data for your Lattice. When you select the basis key in the IPO window, it gives you access to those blue lines so you can edit the keys. If you still have a slider for it though, then you’ve somehow made it an active key and then I really can’t tell you what it’s doing :-?

Go through my earlier procedure a couple of times (from memory) and try to make more complex deformations with it until you get the hang of what’s going on. Start with a new file each time.

If you’re still struggling, you may need to post a blend so someone can reverse-engineer it for you.

Hi,

Thanks very much. I am having some trouble that is either a result of having gotten myself into some weird state or else maybe I’m seeing some buggy behavior. I think I should be able to delete channels in the action editor with the x key, but that’s not happening (so making a blank action editor window isn’t working for me). I can delete keys, but the channels themselves don’t seem to want to go anywhere.

I really would be very grateful if I could show you the blend I’m working on. I’ve got one cued up to exactly the place where I think a deform should be happening, but isn’t. Unfortunately I am still having my files rejected by the two host sites which take blend files. Is there a mail address I could send the file for you to take a look at? Alternately I could pm you a link to it at yousendit.com. I’ve been asked not to post links there because some people have had adware problems with that site, but I haven’t had any problems there. The file’s about 5mb.

Thanks very much,

T

I’ve pm’d you an email address to try.

Deleting actions is frustrating but not too difficult. First, go through the actions pop-up menu and for any action that doesn’t have a zero next to it, press the X-button (not XKEY but the small button next to the menu) to delete the link between that action and your object.

If you’re happy to trash every action in your file then the databrowser is the quick and easy way. As mentioned earlier, press Shift-F4 to open the databrowser (like the file browser). Open the root directory by clicking the “…” directory. From here all your data directories should be listed. Choose the Action directory and all your actions will be listed showing how many users each has. They should all just show an “F” as they aren’t really being used at all.

Select all the actions (AKEY) then FKEY to delete the Fake User tag. All actions should now have a zero next to them. The actions won’t go away though until you close and re-open your file.

I’ve managed to upload the blend file here

http://z08.zupload.com/download.php?file=getfile&filepath=20169

I’ve mailed it to AndyD, but if anybody else is interested in taking a look a this truly puzzling situation, I’d be very grateful.

The sliders are made and work properly, they are keyed, the ipos all seem to look as they should, but when the animation is played it simply disregards the ipos and the lattice does not deform. It might have something to do with NLA-mode vs Action-mode, but I’ve fiddled around with that stuff with no luck so far.

Thanks very much,

T

Just to tie this thread up for those who were wondering, with AndyD’s help the issue has been sorted out. The main problem seemed to be that I had set these keys up within the context of a specific named action. When I deleted that action and worked with the keys in the action editor but without any action name in the dropdown, the animation worked fine. I can’t say I entirely understand the design there, but I think I’ve figured out how to work with it.

Thanks,

t

The purpose of a named Action is to store a “set” of armature keys spanning a number of frames but which can be played and replayed in the NLA at any time for a consistent, repeatable result each time. You knew that of course, since that’s how you animated the cowboys.

Now get this, I just did another quick test using a “named Action” for a lattice shape and found it could be dropped in the NLA and would play IF the Action button in the IPO window is pressed (You may need to hold your tongue out and lift one foot off the floor to get it to work though :slight_smile: ) So I suppose you could set up a complicated collection of shape keys and save these as an Action after all. (I told you I was still learning :expressionless: )

The plot thickens…