본문 바로가기
Computer Science/Computer Graphics

Character Animation, BVH Format

by Gofo 2021. 6. 1.

Cel Animation

과거 computer animation과 관련된 기술이 발전하기 전에는 손으로 한장한장 그려서 연결하였다.

이를 hand-drawn cel animation이라 한다.

hand-drawn cel animation (출처 : https://www.wnyc.org/story/sideshow-classic-disney-pencil-animations-come-life-gifs/)

 


Computer Animation

현재는 labor-intensive animation process은 컴퓨터가 수행한다.

즉, keyframe 사이의 중간 과정들은 자연스럽게 보여질 수 있도록 컴퓨터가 연산한다.

과거의 방식에 비해 수정이 훨씬 편하다.

 

다음과 같은 approache가 있다. (실제는 더 많이 존재)

  • Key frame Animation
  • Motion Capture
  • Data-Driven Animation
  • Physics-Based Animation

 

Key frame Animation

Computer animation의 초기 방법 중 하나이다.

 

사람은 key frame 마다 event를 지정하고, 나머지는 컴퓨터가 알아서 interpolation(slerp 등)을 통해서 채운다.

지정하는 event는 다음과 같은 것들이 될 수 있다.

  • position and orientation of objects
  • color
  • light intensity
  • camera parameters(properties)

 

  • 단점
    • Realistic하고 physically plausible (물리적으로 사실적인) 결과물을 얻기 힘들다.
    • 각 key frame의 event를 지정하는 것이 어렵고, key frame이 많이 필요하기 때문이다.
    • 따라서 animator의 숙련도에 따라 결과물의 질이 많이 차이난다.
  • 장점
    • 좋은 품질을 얻기는 힘들지만, 방법 자체는 간단하다.
    • 또한 비용적으로 비교적 저렴하기 때문에 요즘도 많이 사용된다.

 

Motion Capture

현실적인 animation을 만들기 위해 실제 사람의 움직임을 사용한다.

Motion capture system은 사람이나 사물의 움직임을 capture 한다.

  • 피부의 각 marker을 붙이고 각 marker의 position을 capture
  • 각 body part나 joint의 position이나 orientation을 capture

 

  • 단점
    • 사람마다 관절의 위치와 구조가 다르다. → marker를 사람마다 다르게 붙여야 한다.
    • 카메라 각도 상 marker가 서로 겹치는 것을 방지하기 위해 여러 대의 카메라와 후처리 과정을 거쳐야 한다.
    • 장비의 가격과 operating cost가 비싸기 때문에 비용적으로 부담이 크다.
    • 한계가 존재한다.
      • 캡쳐하는 공간의 환경이 컴퓨터 안의 가상적인 환경과 동일해야지만 사실적이다.
      • 예 : 컴퓨터 안에서는 등산을 하는 모습이지만, 캡쳐 공간은 평지라면 사실적이지 않다.
  • 장점
    • 굉장히 자연스러운 결과물을 만들어낸다. → 현재 영화나 게임에 가장 널리 사용된다.

 

Data-Driven Animation

Motion capture을 하는데 드는 비용은 크기 때문에 motion capture 된 데이터(captured motion data)을 재사용하여 새로운 움직임을 만든다.

 

Motion editing techiques을 통해 captured motion data를 재사용 할 수 있다.

Machine learning(deep learning) 기법을 사용하여 자연스러운 데이터를 학습하고 재생산 할 수 있다.

 

Physics-Based Animation

High queality motion을 만드는데 있어서 physical reality가 중요한 역할을 한다.

 

Physics-based animation은 motion을 만들기 위해 physics simulation을 사용한다.

Physic simulation은 항상 물리적으로 사실적인 motion을 만든다.

 

캐릭터가 밀려서 넘어지는 등의 passive character motion에 대해서는 이미 많이 사용되고 있다.

 

그러나 달리면서 테니스 라켓을 휘두르는 등의 active character motion에 대해서 사용하기는 어렵다.

Active cahracter motion은 각 관절에 어떤 힘을 줄지를 면밀히 계산하고 부여해야 하기 때문이다.

이는 robotics에서의 문제와 비슷하다.

 

최근에는 deep learning이나 deep reinforcement learning을 이용한다.

 


Motion Capture Data

Motion capture data는 skeleton과 motion으로 이루어진다.

  • Skeleton
    • ≒ link transformation에 대한 data 
    • static data : 시간에 따라 변하지 않음.
    • joint hierarchy
    • joint offset from its parent joint
  • Motion
    • ≒ joint transformation에 대한 data 
    • time-varying data : 시간에 따라 변함
    • 각 joint의 default frame에 대한 internal joint orientation
      • 각 joint의 default frame : joint의 link transformation을 적용한 frame
      • internal joint는 일반적으로 3 자유도를 가진다.(rotate only)
    • global frame에 대한 skeletal root의 position and orientation
      • root joint는 일반적으로 6 자유도를 가진다. (rigid : rotate + translate)

 

  • Posture(pose)
    • single frame에서의 motion
  • T pose
    • 모든 joint orientation이 0 (identity matrix)일 때의 pose
    • 사람의 경우 identity pose가 일반적으로 T자 pose 이기 때문에 T pose라고 한다.

T pose

 


BVH File Format

BVH란 BioVision hierarchical data로, Biovision에서 개발된 파일 형식이다.

Motion capture data을 전달하는 text file format이다.

 

Hierarchy section과 motion section으로 구성되어있다.

  • Hierarchy section : skeleton의 hierarchy와 initial pose에 대한 정보를 담고 있다.
  • Motion section : motion data을 담고 있다.

 

Hierarchy Section

Hierarchy는 joint tree이고, 각 joint는 offset과 channel list를 가지고 있다.

Cannel list는 해당 joint의 motion에 대한 transformation list이다.

hiearchy

 

일반적으로 다음과 같은 format으로 되어있다.

HIERARCHY
ROOT rootname
{
	OFFSET 00.00   00.00   00.00		// parent로부터의 X, Y, Z offset
    CHANNELS 6 Xrotation Zrotation ...	// channel의 수, 각 channel의 type
	JOINT jointname
    {
    	OFFSET 00.00 00.00 00.00
        CHANNELS 3 Xrotation ...
        JOINT jointname
        {
            OFFSET ...
            CHANNELS ...
            End Site					// current segment가 end effector임을 명시
            {
				OFFSET 00.00 00.00 00.00
            }
        }
    }
}

 

Motion Section

Motion section은 다음과 같은 format으로 되어있다.

  • Frame Time 아래 줄은 motion data를 나티낸다.
    • 각 줄은 하나의 frame에서의 motion data이다.
    • 각 숫자는 하나의 channel에 대한 값이다.
    • 각 숫자의 순서는 channel의 순서와 동일하다.
    • rotation channel의 값의 단위는 degree이다.
    • rotation은 euler angle을 이용하여 rotation을 수행하면 된다.
MOTION					// 앞으로 나오는 것이 motion section임을 명시
Frames: 20 				// frame의 수를 명시(= 앞으로 나오는 motion에 관한 line의 개수)
Frame Time : 0.03333	// data의 sampling rate : 0.03333인 경우 초당 30 프레임
0.00 39.68 0.00 0.65 ...
...

 

예시

다음과 같은 BVH file가 있다고 하자.

HIERARCHY
ROOT link0
{
	OFFSET 0 0 0
    CHANNELS 6 Xposition Yposition Zposition Xrotation Yrotation Zrotation
    JOINT link1
    {
    	OFFSET 1 0 0
        CHANNELS 3 Zrotation Xrotation Yrotation
        JOINT link2
        {
        	OFFSET 0 1 0
            CHANNELS 3 Zrotation Xrotation Yrotation
            End Site
            {
            	OFFSET 0 0 1
            }
        }
    }
}

MOTION
Frames : 1
Frame Time : 0.033333
3 2 1 30 20 10 40 50 60 0 0 0

 

여기서 global frame에 대한 link2 joint의 위치는 다음과 같이 구한다.

$T(0, 0, 0) \; R_x(30) R_y(20) R_z(10) \; T(1, 0, 0) \; R_z(40) R_x(50) R_y(60) \; T(0, 1, 0) \; \begin{bmatrix} 0 \\ 0 \\ 0 \\ 1 \end{bmatrix}$

 


참고

본 포스트는 한양대학교 이윤상 교수님의 수업을 정리한 내용입니다.

출처: 한양대학교 이윤상 교수님 컴퓨터그래픽스 강의 강의자료 - https://cgrhyu.github.io/courses/2022-spring-cg.html

 

CGR LAB

Computer Graphics - 2022 Spring Instructor: Yoonsang Lee Teaching Assistant: Chaejun Sohn Undergraduate Mentor: Bokyoung Jang Time / Location: Mon 09:00-11:00 / Online (originally 207 IT.BT Building) - Lab Wed 09:00-11:00 / 508 IT.BT Building - Lecture Cou

cgrhyu.github.io

 

 

'Computer Science > Computer Graphics' 카테고리의 다른 글

Curve, Spline  (1) 2021.06.01
Kinematics  (0) 2021.06.01
3D Orientation Interpolation  (0) 2021.06.01
Orientation, Rotation  (0) 2021.06.01
Hierarchical Modeling  (0) 2021.05.31

댓글