34
3D Computer Animation 박경주 박경주 2008.09.25 중앙대학교 첨단영상대학원

3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

  • Upload
    others

  • View
    16

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

3D Computer Animation

박경주박경주2008.09.25

중앙대학교 첨단영상대학원 박 경 주

Page 2: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

캐릭터 애니메이션캐릭터 애니메이션

중앙대학교 첨단영상대학원 박 경 주

Page 3: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

Kinematics & Inverse KinematicsKinematics & Inverse Kinematics

• Joints 위치는?• Joints 위치는?

중앙대학교 첨단영상대학원 박 경 주

Page 4: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

Kinematics & Inverse KinematicsKinematics & Inverse Kinematics

• Joints 위치는?• Joints 위치는?• Forward Kinematics

애니메이터가 든 j i 각 를 콘 를– 애니메이터가 모든 joint 각도를 콘트를

중앙대학교 첨단영상대학원 박 경 주

Page 5: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

Kinematics & Inverse KinematicsKinematics & Inverse Kinematics• Inverse KinematicsInverse Kinematics

– 위치 좌표를 이용하여 조인트 각도를 결정– 예) 발을 이 위치에 놓기 위한 힙, 무릎, 발 파라미터를 계산– 인터랙션에 적합– 대부분 underdetermined (즉, 주어진 결과에 도달할 수 있는

joint 각도의 조합이 여러 가지)joint 각도의 조합이 여러 가지)

중앙대학교 첨단영상대학원 박 경 주

Page 6: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

Why Inverse Kinematics?Why Inverse Kinematics?

l• Environmental interactions– 물체를 잡는 액션, 발을 땅에 닫게 하는 액션

Forward kinematics 로는 어려움– Forward kinematics 로는 어려움

• 캐릭터의 포즈는– the joint angle space에서 정의 되어있음– the joint angle space에서 정의 되어있음

• The environmental interaction은– Cartesian 좌표계에서 정의되어 있음Cartesian 좌표계에서 정의되어 있음

중앙대학교 첨단영상대학원 박 경 주

Page 7: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

Inverse Kinematics 예제Inverse Kinematics 예제

• 2차원에서의 간단한 robot arm – 두 개의 revolute joints– end-effector 의 포지션 (Xe, Ye) 는 알려져 있음– Joint 각도를 계산

중앙대학교 첨단영상대학원 박 경 주

Page 8: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

예제의 Analytic Solution은?예제의 Analytic Solution은?

중앙대학교 첨단영상대학원 박 경 주

Page 9: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

Redundancy in Human ArmsRedundancy in Human Arms

중앙대학교 첨단영상대학원 박 경 주

Page 10: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

Why so difficult to get a closed-y gform solution?

R d d i• Redundancies– 여러 개의 해답(미지수의 개수 > equation 개수)

• Joint limit• Joint limit– 각 미지수의 범위가 정해져 있음 (bounded)

• Reachable workspaceReachable workspace– 해답 없음– 단일 해답– 여러 개의 해답

• Multiple goalsF li b h t i t i lt l– Four limbs may have constraints simultaneously

– Intermediate links can also be constrained

중앙대학교 첨단영상대학원 박 경 주

Page 11: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

예제의 Iterative 솔루션은?예제의 Iterative 솔루션은?

• 모든 joint 들을 반복과정을 거쳐 목표달성– 미세한 joint 각도 차이를 고려하면,미세한 jo t 각도 차이를 려하면,

중앙대학교 첨단영상대학원 박 경 주

Page 12: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

예제의 Iterative 솔루션은?예제의 Iterative 솔루션은?

• Forward Kinematics Map의 Jacobian 을 이용Forward Kinematics Map의 Jacobian 을 이용• Forward Kinematics Map

• Jacobian

중앙대학교 첨단영상대학원 박 경 주

Page 13: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

예제의 Iterative 솔루션은?예제의 Iterative 솔루션은?

• Jacobian 의 inverse 를 계산 가능

중앙대학교 첨단영상대학원 박 경 주

Page 14: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

A System of Linear EquationsA System of Linear Equations

• 미지수 개수= the dimension of• Equation 개수= the dimension of• J is a (m x n) matrix( )

