• No results found

Lecture 11 Volumetric representation Animation

N/A
N/A
Protected

Academic year: 2021

Share "Lecture 11 Volumetric representation Animation"

Copied!
63
0
0

Loading.... (view fulltext now)

Full text

(1)

Information Coding / Computer Graphics, ISY, LiTH

Lecture 11

Volumetric representation

Animation

(2)

Information Coding / Computer Graphics, ISY, LiTH

Last time: Almost-midcourse

evaluation

(3)

Information Coding / Computer Graphics, ISY, LiTH

(4)

Information Coding / Computer Graphics, ISY, LiTH

Time to decide on a project

• Should be preliminary decided wednesday the 3th

(second to last lecture)

• Final specification same day as last lecture (friday 5h)

Title

Participants

Brief summary

(5)

Information Coding / Computer Graphics, ISY, LiTH

Project ideas:

• 3D labyrinth

• Interactive solar system • Robot with moveable limbs

• Driving simulator • Flight simulator

(6)

Information Coding / Computer Graphics, ISY, LiTH BEZ0,3 = (1-u)3 BEZ1,3 = 3u(1-u)2u BEZ2,3 = 3(1-u)u2 BEZ3,3 = u3 P0 P1 P2 P3 1 1

u

(7)

Information Coding / Computer Graphics, ISY, LiTH

de Casteljau’s algorithm

Linear interpoations of linear interpolations

until only one point remains

(8)

Information Coding / Computer Graphics, ISY, LiTH

Catmull-Rom splines

Specified only by control points on the curve

Calculated from 4 control points, define between the middle two!

P(u) = pk-1 (-u3/2 + u2 - u/2) +

pk (3u3/2 - 5u2/2 + 1) +

(9)

Information Coding / Computer Graphics, ISY, LiTH

Continuity

Catmull-Rom

always

C

and G

continuous!

(10)

Information Coding / Computer Graphics, ISY, LiTH

u

Bézier surfaces

Blending of the 16 control points as a

2-dimensional sum

P(u,v) = ∑ ∑ p

j,k

BEZ

j,3

(v) BEZ

k,3

(u)

k=0

j=0 3 3

(11)

Information Coding / Computer Graphics, ISY, LiTH

Density volumes

3D grid of density values.

• Pre-computed blobby objects

• Voxelization of 3D models

(12)

Information Coding / Computer Graphics, ISY, LiTH

Case of particular interest to

some students?

(13)

Information Coding / Computer Graphics, ISY, LiTH

MRI of MIR

(14)

Information Coding / Computer Graphics, ISY, LiTH

Rendering:

(15)

Information Coding / Computer Graphics, ISY, LiTH

Recent projects on raymarching of

medical images

(16)

Information Coding / Computer Graphics, ISY, LiTH

Marching Cubes

(17)

Information Coding / Computer Graphics, ISY, LiTH

Example: Marching Squares

(18)

Information Coding / Computer Graphics, ISY, LiTH

Ray marching relatively easy

Step to next potential voxel wall (3 possible in 3D)

Pick the closest, check neighbor space

Repeat until filled space is found.

(19)

Information Coding / Computer Graphics, ISY, LiTH

Cheapass ray marching

(20)

Information Coding / Computer Graphics, ISY, LiTH

Conclusions for density volumes

Usually considered for the advanced course - but

from 2018 supported as course project in TSBK07

primarily for students on the medical technology

program.

(21)

Information Coding / Computer Graphics, ISY, LiTH

Animation

Essentially a question of flipping between

many still images, fast enough

(22)

Information Coding / Computer Graphics, ISY, LiTH

Animation as a topic

• Page flipping, double-buffering

• Sprite animation

• Movement and posing

(23)

Information Coding / Computer Graphics, ISY, LiTH

(24)

Information Coding / Computer Graphics, ISY, LiTH

The double buffering problem

When animating a scene with many objects in real time, it is not just a question of showing images:

• Erase the entire scene

• Draw each visible object in new positions

(25)

Information Coding / Computer Graphics, ISY, LiTH

