This is not a flower, it's really a llama

Monday, April 30, 2012

Graphics and performance analysis

Computer graphics involves art and math.  A three-dimensional model (the art) was rendered (the math) into this image.


Wikipedia contains an excellent article on rendering.  Here are a few highlights.

A polyhedron is a finite approximation of a surface.  Computer graphics uses 3D triangle meshes.

A window is a rectangular section of a display screen, and is represented (sampled) by an array of finite-sized pixels, each of has a color value that is represented by a finite number, quantized from some color-space.

Rendering is done in three major steps:
* The polyhedra are transformed and projected into an image-space
* Each triangle of each polyhedron is rasterized – that is, a calculation is done to determine which pixels in the window lie within the bounds of the triangle in image-space
* The color value is calculated for each pixel, using interpolated values from the three vertices of the triangle that the pixel lies within

For a large model, this math takes a lot of computational power.  Graphics performance analysis is an attempt to make the computer perform the math fast.  If the math can be done faster than the vertical-sync rate of the display hardware (usually 30 or 60 frames per second), then the graphics run in real-time.

On mobile and lightweight devices, the graphics not only need to be fast, but also use low-power and low-memory.

No comments: