60
SE 313 – Computer Graphics Lecture 14: Armatures Lecturer: Gazihan Alankuş 1

SE 313 – Computer Graphics

  • Upload
    altessa

  • View
    39

  • Download
    1

Embed Size (px)

DESCRIPTION

SE 313 – Computer Graphics. Lecture 14: Armatures Lecturer: Gazihan Alankuş. Today. Armatures and Bones Weight painting. Animations. We learned how to set keyframes for positions/orientations/scales for objects Well then, how would you animate something like this?. - PowerPoint PPT Presentation

Citation preview

Page 1: SE 313 – Computer Graphics

1

SE 313 – Computer Graphics

Lecture 14: ArmaturesLecturer: Gazihan Alankuş

Page 2: SE 313 – Computer Graphics

2

Today• Armatures and Bones• Weight painting

Page 3: SE 313 – Computer Graphics

3

Animations• We learned how to set keyframes for

positions/orientations/scales for objects• Well then, how would you animate something

like this?

Page 4: SE 313 – Computer Graphics

4

Animating Complex Meshes• Why is it difficult?

• There are so many vertices and edges. How are you going to manage their motions?

Page 5: SE 313 – Computer Graphics

5

Animating Complex Meshes• You need to be able to say “rotate your arm”

without having to deal with individual vertices.

• It also needs to know how to get back to how it was before

• How can we do all this?

Page 6: SE 313 – Computer Graphics

6

Idea• Our muscles move our bones, to which our

flesh is attached to

Page 7: SE 313 – Computer Graphics

7

Armatures• Similarly, we use a skeleton structure in computer

graphics• They are called armatures (or bones)• They are much simpler than actual skeletons

Page 8: SE 313 – Computer Graphics

8

How armatures work

• Remember the robot that you created?– Body parts formed a hierarchy

by parenting parts to each other

– Children were attached to parents and when parents moved children moved with them

• Similarly, armatures are created as a hierarchy of bones, like an actual skeleton.

Page 9: SE 313 – Computer Graphics

9

How armatures work

• However, the armature moves – Changes the relative

rotation between bones– Actually gets displaced

• The model needs to move accordingly– Different parts of the

model should follow different parts of the armature

– The model has to deform as a result

Page 10: SE 313 – Computer Graphics

10

How armatures work

• The armature has many bones

• We need to identify which parts of the model will follow which bones of the armature

Page 11: SE 313 – Computer Graphics

11

How armatures work

• We can identify parts of the model through weight painting.

• For each bone, you mark parts of the model with weight values

• When the bone moves, parts of the model will also move, proportional with their weights for that bone

Page 12: SE 313 – Computer Graphics

12

How armatures work• As a result, the model deforms in ways that

follows multiple bones.

Page 13: SE 313 – Computer Graphics

13

How armatures work• This way, we can animate the armature and

the complicated model will follow it• We don’t have to deal with individual vertices!

Page 14: SE 313 – Computer Graphics

14

Practice• Creating armatures in Blender• Using armatures to deform models– Using envelopes– Using auto-weighting– Through weight painting

Page 15: SE 313 – Computer Graphics

15

Creating armatures in Blender• Create a new scene and remove the cube• Create a single-bone armature using the menu

Page 16: SE 313 – Computer Graphics

16

Creating armatures in Blender• Now look at the different modes available

when we select the armature– We edit the armature’s details in edit mode– We move and animate the armature in pose mode

Page 17: SE 313 – Computer Graphics

17

Creating armatures in Blender• Now switch to edit

mode• Notice that there are

three parts of the armature that we can select– The root – The head – The tail

Page 18: SE 313 – Computer Graphics

18

Creating armatures in Blender• The root is not very important, it moves with

the head of the topmost bone• The head defines where the bone is attached

to. You rotate the head.• The tail is where the next bone can be

attached to. It also defines the length of the bone.

Page 19: SE 313 – Computer Graphics

19

Creating armatures in Blender• Now select any part of the bone