Single buffered animation

Flicker

Screen update

beam

(26)

Information Coding / Computer Graphics, ISY, LiTH

Solutions

1) Don’t erase-and-redraw near the update beam

Unreliable.

Doesn’t work on all screens.

2) Double buffering.

(27)

Information Coding / Computer Graphics, ISY, LiTH

Double buffering

VRAM Buffer 1 Buffer 2 VRAM Buffer 1 Buffer 2 Choose buffer Copy

(28)

Information Coding / Computer Graphics, ISY, LiTH

Double buffered animation

Tearing

Occurs if buffers switch while the screen is being redrawn.

Screen

(29)

Information Coding / Computer Graphics, ISY, LiTH

Built-in VBL sync (vsync)

Modern systems have VBL sync built-in -

even mandatory double buffering. You

(30)

Information Coding / Computer Graphics, ISY, LiTH

Double buffering in OpenGL

Double buffer

• Pass GLUT_DOUBLE to glutInitDisplayMode • glutSwapBuffers();

Repeated redraw

(31)

Information Coding / Computer Graphics, ISY, LiTH

Sprite animation

2D animation based on 2D images.

(32)

Information Coding / Computer Graphics, ISY, LiTH

Sprites in OpenGL

Use textured polygons with

transparency! (Like billboards but

without 3D.)

(33)

Information Coding / Computer Graphics, ISY, LiTH

Take advantage of OpenGL in 2D!

High performance - use

high-performance effects

Particle systems

(34)

Information Coding / Computer Graphics, ISY, LiTH

Pseudo-3D effects

Scaled sprites on background with perspective: Depth cue by size

Side-scrolling with parallax scroll: Depth cue by movement

(35)

Information Coding / Computer Graphics, ISY, LiTH

(36)

Information Coding / Computer Graphics, ISY, LiTH

(37)

Information Coding / Computer Graphics, ISY, LiTH

Classic pseudo-3D game with depth

from shadows and depth from size

(38)

Information Coding / Computer Graphics, ISY, LiTH

Depth from movement

Parallax scroll

(39)

Information Coding / Computer Graphics, ISY, LiTH

Not only history

(40)

Information Coding / Computer Graphics, ISY, LiTH

Pseudo-3D effects vs 3D

• Depth from size = perspective projection

• Parallax scroll: Comes for free to some extent,

but can be emphasized with cameras observing

the viewer

(41)

Information Coding / Computer Graphics, ISY, LiTH

Animation techniques for moving

objects

• Procedural animation

• Physics-based animation

(42)

Information Coding / Computer Graphics, ISY, LiTH

Procedural animation

Simple frame by frame movement

following some procedural rule.

What we are already doing in the labs!

x = x + 1

(43)

Information Coding / Computer Graphics, ISY, LiTH

Animation paths

(44)

Information Coding / Computer Graphics, ISY, LiTH

Character animation

• Pre-defined poses • Key-frame animation • Forward kinematics • Inverse kinematics

(45)

Information Coding / Computer Graphics, ISY, LiTH

Key-frame animation

Pre-rendered animations

Key-frames are designed at suitable intervals

(46)

Information Coding / Computer Graphics, ISY, LiTH

Kinematics

Kinematics = movement without forces Forward kinematics:

Specify poses by specifying rotation of joints. Easy to implement, but specifying poses is much

trial-and-error.

Inverse kinematics:

(47)

Information Coding / Computer Graphics, ISY, LiTH

Motion capture

Extremely common in movies! • Record by natural visuals only • Tracking markers

• Active sensors on the body

(48)

Information Coding / Computer Graphics, ISY, LiTH

Face animation

Hard problem - we are very sensitive to errors!

Animate by action units (muscle based) or face animation parameters (extreme detail)

(49)

Information Coding / Computer Graphics, ISY, LiTH

Some advanced animation topics

• Bones and skinning systems

• Deformations

• Physics-based animation

• Quaternions, SLERP

(50)

Information Coding / Computer Graphics, ISY, LiTH

Particle systems