• 만약 m 과 n이 동일하여 유일한 해답만약 과 이 동일하여 유일한 해답• The linear system 은 under-specified if m < n• The linear system 은 over-specified if m>n y 은 p

중앙대학교 첨단영상대학원 박 경 주

Page 15: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

Linear and Angular Velocities in 3DLinear and Angular Velocities in 3D

• Velocity of a point due to rotating joints

중앙대학교 첨단영상대학원 박 경 주

Page 16: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

Jacobian in 3DJacobian in 3D

• A serial chain with n revolute joints

중앙대학교 첨단영상대학원 박 경 주

Page 17: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

RedundancyRedundancy

여러 개의 해답 중 단 하나의 해답을 선택• 여러 개의 해답 중 단 하나의 해답을 선택– 현재 조건에 “Closest”

• Pseudo inverse joint 각도 변화율을 최소화• Pseudo inverse joint 각도 변화율을 최소화– 제일 바깥 쪽 links 를 움직임

• 제일 바깥 쪽 link가 최소 지역을 sweeps(시각적 변화)제일 바깥 쪽 가 최 지역을 p (시각적 변화)– 최소 시간

• Dynamics 를 고려둘째 목 를 둠– 둘째 목표를 둠

• 추가적인 constraints자연스럽게 보임– 자연스럽게 보임

• Biomechanical 실험

중앙대학교 첨단영상대학원 박 경 주

Page 18: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

IK can be ill conditionedIK can be ill-conditioned

h d ff 의 마한 변화 각 의 엄청난• the end-effector의 조그마한 변화도 joint 각도의 엄청난변화로 이어질 수 있음

중앙대학교 첨단영상대학원 박 경 주

Page 19: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

SingularitySingularity

l h k f h b h• Singularities cause the rank of the Jacobian to change• Often ill-conditioned near singularities

중앙대학교 첨단영상대학원 박 경 주

Page 20: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

Iterative Method Using JacobianIterative Method Using Jacobian

• Jacobian 은 각 time 스텝마다 계산되어져야 함야 함

간단한 E l i i 사용• 간단한 Euler integration 사용

• Jacobian 의 Singularity는 numerical한 불안정을 야기할 수 있음안정을 야기할 수 있음

중앙대학교 첨단영상대학원 박 경 주

Page 21: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

비선형 최적화(Non Linear Optimization)비선형 최적화(Non-Linear Optimization)

비선형 프로그래밍• 비선형 프로그래밍– 비선형 함수의 최소값(local) 을 찾기 위한

Numerical methodNumerical method • IK를 풀기 위한 최적의 방법• 하지만 자연스럽게 보이지 않을 수도 있음• 하지만, 자연스럽게 보이지 않을 수도 있음• 여러 가지의 목표가 쉽게 다루어 질 수 있음

• We need to defineObj ti f ti 예) 손을 특별한 위치에 놓음– Objective function: 예) 손을 특별한 위치에 놓음

– Constraints: 예) joint 의 범위 제한

중앙대학교 첨단영상대학원 박 경 주

Page 22: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

Objective FunctionObjective Function

• Position

• Orientation

• Direction• Direction

중앙대학교 첨단영상대학원 박 경 주

Page 23: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

Constrained OptimizationConstrained Optimization

• Formulate

• standard numerical technique• standard numerical technique– Gradient decent– Conjugate gradient– Sequential quadratic programming

중앙대학교 첨단영상대학원 박 경 주

q q p g g

Page 24: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

Basic Idea of Numerical TechniquesBasic Idea of Numerical Techniques

• Pseudoinverse + Euler integration– 일정한 time step일정한 t e step

중앙대학교 첨단영상대학원 박 경 주

Page 25: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

Basic Idea of Numerical TechniquesBasic Idea of Numerical Techniques

• 방향 선택 + 선을 최소화– Least squareseast squa es– Gradient

Conjugate gradient– Conjugate gradient

중앙대학교 첨단영상대학원 박 경 주

Page 26: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

Quick and DirtyQuick and Dirty

• Cyclic coordinate decent– Joint 들 중 몇몇 개의 subset 을 만족하도록 문제를

