GAMES101-现代计算机图形学入门-闫令琪——Lecture 21 Animation 学习笔记

编程入门 行业动态 更新时间:2024-10-26 11:26:42

Lecture 21 Animation

“Bring things to life”

  • Communication tool
  • Aesthetic issues often dominate technical issues

An extension of modeling

  • Represent scene models as a function of time

Output: sequence of images that when viewed sequentially provide a sense of motion

  • Film: 24 frames per second
  • Video (in general): 30 fps
  • Virtual reality: 90 fps

一、Keyframe Animation

Animator (e.g. lead animator) creates keyframes

Assistant (person or computer) creates in-between frames (“tweening”)

关键帧动画,通过绘制关键帧,将中间的动画变换过程补充完整。最早是手动一帧帧画出中间的帧,后来可以通过一些动画软件自动插值出来。

Keyframe Interpolation

Think of each frame as a vector of parameter values

Linear interpolation usually not good enough

Recall splines for smooth / controllable interpolation

用不同的差值方式补全过渡的帧

二、Physical Simulation

用物理的方式去模拟动画。

Mass Spring System: Example of Modeling a Dynamic System

在这里用一个弹簧系统的模拟举例子:

A Simple Spring

①、Idealized spring

Force pulls points together

Strength proportional to displacement (Hooke’s Law)

ks is a spring coefficient: stiffness

Problem: this spring wants to have zero length

首先假设弹簧处于自然伸展状态,左右两个小球,根据胡克定律可以列出以上物理公式。

下面我们考虑弹簧处于不自然伸展状态下的情况(下面考虑被拉伸的情况)

②、Non-Zero Length Spring

Spring with non-zero rest length

Problem: oscillates forever

这里 ||b-a||-l 即为弹簧被拉伸的长度,前面用b-a/||b-a||来确定力的方向。

那么如果这样,弹簧间的运动将永远停不下来(因为没有阻力)

下面就要考虑加上阻力后的情况。

③、Introducing Energy Loss

Dot Notation for Derivatives

If is a vector for the position of a point of interest, we will use dot notation for velocity and acceleration:

首先我们定义,若x是位移,那么对x的导数即为速度,在这里记作x上面加一个点,对x的二阶导数为加速度,在这里记作x上面加两个点。

Simple motion damping

  • Behaves like viscous drag on motion
  • Slows down motion in the direction of velocity
  • kd is a damping coefficient

Problem: slows down all motion

  • Want a rusty spring’s oscillations to slow down, but should it also fall to the ground more slowly?

在这里我们始终将阻力方向表示为运动方向的反方向。

但是这种模型只是表示外力的情况,无法表示弹簧的内力。

④、Internal Damping for Spring

Damp only the internal, spring-driven motion

  • Viscous drag only on change in spring length
  • Won’t slow group motion for the spring system (e.g. global translation or rotation of the group)
  • This is only one specific type of damping

在此我们引入弹簧内力的情况。红框内部算出来的是一个数值,是内力在物体运动方向的分力,最后一项为力的方向。内力的方向同样与物体相对运动方向相反。

Structures from Springs

从弹簧的结构来看,我们就可以延伸出更多情况的模拟。如布料。

Behavior is determined by structure linkages

This structure will not resist shearing(错切)

This structure will not resist out-of-plane bending…

这里有一块布,每两个顶点之间都用上弹簧模拟的算法,但是如果拽两个角,整个结构会被拉伸变形。而实际上当我们拽一块布的两个对角的时候,布的结构并不会被拉伸变形。这就是我们下面要考虑的问题。

Behavior is determined by structure linkages

This structure will resist shearing. Less directional bias.

This structure will not resist out-of-plane bending either…

我们通过在每两个对角之间都加上弹簧结构的线,就可以抵挡对任何两个对角施加的力。

但是另一个问题又产生了,如果沿着某条竖线对折,整个结构立马就塌了,也就是说现在的结构很容易让整个布不在一个平面上。但是实际上布就算弯曲也不会完全塌掉。

They behave like what they are (obviously!)

This structure will resist shearing. Less directional bias.

This structure will resist out-of-plane bending Red springs should be much weaker.

那么这里我们每隔一个点连一条线,这些红线之间的作用不是很强,但是仍然有作用力,就可以解决上面布会塌掉的问题。

到这里为止我们就可以用弹簧系统解决基本的布料模拟问题了。

Aside: FEM (Finite Element Method) Instead of Springs

这种有限元方法也可以描述布料弹簧系统。

三、Particle Systems

Model dynamical systems as collections of large numbers of particles

Each particle’s motion is defined by a set of physical (or non-physical) forces

Popular technique in graphics and games

  • Easy to understand, implement
  • Scalable: fewer particles for speed, more for higher complexity

Challenges

  • May need many particles (e.g. fluids)
  • May need acceleration structures (e.g. to find nearest particles for interactions)

Particle System Animations

