Administrative notes October 19, 2017 Reminder: Reading quizzes - - PowerPoint PPT Presentation

administrative notes october 19 2017
SMART_READER_LITE
LIVE PREVIEW

Administrative notes October 19, 2017 Reminder: Reading quizzes - - PowerPoint PPT Presentation

Administrative notes October 19, 2017 Reminder: Reading quizzes due Monday Reminder: optional project proposal resubmission due October 23 Reminder: In the news call #2 due October 25 Reminder: if your lab was flooded out,


slide-1
SLIDE 1

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Administrative notes October 19, 2017

  • Reminder: Reading quizzes due Monday
  • Reminder: optional project proposal

resubmission due October 23

  • Reminder: In the news call #2 due October 25
  • Reminder: if your lab was flooded out, please

show it to your lab TAs next week

slide-2
SLIDE 2

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

  • Hmm. So perhaps bitmaps are not the best

choice for all images

If you zoom in on images, they get “pixelated” Vector images describe images based on points and how they’re connected.

University

slide-3
SLIDE 3

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Vector Image Representation

  • Describe each object of the image either as
  • a sequence of dots (connected by lines), or
  • a simple shape (e.g., rectangle, circle)
  • Describe the colour (fill) of each closed object

basic approach

86

slide-4
SLIDE 4

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Vector Image Representation

example

87

slide-5
SLIDE 5

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

4 3 2 1 0 1 2 3 4

We’ll use two axes

  • X axis numbered 0, 1, … from left to right
  • Y axis numbered 0, 1, … from bottom to top

X Y

Vector image representation Example

slide-6
SLIDE 6

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

4 3 2 1 0 1 2 3 4

X Y

first dot x,y second dot third dot fourth dot fifth dot

2,1 , 1,2 , 2,3 , 3,2 , 2,1

Vector image representation Example

slide-7
SLIDE 7

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Clicker Exercise

4 3 2 1 0 1 2 3 4

2,1, 2,3, 3,2, 1,2, 2,1

Which image is represented by the following sequence?

  • A. B. C.

4 3 2 1 0 1 2 3 4 4 3 2 1 0 1 2 3 4 90 4 3 2 1

X Y

0 1 2 3 4

slide-8
SLIDE 8

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

91

Mapping a vector image to a bitmap display Consider a red line on a white background

This task is called rasterization. Here’s one approach: Scale: first, scale the line representation to match the display area size (thickening the line accordingly) Map: imagine laying the screen on top of the line

  • colour each pixel that lies fully on top of the line red
  • colour each pixel that does not lie on the line white
  • colour each pixel that lies partly on the line pink
slide-9
SLIDE 9

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

4 3 2 1 00 1 2 3 4 0 1 2 3 4 4 3 2 1

Mapping a vector image to a bitmap display Consider a red line on a white background

slide-10
SLIDE 10

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Why is a pixelated look avoided with vector representation?

4 3 2 1 00 1 2 3 4 0 1 2 3 4 4 3 2 1

When we repeatedly zoom in, we run the "scale then map" algorithm repeatedly!

slide-11
SLIDE 11

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Vector Image Representation

  • Add width and colour of lines
  • Use curves instead of lines
  • Add shading to objects
  • Specify which objects overlay others

extensions of basic approach

94

slide-12
SLIDE 12

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

first dot x,y,colour, thickness second dot

1 2,1, FF,6 , 1,2,00,2, …

Vector image representation Example

What if we also want to control line colour and thickness (relative to the grid size)?

  • Use hex colour code
  • Introduce a new convention to

measure line thickness (e.g. “pt”)

4 3 2 1 0 1 2 3 4 dimension

  • f the grid

(in cm) colour and thickness

  • f first line
slide-13
SLIDE 13

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Image representation formats

Vector graphics:

  • CGM (Computer Graphics Metafile)
  • SVG (Scalable Vector Graphics)
  • AI (Adobe Illustrator Artwork)

Bitmap (raster) graphics:

  • JPEG (Joint Photographic Experts Group; lossy compression)
  • TIFF (Tagged Image File Format; may use lossy or lossless)
  • GIF (Graphics Interchange Format): limited palette, supports

animation

slide-14
SLIDE 14

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Image representation formats

As with .docx and .txt files, image files of different types have distinguishing header information, enabling applications to interpret the representation (or decline to open the file)

slide-15
SLIDE 15

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

What representation is used for PDF documents? Clicker question

  • A. Bitmap images
  • B. Vector images
  • C. It depends
slide-16
SLIDE 16

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

99

What representation is used to photocopy documents? Clicker question

  • A. Bitmap images
  • B. Vector images
  • C. It depends
slide-17
SLIDE 17

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

  • A. Bitmap images
  • B. Vector images
  • C. It depends

What representation is used by 3D printers? Clicker question

slide-18
SLIDE 18

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Animation history

Let’s take a moment to look at what hand drawn animation looks like: https://www.youtube.com/watch?v=nwZEcdBML LU&t=00m37s Pay attention to the snow and the hair and clothes (we’ll be discussing this in groups shortly)

slide-19
SLIDE 19

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Exercise in groups

List some of the characteristics of the snow in this scene. List some characteristics of the hair and clothes For both:

  • What does it look like?
  • Does it behave like real snow/hair/clothes?

How yes, and how no?

slide-20
SLIDE 20

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Snow characteristics

Snow! White Image in the background, snow had no texture When the beast was walking, it changed a little When they picked up the snowball, it was lighter, in the background it was darker It glittered

slide-21
SLIDE 21

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Hair and clothing characteristics?

Hair and clothes were chunked up, just solid colour, no detailed lines

slide-22
SLIDE 22

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

First Disney computer animation, 1991

Ballroom scene in Beauty and the Beast https://www.youtube.com/watch?v=xDUhINW3SPs&t =01m01s Note that Belle and the Beast are still both hand drawn – it's only the background that is computer animated Before they enter the ballroom is all hand-drawn.

slide-23
SLIDE 23

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Group exercise

List at least one difference between the hallway (hand drawn animation) and the ballroom (computer animation) that may be related to the change in technologies used and guess as to why Do you think that computer animation adds artistic value here?

slide-24
SLIDE 24

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Differences between hallway and ballroom scenes

In the ballroom, it looked like the "camera" was moving High frame rate - don't want to draw as many frames in hand drawn 3d effect Characters that were drawn had hard edges, background was more smoothy Reflections!

slide-25
SLIDE 25

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Artistic value of computer animation? Your thoughts

Added: makes the ballroom looks more grand

slide-26
SLIDE 26

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

How did they do it? Computer graphics in Beauty and the Beast

  • 3D computer model of the ballroom (using software

from a Canadian company, called Alias, which later became Maya).

  • The camera movement sequence and timing is

determined (by the artists) via the computer model

  • This sequence is used to automatically "render" the

background of each frame (using Renderman software from Pixar)

  • Rendering: converting a 3D model to a 2D bitmap

image, addressing, e.g. which objects are visible in the scene?

slide-27
SLIDE 27

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Let’s take another look at snow

Monster’s Inc. (2001): https://www.youtube.com/watch?v=fqwXB-SbY2o&t=4m05s Computer generated snow, but they did not focus on snow

slide-28
SLIDE 28

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Group exercise

Compare the snow and hair (no clothes!) here with the snow in Beauty and the Beast.

  • List some technical similarities (note: “it is

white” is not the level we’re looking for) and differences

  • List ways that it is still unrealistic
slide-29
SLIDE 29

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Compare snow in Beauty and the Beast vs. Monsters, Inc.

  • You can see the individual snow "chunks"
  • Snow is kind of physical, it interacts!
  • The shadow in the snow moved in the same direction - changing left to right
  • The snow in front of the face is pixelated
slide-30
SLIDE 30

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Compare snow in Beauty and the Beast vs. Monsters, Inc? Anything else?

Hair! It moves! It's kind of transparent, it reacts like "real" hair to light You can see every strand - in B&B only see that clump

slide-31
SLIDE 31

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

How did they do it? Computer graphics in Monsters Inc.

  • Physics-based modeling: simulation of physical systems to

model fluid or deformable matter, such as hair, clothing, smoke, fire. (Each strand of hair is individually modeled!)

  • New "rasterization" techniques for rendering (converting a 3D

model to a 2D bitmap image), that can account for how textures and different types of light sources affect colour and light intensity at each pixel

  • Much more computing power needed using specialized

