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 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 Computational Thinking www.ugrad.cs.ubc.ca/~cs100
Vector Image Representation basic approach • 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 Computational Thinking 86 www.ugrad.cs.ubc.ca/~cs100
Vector Image Representation example Computational Thinking 87 www.ugrad.cs.ubc.ca/~cs100
Vector image representation Example 4 3 Y 2 1 0 0 1 2 3 4 X We’ll use two axes • X axis numbered 0, 1, … from left to right • Y axis numbered 0, 1, … from bottom to top Computational Thinking www.ugrad.cs.ubc.ca/~cs100
Vector image representation Example 4 3 Y 2 1 0 0 1 2 3 4 X 2,1 , 1,2 , 2,3 , 3,2 , 2,1 first dot fifth dot third dot x,y second dot fourth dot Computational Thinking www.ugrad.cs.ubc.ca/~cs100
Clicker Exercise Which image is represented by the following 4 sequence? 3 2 Y 2,1, 2,3, 3,2, 1,2, 2,1 1 0 0 1 2 3 4 A. B. C. X 4 4 4 3 3 3 2 2 2 1 1 1 0 0 0 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 Computational Thinking 90 www.ugrad.cs.ubc.ca/~cs100
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 Computational Thinking 91 www.ugrad.cs.ubc.ca/~cs100
Mapping a vector image to a bitmap display Consider a red line on a white background 4 4 3 3 2 1 2 00 1 2 3 4 1 0 0 1 2 3 4 Computational Thinking www.ugrad.cs.ubc.ca/~cs100
Why is a pixelated look avoided with vector representation? 4 4 3 3 2 1 00 1 2 3 4 2 When we repeatedly zoom in, we run the 1 "scale then map" algorithm repeatedly! 0 0 1 2 3 4 Computational Thinking www.ugrad.cs.ubc.ca/~cs100
Vector Image Representation extensions of basic approach • Add width and colour of lines • Use curves instead of lines • Add shading to objects • Specify which objects overlay others • … Computational Thinking 94 www.ugrad.cs.ubc.ca/~cs100
Vector image representation Example What if we also want to control line 4 colour and thickness (relative to the 3 grid size)? 2 - Use hex colour code 1 0 - Introduce a new convention to 0 1 2 3 4 measure line thickness (e.g. “pt”) 1 2,1, FF,6 , 1,2,00,2, … first dot dimension x,y,colour, of the grid second dot colour and thickness thickness (in cm) of first line 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 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) 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 Computational Thinking www.ugrad.cs.ubc.ca/~cs100
What representation is used to photocopy documents? Clicker question A. Bitmap images B. Vector images C. It depends Computational Thinking 99 www.ugrad.cs.ubc.ca/~cs100
What representation is used by 3D printers? Clicker question A. Bitmap images B. Vector images C. It depends 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) 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? 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 Computational Thinking www.ugrad.cs.ubc.ca/~cs100
Hair and clothing characteristics? Hair and clothes were chunked up, just solid colour, no detailed lines 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. 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? 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! Computational Thinking www.ugrad.cs.ubc.ca/~cs100
Artistic value of computer animation? Your thoughts Added: makes the ballroom looks more grand 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? 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 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 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 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 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 Computational Thinking www.ugrad.cs.ubc.ca/~cs100
Recommend
More recommend