For each frame in animation

  • [If needed] Create new particles
  • Calculate forces on each particle
  • Update each particle’s position and velocity
  • [If needed] Remove dead particles
  • Render particles

Particle System Forces

  • Attraction and repulsion forces

  • Gravity, electromagnetism, …

Damping forces

  • Friction, air drag, viscosity, …

Collisions

  • Walls, containers, fixed objects, …
  • Dynamic objects, character body parts, …

对于粒子来讲,考虑各种问题,粒子位置、相互作用、碰撞等…

Gravitational Attraction

Newton’s universal law of gravitation

  • Gravitational pull between particles

比如粒子间的引力,都要用物理公式去模拟。

Simulated Flocking as an ODE

Model each bird as a particle

Subject to very simple forces:

  • attraction to center of neighbors
  • repulsion from individual neighbors
  • alignment toward average trajectory of neighbors

Simulate evolution of large particle system numerically

Emergent complex behavior (also seen in fish, bees, …)

粒子间可能会存在某种行为,如聚集、排斥、同向等。

四、Forward Kinematics (运动学)

Articulated skeleton

  • Topology (what’s connected to what)
  • Geometric relations from joints
  • Tree structure (in absence of loops)

运动学模拟的是人的真实骨骼运动。

Joint types

  • Pin (1D rotation)

  • Ball (2D rotation)

  • Prismatic joint (translation)

Example: simple two segment arm in 2D

Animator provides angles, and computer determines position p of endeffector

比如这里给出了两个关节,第一个关节旋转一个角度,第二个关节也旋转一个角度,我们可以很容易算出p点位置。

也就是说,运动学中只要定义了不同关节的连接方式,我们就可以根据这些连接方式算出各个点的位置。

我们还可以画出旋转角度随时间的不同变化,让整个关节动起来。

Kinematics Pros and Cons

Strengths

  • Direct control is convenient
  • Implementation is straightforward

Weaknesses

  • Animation may be inconsistent with physics
  • Time consuming for artists

但是运动学的定义非常的“物理”,各种旋转不同的角度,操作起来很麻烦。而艺术家们更希望能直接拽着物体来运动,因此产生了逆运动学。

Inverse Kinematics

逆运动学通俗来讲就是,我直接去定义物体的运动情况,中间的关节如何运动,由计算机去算。

Animator provides position of end-effector, and computer must determine joint angles that satisfy constraints

Direct inverse kinematics: for two-segment arm, can solve for parameters analytically

反应在图像上来解释就是,固定一个p点,计算机来告诉我们两个θ值。

可以看出,式子非常复杂。

Why is the problem hard?

  • Multiple solutions in configuration space

  • Solutions may not always exist

而且这种形式还会出现多解和无解的情况。

Numerical solution to general N-link IK problem

  • Choose an initial configuration
  • Define an error metric (e.g. square of distance between goal and current position)
  • Compute gradient of error as function of configuration
  • Apply gradient descent (or Newton’s method, or other optimization procedure)

因此我们需要用各种优化方法来解决这些问题,而不是按照数学物理的方法直接去暴力计算。

五、Rigging

Rigging is a set of higher level controls on a character that allow more rapid & intuitive modification of pose, deformations, expression, etc.

Important

  • Like strings on a puppet
  • Captures all meaningful character changes
  • Varies from character to character

Expensive to create

  • Manual effort
  • Requires both artistic and technical training

Rigging的概念类似于木偶人,通过在模型上增加一些控制点,来使人们能够方便地调整模型的动作。

Rigging Example

如上图,通过一些控制器来控制模型运动。

Blend Shapes

Instead of skeleton, interpolate directly between surfaces

E.g., model a collection of facial expressions:

Simplest scheme: take linear combination of vertex positions

Spline used to control choice of weights over time

我们可以通过各种不同的差值方式,来实现两个关键帧(动作)之间的流畅过渡。

Motion Capture

Data-driven approach to creating animation sequences

  • Record real-world performances (e.g. person executing an activity)
  • Extract pose as a function of time from the data collected

动作捕捉,让虚拟人物和真实人物的动作建立某种关系,将真人的动作反应在虚拟人物上。

Motion Capture Pros and Cons

Strengths

  • Can capture large amounts of real data quickly
  • Realism can be high

Weaknesses

  • Complex and costly set-ups
  • Captured animation may not meet artistic needs, requiring alterations

动作捕捉的好处是效率高且更真实。但是设备本身操作复杂,且捕捉出来的数据点需要再次整理,保证数据合理,甚至有些数据无法捕捉。

不同设备通过各种控制点,来实现捕捉过程。

Facial Motion Capture

阿凡达这部电影用到的面部捕捉技术是动作捕捉领域里程碑式的标志。

The Production Pipeline

动画的制作流程。

更多推荐

GAMES101-现代计算机图形学入门-闫令琪——Lecture 21 Animation 学习笔记

本文发布于:2023-06-13 10:14:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1380710.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:学习笔记   入门   计算机   图形学   Animation

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!