COMP 110 Introduction to Programming Mr. Joshua Stough
What is Computer Graphics? At Least To a CS Major... Converting a set of models into an image –geometric model –lighting model –color model –... Not graphic design –no Photoshop Very mathematical –matrices, vectors (linear algebra is a must)
But, What's It Good For? Movies Video Games Medical Imaging Virtual Environments Scientific Data Visualization
Computer UNC UNC is one of the top computer graphics research universities. COMP 575 –prereqs: COMP 411 (computer organization), (linear algebra)
Graphics UNC Examples Office of the Future nanoManipulator Effective Virtual Environments (EVE)
Office of the Future Goal: Allow distant people to feel as though they are together in a shared office space
nanoManipulator Goal: Allows scientists to view and interact with objects (scaled up by 1,000,000:1) under a scanning-probe microscope Currently used by "real" scientists to study things like carbon nanotubes, DNA, adeno viruses, fibrin.
Effective Virtual Environments Goal: Allow a user in a virtual environment to interact naturally with virtual objects.
Jobs in Computer Graphics Bachelor's in CS –video game programmer VERY good grades, especially in graphics courses (COMP 575) Master's in CS –data visualization toolkit programmer –video game programmer –movie special effects programmer (at Pixar, etc) PhD in CS –all of the above + research Typical Job Path testing and support programmer designer architect management
Introduction to Graphics A picture or drawing must be digitized for storage on a computer A picture is broken down into pixels (picture element) –each pixel is stored separately –all pixels are square –every pixel in a picture is the same size Complete picture is stored by storing the color of each pixel
Pixels and Color A black and white picture can be stored using one bit per pixel –0 = white –1 = black one pixel
Carolina Blue: R172 G194 B227 Representing Color A color picture requires more information –every color can be represented as a mixture of the three primary colors red, green, and blue In Java, each color is represented by three numbers between 0 and 255 that are collectively called an RGB value –1 byte (8 bits) to store the contribution of each color (red, green, blue)
Basic Building Blocks A step up from the pixel is the line. How hard could it be to draw?
Line Drawing A line can be uniquely specified by two points A line can be specified by a slope, m, and a y- axis intercept, b Goal: construct the best possible approximation of an ideal line
Slope-Intercept Algorithm Start at one endpoint Compute dy/dx Increment –x by 1 –y by dy/dx Problem: Pixels are discrete (represented by integers not floating point) Solution: Bresenham's line drawing algorithm
Drawing Triangles A step up from the line is the filled triangle –3 lines for edges –many lines in between to fill in Filling the triangle is sometimes called scan conversion or rasterization
Model to Image Graphics Pipeline Modeling Transformation –model coordinates to world coordinates Illumination –how much light is reflected by a certain point on an object to the viewer View Transformation –center the picture at the viewer Clipping –which points are in the field of view Projection –take into account perspective Rasterization –what color each pixel should be (uses Bresenham line drawing)
Light Source Camera (Viewer)
Phong Illumination Model Approximates all reflections with three terms: –ambient –diffuse –specular
Ambient Not related to particular light source Not dependent on viewer's location –view independent Not affected by object's shape Examples: moonlight, dusk
Diffuse Reflects in all directions View independent Dependent on object's shape Dependent on location of light source Examples: chalk, tire
Specular See light source directly reflected on the surface View dependent Dependent on object's shape Dependent on location of light source Examples: mirror, shiny plastic, metal Lighting Demo
What is Networking? Basically, the transfer of data from one computer to another. In the Internet, data transfer is divided into packets.
But, What's It Good For File Transfer Web Pages Streaming Audio/Video Instant Messaging
UNC UNC is one of the top places for networking research –"up and coming“
UNC Examples Traffic Monitoring and Modeling –what does Internet traffic look like? –certain times of the year, we record the header information (size, when sent) of every packet leaving UNC don't worry -- it's anonymous Congestion Control –how to send packets most efficiently RTT Variability –why does one packet in a connection take so much longer to arrive than another packet?
Jobs in Networking BS –programmer –(+ various certifications) systems administrator / network administrator MS –developer / architect –mainly affects starting level PhD –research Typical Job Path testing and support programmer designer architect management
Internet Components local ISP company network regional ISP LAN –local-area network –home network, campus network WAN –wide-area network –connects multiple LANs over long distances
The Internet The Internet is a WAN which spans the entire planet –started as a US government project The word Internet comes from the term internetworking, which implies communication among networks Less than 600 computers were connected to the Internet in 1983; now there are many millions.
MCI (Verizon) Backbone
TCP/IP A protocol is a set of rules that determine how things communicate with each other Most of the software which manages Internet communication follows a suite of protocols called TCP/IP The Internet Protocol (IP) determines the format of the information as it is transferred The Transmission Control Protocol (TCP) handles lost information
Hi Do you have the time? Yes! It’s 2:00 TCP connection request Get Time Human protocols What time is it? Computer protocols What time is COMP 110? What is a Protocol? Example A specification for a set of message exchanges TCP connection reply
IP and Internet Addresses Each computer on the Internet has a unique IP address, such as: Most computers also have a unique Internet name, which is also referred to as an Internet address: bayou.unc.edu The first part often indicates a particular computer (bayou) The rest is the domain name, indicating the organization (unc.edu)
Domain Names The last section (the suffix) of each domain name usually indicates the type of organization: edu - educational institution com - commercial business org - non-profit organization Sometimes the suffix indicates the country: New suffix categories are being considered uk - United Kingdom au - Australia ca - Canada se - Sweden
Domain Names A domain name can have several parts –ex: unc.edu, cs.unc.edu, math.unc.edu Unique domain names mean that multiple sites can have individual computers with the same local name –ex: curie.cs.unc.edu, curie.duke.edu When used, an Internet address is translated to an IP address by software called the Domain Name System (DNS) There is no one-to-one correspondence between the sections of an IP address and the sections of an Internet address
Your Machine Your Friend's Machine SMTP Server (smtp.unc.edu) IMAP / POP Server (hotmail.com) Internet msg check msgs
The Web Base page size: 64 KB 33 embedded images –smallest: 43 B –largest: 20 KB
The Web HTTP request HTTP response Your Machine Web Server Web browser sends a separate request for each object (e.g., embedded image) on the web page Requests are usually much shorter than responses HyperText Transfer Protocol
The Web What Happens When You Click A Link? Browser examines the URL and determines the protocol and remote machine it must access –protocol = http –remote machine = (web server in the CS dept) Browser uses TCP/IP protocols to establish a connection with remote machine
The Web What Happens When You Click A Link? Once connection established, send HTTP message GET specifying page to access –GET ~stough/index.html Remote machine sends a copy of page to your browser using TCP/IP Your browser receives and displays its contents
Setting Up Your Web Page Choose "Subscribe to Services" Choose WWW –creates a public_html folder in your AFS space (H: drive) Anything you put in your public_html folder will be accessible at
index.html Use Notepad to create index.html –should be saved in your new public_html folder Sample: My Web Page My Web Page Welcome to my web page! I'm a student at the University of North Carolina at Chapel Hill.
index.html Another Sample My Web Page My Web Page Welcome to my web page! I'm a student at the University of North Carolina at Chapel Hill. In Fall 2007, I took COMP 110.
Interested in Web Programming? COMP 416 Taught in Fall Prerequisite: COMP 410
Medical Image Analysis