16
How to get a perfect score By Johnny Ho

How to get a perfect score

  • Upload
    evonne

  • View
    67

  • Download
    0

Embed Size (px)

DESCRIPTION

How to get a perfect score. By Johnny Ho. Why get a perfect score?. Free Gold Medal Pride Beat Gennady Korotkevich 2009-2011: 1st place 2012: 2nd place Fame Get Interviewed Get mentioned at rallies (but don't go and play frisbee outside instead) GIRLS - PowerPoint PPT Presentation

Citation preview

Page 1: How to get a perfect score

How to get a perfect score

By Johnny Ho

Page 2: How to get a perfect score

Why get a perfect score?

• Free Gold Medal• Pride

o Beat Gennady Korotkevich 2009-2011: 1st place 2012: 2nd place

• Fameo Get Interviewedo Get mentioned at rallies (but don't go and play frisbee outside

instead)

• GIRLSo Many, many girls will be gazing at your face all dayo You will need a priority queue to handle them allo Johnny Ho has many many girls.

Page 3: How to get a perfect score

Computer graphics

the actual meeting topic

Page 4: How to get a perfect score

How to draw a point

• Fill in a pixel:

• *applause*

Page 5: How to get a perfect score

How to draw on an LCD screen

• Most LCDs come with three channels• Mix the red, green, and blue channels to make

colors

Page 6: How to get a perfect score

How to draw a line segment

• Imagine the bounding box of the line segment• Take the maximum of the two dimensions• Sweep across that dimension and fill in the

corresponding pixel

Page 7: How to get a perfect score

• To be lazy, first decompose into triangles• How to draw a triangle:

o Sweep across y coordinate and fill in points that lie within left and right intersection

o Round x coordinates properly to avoid aliasing

How to draw a polygon

Page 8: How to get a perfect score

• Remember this?• Take advantage of subpixel structure• Calibri 8pt, zoomed in:

o Microsoft ClearType

• ~3x horizontal resolution• Variation in color is largely undetectable by

human eye

How to draw text (very trickily)

Page 9: How to get a perfect score

How to draw a 3d object

• Again, first decompose into triangles• Give each triangle a color depending on angle

towards light source• How to draw a 3D triangle:• Apply a perspective transformation

o Basically, just divide x and y coordinates by z coordinate to obtain x' and y' coordinates

o Then draw 2d triangle

Page 10: How to get a perfect score

Demo

• Link• [code not included because of ugliness]• Z-buffering

o Save Z coordinate as well as actual colorso Determine which pixels of the object are closer to camera

• Interpolationo Interpolate between the three points of each triangle to improve

smoothness

Page 11: How to get a perfect score

Phong shading

• Adds a specular layer• Previously named techniques only incorporate

diffuse• Results in plastic texture

Page 12: How to get a perfect score

Shadow maps

Page 13: How to get a perfect score

Soft shadows

Page 14: How to get a perfect score

Raytracing

Credits to http://users.softlab.ntua.gr/~ttsiod/renderer.html for his amazing renderer/raytracer

Page 15: How to get a perfect score

Solution to last week's PotWFind # common factors = # factors of gcd

int ans=0, g=gcd(n, m);for(int i=1;i*i<=g;i++) {if(g%i==0) {

ans+=2;if(i*i==g) ans--;}

}return ans;

public int gcd(int a, int b) {return b==0 ? a : gcd(b, a%b);}

Page 16: How to get a perfect score

PotW

• Go home and search up more awesome computer graphics stuff! :D

• (no, you don't actually get points for this)