다시 놓고 해결– 작용하지 않으면, joint 를 추가

• Jacobian transpose method– Jacobian 의 pseudoinverse 대신에 transpose을 사용– least-squares 을 보장하지 않으q

중앙대학교 첨단영상대학원 박 경 주

Page 27: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

Hybrid ApproachHybrid Approach

d l ll l l• Arms and legs allow analytic solutions– Redundancy can be parameterized by elbow

circlescircles

• Reduced-coordinate formulation– We can replace 7 dof for each limb by a

single elbow circle parameterH b id f l i ( i l l i l)– Hybrid formulation(numerical + analytical)

– The numerical optimization can be done with fewer number of parametersp

중앙대학교 첨단영상대학원 박 경 주

Page 28: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

Data Driven ApproachData-Driven Approach

IK i d d i d• IK is underdetermined– Many possible poses satisfy constraints– Some poses more likely than others– The likelihood poses depends on the body p p y

shape and style of the individual person

• Data-driven IKD i th lik lih d f ti f h– Drive the likelihood function from human motion data

중앙대학교 첨단영상대학원 박 경 주

Page 29: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

SummarySummary

l ll l l• Very simple structure allows an analytic solution

• Most of complex articulated figures requires a numerical solution

• May not always get the “right” answerN d t t k th l ti l t– Need to tweak the solution later

중앙대학교 첨단영상대학원 박 경 주

Page 30: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

IK 실습IK 실습

• 캐릭터의 skeleton hierarchy 를 만든 후, 워킹 애니메이션워킹 애니메이션

• GettingStartedWithMaya Ch 6 l 5– Ch.6 lesson 5

– Ch.7 lesson 1

중앙대학교 첨단영상대학원 박 경 주

Page 31: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

Walk Cycle: Figure Dynamics

The passing position is the frame whereby the leg moving forward in the cycle passes the leg that supports the body. Figure가 passing position 에 있을 때, figure 는 한 다리로 균형을 잡고 있다. p 에 때 g 다리 다

왼다리가 앞으로 thrown 할 때, 왼팔은 뒤로 가고 오른팔은 앞으로 간다.

Figure 가 passing position에 있을 때 지탱하는 다리가 똑바로 서면서figure 는 살짝 들린다.

이 두 i i id 와 i i i 을 lk l 의 기본임

중앙대학교 첨단영상대학원 박 경 주

이 두 position – stride 와 passing position 을 walk cycle의 기본임

Page 32: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

Walk Cycle: Keys & Inbetweens

1 3 5 7 9 11 131,…,13 키프레임1 stride7 passing position13 stride

한 사이클에 해당하는 모든 drawing 을 가지고 있으면, 몸의 높낮이가 어떻게 오르락 내리락 하는지 쉽게 알 수 있음. Passing position 에서 지탱하는 다리가 펴짐에 따라서 머리와 힙의 위치가position 에서 지탱하는 다리가 펴짐에 따라서 머리와 힙의 위치가올라간다. 그리고 나서, figure 는 stride 도중에 아래로 내려가는데, 다리 joint 앵글의 변화 때문임

중앙대학교 첨단영상대학원 박 경 주

Page 33: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

Walk Cycle - Front View

We can see in this illustration of the figure viewed head-on that the figure twists at the hips and the shoulders through-out the walk cycle and the counter-rotation of the hips and shoulders. The right shoulder is in a forward position when h i h id f h hi i i b k d i ithe right side of the hip is in a backward position.

중앙대학교 첨단영상대학원 박 경 주

Page 34: 3D Computer Animation - CAUcau.ac.kr/~kjpark/courses/2008_2_ca/Lec4.pdf · Kinematics&InverseKinematicsKinematics & Inverse Kinematics • InverseKinematicsInverse Kinematics –

Timing a Walk

Slow out Slow in

The stride speeds up as it goes through the passing positionThe stride speeds up as it goes through the passing position

The more drawings or frames you have within the walk cycle, the slower the walk will be. As the walk becomes slower, the length of stride will shorten. Conversely, if the length of the stride remains short and the speed of the walk becomes fast, you will get a very strange kind of fluttering or shuffling type of walk

중앙대학교 첨단영상대학원 박 경 주