Spectacular effects with little effort!

Many small moving objects.

• Explosions

• Water

• Fire

(51)

Information Coding / Computer Graphics, ISY, LiTH

Particle system

(52)

Information Coding / Computer Graphics, ISY, LiTH

Particle system

(53)

Information Coding / Computer Graphics, ISY, LiTH

Particle system

• Initial position

• Initial speed (usually with some

randomness))

• Movement (usually independent, physically

realistic)

(54)

Information Coding / Computer Graphics, ISY, LiTH

Particle system

Movement according to fundamental

physics:

acceleration = gravity + forces/mass

speed = speed + acceleration

(55)

Information Coding / Computer Graphics, ISY, LiTH

Particle system on GPU

CPU-driven particle systems OK up to a

certain size

Data transfer (new positions) of all particles

can be a bottleneck

(56)

Information Coding / Computer Graphics, ISY, LiTH

Texture based particle systems

Use textures to store x, y, z, dx, dy, dz

Store as color components (r, g, b)

Needs advanced texturing features (render

to texture, floating-point buffers)

(57)

Information Coding / Computer Graphics, ISY, LiTH

Separate compute kernels for

particle systems

CUDA, OpenCL, Compute shaders

Free choice of data formats

(58)

Information Coding / Computer Graphics, ISY, LiTH

Drawing particle systems

Large number of very simple models

(billboards)!

Modest demands on GPU, but very large

number of function calls!

(59)

Information Coding / Computer Graphics, ISY, LiTH

Instancing

Draw a large number of the same model!

Each instance has an index, the instance number.

glDrawArraysInstanced(GL_TRIANGLES, 0, 3, 10);

draws a triangle 10 times!

(60)

Information Coding / Computer Graphics, ISY, LiTH

Billboard instancing demo

#version 150

in vec3 in_Position; uniform mat4 myMatrix; uniform float angle; uniform float slope; out vec2 texCoord; void main(void) {

mat4 r;

float a = angle + gl_InstanceID * 0.5;

float rr = 1.0 - slope * gl_InstanceID * 0.01; r[0] = rr*vec4(cos(a), -sin(a), 0, 0);

r[1] = rr*vec4(sin(a), cos(a), 0, 0); r[2] = vec4(0, 0, 1, 0);

Position trivially affected by gl_Instance ID

One single call to

(61)

Information Coding / Computer Graphics, ISY, LiTH

Instancing complex models

(62)

Information Coding / Computer Graphics, ISY, LiTH

Basic: Start on CPU

Intermediate: Simple instancing

Advanced: Dependent particles

Performance is important, but advanced GPU

based particle systems are beyond basic

(63)

Information Coding / Computer Graphics, ISY, LiTH

Randomness in particle systems

Saving the position of particles may be unnecessary!

Make a function based on instance number.

Noise textures provide unique parameters per

particle!

References

Related documents

0.3 Usage of Permission Marketing by Industry Sector The analysis of Permission Marketing by industry sector, shows there is an overwhelming number of companies in the

(1980) observaram que a atividade ovicida do oxfendazole em ncmatódeos gastrintestinais de ovinos teve início quatro horas após o tratamento, sendo que três dias após

На сьогоднішній день в статистичних звітах організацій міськсвітла, населених пунктів України, відсутні дані про автономні системи

He is a former Chief, Criminal Division, United States Attorney's Office for the District of Columbia, Assistant Inspector General for Investigations, Central Intelligence

In addition to this array, the BufMgr instance also contains an array of numBufs instances of the BufDesc class that is used to describe the state of each frame in the buffer pool..

of an output module to indicate that the: a) load has been operated. b) input associated with the output is active. c) module fuse has blown... b) the CPU and field equipment. d)

1.. The authors investigated Galfa Tower in Milan, a 106-meter-high office tower built in the 1950s, with a curtain wall made of aluminum and glass. Although it is unlisted,

Dreier, Duchamp’s curator partner and the only curator who exhibited the ‘unfinished’ Large Glass , in her text about the piece also touches upon an extreme- ly important topic