3 D Game Engine Design Chapter 9 Animation












![Key frame animation의 예 [그림 C] [그림 D] 13 Key frame animation의 예 [그림 C] [그림 D] 13](https://slidetodoc.com/presentation_image_h/2be3112c4d28917922bd600c4acbd7cc/image-13.jpg)

- Slides: 14
3 D Game Engine Design Chapter 9. Animation of Character 1. Key Frame Animation 이민정 1
Animation of Characters u Animation • Scene graph에서 어떤 시간이 바뀌는 양을 제어하는 과정으로써 표현 • Character animation은 위치와 오리엔테이션 을 바꿈 u Animation of character의 두 가지 표준 • Key frame animation • Inverse kinematics 2
Key frame animation • character의 다양한 포즈를 만들기 위해 사용 • Interpolation의 사용 u Key frame(각 포즈)들 사이를 시간에 따라 포즈 계산 u 매끄러운 animation구현을 위해 quaternion의 interpolation을 이용 • Interpolating을 위한 방법 u Local translation • Kochanek-Bartels spline(7. 3. 4) • easy u Local Rotation : in this chapter • difficult 3
Linear Interpolation u lerp(t, q 0, q 1) = (1 -t)q 0 + tq 1 = t(q 1 – q 0) + q 0 u 장점 • 빠른 속도 [ 그림 1 lerp] • 짧은 interpolation에서는 좋은 효과 u 단점 • Linear interpolation은 magnitude를 보존하지 않음. • 매끄러운 animation 구현이 힘듦. • spherical linear interpolation을 사용 4
Spherical Linear Interpolation u u 단위quaternion은 4차원 hypersphere상의 점을 정의 매끄러운 애니메이션은 q 0, q 1을 잇는 대호에 따라서 값 들을 interpolation함으로써 이룸(그림 2) q 0 q 1 [그림 2]spherical linear interpolation 5
두 quaternion에 대한 slerp • spline interpolation을 유도할 때 쓰이는 멱함수 형태의 Slerp와 그의 도함수 u Slerp(t, q 0 , q 1) = q 0 (q 0 – 1 q 1 ) t [수식 2 참고] u Slerp’(t, q 0 , q 1) = q 0 (q 0 – 1 q 1 ) t log ( q 0 – 1 q 1 ) • Extra spins interpolation 9
Spline interpolation of Quaternions u N개의 quaternion들의 수열 • {qn, an , bn } (n=0, 1, 2, … N-1) u 모든n에 대하여 Sn’(0)=Sn-1’(1)이 되게 하는 {an, bn}을 찾는다. u Interpolation은 다음과 같이 이루어지게 된다. • Sn(t) = squad(t, qn+1 , an , bn+1) u [수식 3 참고] 매끄러운 interpolation 결과를 얻기 위한 an, bn은 다음 과 같다. • an = bn = qn exp[-(log(qn-1) + log(qn-1 qn+1) ) / 4] 12
Key frame animation의 예 [그림 C] [그림 D] 13
Updating a Key Frame Node u Key frame에 사용되는 node • local translation : Kochanek-Bartels spline or linear interpolation • local rotation : slerp or squad u Pseudocode void Key. Frame. Controller: : Update (float time) { Interpolate. Translation(time, local. Translate); Interpolate. Rotation(time, local. Rotate); } u Controller의 update는 world transform의 계산 전에 불림 14