Week 2 - Friday CS 113
Last time What did we talk about last time? 3D graphics
Project 1
Questions?
Video Games
Real-time rendering Most modern 3D video games use real-time rendering 3D scenes are (somewhat) realistically rendered on the fly as characters move throughout the world Scenes usually contain tens of thousands of triangles The quality is much worse than offline rendering But it's still pretty good
Real-time rendering should be impossible Transforming, texturing, and lighting tens of thousands of triangles is too much work for your CPU Most computers have special purpose graphics cards with a powerful processor called a Graphics Processing Unit (GPU) Really great at the kind of math needed for graphics Because GPUs are so common, Windows Vista, 7, 8 and Mac OS use GPUs to make regular desktop animations smoother and faster Some computer scientists use GPUs to solve other problems like simulations and DNA sequencing
Texturing Texturing is gluing a (usually) 2D image onto a polygon This is fully supported by GPUs Large numbers of realistic textures are the reason that graphics cards need so much memory
Big names in the field 3Dfx Interactive was a huge developer in the field until they went bankrupt in 2002 Bought by Nvidia Nvidia is a current manufacturer, famous for its GeForce gaming line AMD bought ATI in 2006 and manufactures the Radeon line of gaming processors Intel is also a major player in GPUs but focuses on a budget models
Uncanny valley One issue, in both offline and real-time rendering, is the uncanny valley: We can relate to abstract representations of human beings We can relate to realistic depictions of human beings But somewhere in the middle, it's not real enough to be convincing, but it is real enough to freak us out
Money Video games generate more revenue than Hollywood movies In 2015, video games brought in $71 billion compared to the $38 billion of box office revenues 101.6 million Wiis 13.4 million Wii Us 80 million Xbox 360s 19 million Xbox Ones 80 million PS3s 53.4 million PS4s PC games are a small part of the pie
More Scratch
Keyboard input One way to get user input is to use a when key pressed block You'll notice that this is a starting block (it doesn't go after other blocks) You can add different when key pressed blocks to respond to different keys
Multiple sprites Each sprite has its own set of behaviors But you can create as many sprites as you want If you want several sprites to behave in a similar way, first make one that does what you want Then right-click on the sprite and choose the duplicate option Duplicating the sprite will make a copy of the sprites appearance and scripts
Messages Sprites can't control each other If you want a sprite to interact with another sprite, you have to broadcast a message A message tells anyone who is listening that some event has happened Messages have no contents, they just have names You can create as many different named messages as you want A sprite needs a when I receive block to act on a message
Example Make it so that the user can move the Scratch Cat to the right side of the screen step by step using the right arrow key Send a message when the Scratch Cat reaches the right side of the screen Make a new sprite that cheers when it gets the message Duplicate the sprite so that lots of sprites cheer when the Cat reaches the right
Lab 2
Upcoming
Next time… We will talk about bits and bytes Read Chapter 1 of Blown to Bits
Reminders Keep working on Project 1 Read Chapter 1 of Blown to Bits