and click Extrude on the left• When you move the mouse now,

you see that you are adding a new bone. Click to position it.

• You can also add a new bone using Ctrl+click

Page 20: SE 313 – Computer Graphics

20

Creating armatures in Blender• You can create multiple branches by selecting

a middle bone and adding a new bone using Extrude or Ctrl+left click

Page 21: SE 313 – Computer Graphics

21

Creating armatures in Blender• In edit mode, you can move

heads and tails of bones as you wish.

• If you look at the Properties pane on the right, you see where they are located.

• As you move bones, you see their sizes change because the distance between the head and the tail changes. It’s ok.

Page 22: SE 313 – Computer Graphics

22

Creating armatures in Blender• When you go to Pose Mode, you can only

rotate these bones or move the whole armature using the root bone.

• This is how you will animate them

Page 23: SE 313 – Computer Graphics

23

Creating armatures in Blender• Just like animating other objects,

you set rotation keyframes using the I key and animate the armature in time

Page 24: SE 313 – Computer Graphics

24

Creating armatures in Blender• You can only rotate bones around their heads

and the heads seem to be attached to tails• You can make heads not attached to tails

Page 25: SE 313 – Computer Graphics

25

Creating armatures in Blender• To make a bone that is not

attached to parent’s tail– Select the bone in edit mode– Go to the Bone tab on the right– Uncheck Connected– Now you can move the head freely

Page 26: SE 313 – Computer Graphics

26

Creating armatures in Blender• However, they still rotate together when you

rotate the parent bone

Page 27: SE 313 – Computer Graphics

27

Creating armatures in Blender• When you switch between edit and pose

modes, you may notice that your armature takes on different poses

• This is because the edit mode shows the armature in its default pose

• You can select which pose you want to see in the object data tab

Page 28: SE 313 – Computer Graphics

28

Creating armatures in Blender• There, you can also change how the bones will

appear

Page 29: SE 313 – Computer Graphics

29

Creating armatures in Blender• Notice that when you render, bones don’t

show up (cube added to prove that the camera is looking at it)

• This is because bones are there only for deforming meshes, not for visual display

Page 30: SE 313 – Computer Graphics

30

Practice• Creating armatures in Blender• Using armatures to deform models– Using envelopes– Using auto-weighting– Through weight painting

Page 31: SE 313 – Computer Graphics

31

Preparing the armature and the model• Let’s create a simple armature and a model• Create a new blender scene, remove the cube

and add an armature

Page 32: SE 313 – Computer Graphics

32

Preparing the armature and the model• Add three more bones to the

armature vertically• To make them aligned vertically,

switch to front view before creating the bones

• In edit mode, use Extrude or Ctrl+click to create the three extra bones

Page 33: SE 313 – Computer Graphics

33

Preparing the armature and the model• Now, switch to object mode and lets add a

cube• Scale it down a bit to your liking

Page 34: SE 313 – Computer Graphics

34

Using armatures to deform models• Go to edit mode and select the

top face• Move it down to make the cube

shorter, then extrude many times so that we have a long box with many vertices

Page 35: SE 313 – Computer Graphics

35

Page 36: SE 313 – Computer Graphics

36

Using armatures to deform models• Now we can’t see the armature.

We will make it so that the armature is always visible

• Select the armature in the outliner

• Under the object data tab, select X-Ray

• Now the armature is always visible. You can select the armature after selecting the box.

Page 37: SE 313 – Computer Graphics

37

Using armatures to deform models• Now we want to try different ways of making

the armature deform the model. • This is why we want to save the current state

of our model so that we can go back to it.• Save it as initial.blend• Then save it again as

backup.blend in case you overwrite it!

Page 38: SE 313 – Computer Graphics

38

Method 1: Envelope weights• Select the cube and shift+select the armature

to select them both• Select parent with envelope weights

as shown below.• You will have to select it one more time…

Page 39: SE 313 – Computer Graphics

39