graphics processing units

  • https://www.youtube.com/watch?v=xmyZWCbKtss
slide-32
SLIDE 32

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Perspective on computer animation vs story in Monsters Inc.

The biggest challenge throughout the production was the story [...] I think that will always be the case. At Pixar we place a great deal of emphasis on story and the characters. You can have some really stunning imagery and technical innovation, but after about 5 minutes the audience is bored and they want something more interesting – story. You're asking people to commit an hour and a half of their life and it better be something worthwhile.”

  • Pete Doctor, Director
slide-33
SLIDE 33

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Our final discussion of snow brings us, of course, to Frozen

slide-34
SLIDE 34

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Group exercise

Compare and contrast the snow you saw in Frozen with the snow in Monsters, Inc.

It was even more detailed, when the dude jumped of the cliff, you could see the individual snow particles There's a lot of control, you can make it look real. Some of the snow looked like ice. Some of the snow looked more like soft powder.

slide-35
SLIDE 35

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

How did they do it? Computer graphics in Frozen

"Snow dynamics are amazingly beautiful yet

  • varied. Whether it is powder snow fluttering in a skier’s

wake, foot steps shattering an icy snow crust or even packing snow rolled into balls to make a snowman, it is snow’s rich repertoire that makes it simultaneously compelling for storytelling and infuriatingly difficult to model on a computer.”

  • -- Alexey Stomakhin et al.,

"A material point method for snow simulation” (published in SIGGRAPH, a major graphics conference)

https://www.math.ucla.edu/~jteran/papers/SSCTS13.pdf

slide-36
SLIDE 36

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

How did they do it? Computer graphics in Frozen

  • Sophisticated physics based modeling of snow’s

solid and fluid properties relies on:

  • Modeling many very small particles of snow, controlling

the properties of the particles such as strength, viscosity (gooeyness – clumping again!) or hardness

  • velocity and direction of particles depend on properties as

well as collisions with other particles or objects

https://www.youtube.com/watch?v=O0kyDKu8K-k

  • Use of "renderfarms" – 30,000 specialized graphics

processors working in parallel to render frames

slide-37
SLIDE 37

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Computer graphics research at UBC

Robert Bridson (now at Autodesk): physics based simulations of fluids, smoke, cloth.

Movie credits for The Hobbit: An Unexpected Journey, The Adventures of Tintin, The Rise of the Planet of the Apes, and Inkheart; his liquid effects software has been used in many many other films https://www.youtube.c

  • m/watch?v=Mo-

U5iOinM8&t=01m07s

slide-38
SLIDE 38

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Computer graphics research at UBC

Alla Sheffer: 3D modeling, physics-based cloth simulation

slide-39
SLIDE 39

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Computer graphics research at UBC

Michiel van de Panne: vector-based 3D animation; human and animal motion https://www.youtube.com/watch?v=pgaEE27nsQw

slide-40
SLIDE 40

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

Learning Goals Revisited

  • CT Building Block: Define the RGB colour specification,

explain its basis

  • CT Building Block: Define “bitmap image” and “pixel” and

explain how to construct a bitmap image representation

  • CT Building Block: Define “vector image” and explain how

to construct a vector image representation

  • CT Building Block: Compare and contrast the suitability of

bitmap and vector representations for different uses of images

  • CT Impact: Students will be able to describe what

differences are made possible by using hand drawn vs. computer animation

123

slide-41
SLIDE 41

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

decimal binary 1 1 2 10 3 11 4 100 5 0101 6 0110 7 0111 decimal binary 8 1000 9 1001 10 1010 11 1011 12 1100 13 1101 14 1110 15 1111

Decimal to binary conversion

124

slide-42
SLIDE 42

Computational Thinking www.ugrad.cs.ubc.ca/~cs100

dec bin hex 1 1 1 2 10 2 3 11 3 4 100 4 5 101 5 6 110 6 7 111 7 dec bin hex 8 1000 8 9 1001 9 10 1010 A 11 1011 B 12 1100 C 13 1101 D 14 1110 E 15 1111 F

Conversion Table: Decimal, binary, and hex

125