Method 1: Envelope weights• Now the cube should move with the bones,

but we did not set things up correctly, yet. • Try it by selecting the armature, going to pose

mode and rotating the root bone• You may or may not have some

vertices follow the bones

Page 40: SE 313 – Computer Graphics

40

Method 1: Envelope weights• We need to set envelopes correctly to

fix this• Go to edit mode and object data

tab• Select envelope under display• Now the bones look different. When

we select a bone, we see a white halo around it.

• This is its envelope. If the vertices are in this envelope, they will move with the bone.

Page 41: SE 313 – Computer Graphics

41

Method 1: Envelope weights• To modify these envelopes, go to the

properties pane and change the radius and envelope values

Page 42: SE 313 – Computer Graphics

42

Method 1: Envelope weights• Make sure envelopes are large

enough to completely cover the vertices

Page 43: SE 313 – Computer Graphics

43

Method 1: Envelope weights• Now go back to pose

mode and rotate the bones. If you see bad vertices, go back to edit mode and increase envelopes

Page 44: SE 313 – Computer Graphics

44

Method 1: Envelope weights• Save this as envelope.blend• Now we want to try another method• Open initial.blend that we saved before.

Page 45: SE 313 – Computer Graphics

45

Method 2: Automatic Weights• This is an easier way to set up weights

for the mesh• Select the cube and shift-select the

armature.

Page 46: SE 313 – Computer Graphics

46

Method 2: Automatic Weights• Set parent with Automatic Weights. You have

to select it again.

Page 47: SE 313 – Computer Graphics

47

Method 2: Automatic Weights• Now try pose mode. Wasn’t it easier?

Page 48: SE 313 – Computer Graphics

48

Method 3: Weight painting• We will learn one last method for cases in

which we want more control over the weighting.

• Re-open initial.blend again

Page 49: SE 313 – Computer Graphics

49

Method 3: Weight painting• Select the cube only and add an armature

modifier to it

Page 50: SE 313 – Computer Graphics

50

Method 3: Weight painting• Select our armature as the Object• If you try pose mode now, it

will not work. We need to tell Blender how this armature modifies the mesh– We will do this by painting weights

Page 51: SE 313 – Computer Graphics

51

Method 3: Weight painting• Now do these steps carefully and exactly• Go to pose mode• Select one of the bones• Select the cube• Go to weight paint mode

Page 52: SE 313 – Computer Graphics

52

Method 3: Weight painting• If you did the steps right, you

should see something like this (notice the active bone)

• Now you can paint the mesh to show which vertices will move with this bone

Page 53: SE 313 – Computer Graphics

53

Method 3: Weight painting• You can play with the weight and

strength values of the brush. You can also try turning on Spray

• Red parts are the most affected by the bone

Page 54: SE 313 – Computer Graphics

54

Method 3: Weight painting• Now when you select the armature and go to

pose mode, you will see that some of the vertices follow the bone.

Page 55: SE 313 – Computer Graphics

55

Method 3: Weight painting• Ideally, you want closest areas to be red and

the nearby areas to be green.• You can do this by painting a larger green with

a lower weight, and a smaller red in it with a higher weight

Page 56: SE 313 – Computer Graphics

56

Method 3: Weight painting• In the end, the four weight paints should look

something like this

Page 57: SE 313 – Computer Graphics

57

Method 3: Weight painting• Deforming this in the pose mode will be

similar to the other methods

Page 58: SE 313 – Computer Graphics

58

Method 3: Weight painting• You can also paint when you are in-pose to

add corrections

Page 59: SE 313 – Computer Graphics

59

Modifying weights from automatic weighting• When you do automatic weighting,

it automatically adds the armature modifier just like we did in manual weight painting.

• You can modify these weights just like you modify the weights that you created

Page 60: SE 313 – Computer Graphics

60

Lab• Create a T shape (optionally with a head)• Use automatic weights • Make its arms do a wave motion• (Bonus) do this using envelope or weight

painting