Introduction to Computer Graphics
Understand the fundamentals of computer graphics, covering the raster pipeline, vector vs. raster techniques, texture mapping, animation, physical simulation, and interactive applications such as AR/VR.
Summary
Read Summary
Flashcards
Save Flashcards
Quiz
Take Quiz
Quick Practice
How is computer graphics defined in terms of its primary actions?
1 of 23
Summary
Introduction to Computer Graphics
What is Computer Graphics?
Computer graphics is the field of using computers to create, manipulate, and display visual images. At its core, computer graphics answers a fundamental question: how do we turn mathematical descriptions of shapes, colors, and light into pictures that appear on our screens?
Computer graphics is everywhere. It powers the realistic visuals in video games, creates the stunning effects in movies, enables scientists to visualize complex data from medical scans or climate models, and helps engineers design and test products before they're built. Whether you're using an app on your phone, watching a movie with visual effects, or exploring a virtual environment in a headset, computer graphics is working behind the scenes.
What makes computer graphics interesting is that it's inherently interdisciplinary. It combines mathematics (especially geometry and linear algebra to describe shapes and transformations), physics (to simulate how light interacts with surfaces), and art (to create visually appealing and meaningful images). Understanding computer graphics means understanding how these fields work together.
The Raster Graphics Pipeline
How Modern Graphics Are Created
The raster graphics pipeline is the standard method used to produce the images we see on modern screens. Rather than thinking of an image as a continuous, smooth drawing, the raster pipeline breaks the process down into a series of distinct steps, each one transforming the data until we have a final image made up of pixels.
To understand the pipeline, we first need to understand what we're starting with: a 3D model. A 3D model consists of points in space called vertices. These vertices are connected together to form polygons (usually triangles), which define the surfaces of objects. The entire pipeline's job is to take these abstract mathematical descriptions and turn them into the colored pixels that appear on your screen.
The pipeline proceeds through several stages: transformations position the model in space, rasterization converts geometry into pixels, shading calculates what color each pixel should be, and finally the image is output to the screen.
Step 1: Model and View Transformations
Before we can draw anything, we need to position our objects in space and set up a virtual camera to view them.
Model transformations take a 3D model described in its own local coordinate system and convert those coordinates into world coordinates—a shared coordinate system for the entire scene. Think of this like placing a physical object at a specific location in a room. If you have a character model that was designed with its feet at the origin, a model transformation might move it 10 units to the right and rotate it 45 degrees so it's positioned correctly in your scene.
View transformations then position a virtual camera relative to the world. Just as a photographer chooses where to stand, what direction to point the camera, and what lens to use, a view transformation determines where the viewer is located and what they're looking at. This is like setting up the camera to capture the scene from a specific angle.
After these transformations, we have the scene positioned in 3D world space from a particular viewpoint.
Step 2: Projection Transformation
Next, we need to convert our three-dimensional scene into a two-dimensional image that can fit on a screen. This is the job of projection transformation.
Projection transformations take 3D world coordinates and squash them into 2D screen coordinates. This is similar to how a camera lens focuses light from a 3D world onto a 2D film. Objects further away appear smaller, and the geometry is distorted in a way that matches how we perceive depth. The most common projection is perspective projection, which mimics how our eyes see the world.
After projection, we have 2D coordinates describing where objects should appear on the screen, but we haven't actually drawn anything yet.
Step 3: Rasterization
Now we face a critical challenge: we have precise mathematical descriptions of geometry (vertices connected by polygons), but a screen is made of a regular grid of pixels. We need to convert the continuous geometry into discrete pixels. This process is called rasterization.
Rasterization determines which pixels on the screen are covered by each polygon. For a triangle, this means figuring out which pixel grid cells the triangle overlaps. This is actually more complex than it sounds—we need to handle edge cases carefully and ensure that adjacent polygons fit together without gaps or overlaps.
One important side effect of rasterization is that curves and diagonal lines can appear jagged because they're being approximated by a grid of square pixels. To solve this, anti-aliasing techniques smooth these jagged edges by blending colors at the boundaries.
Step 4: Shading and Lighting
At this point, we know which pixels are covered by which parts of the geometry, but we haven't assigned colors yet. The shading stage determines what color each pixel should be.
Shading takes into account three key factors: the material properties of the surface (how shiny is it? what's its base color?), the lights in the scene (where are they? how bright are they?), and a shading algorithm that combines these to calculate a final color.
Phong Shading
One of the most widely-used shading algorithms is Phong shading. Phong shading computes a pixel's color by combining three components of light:
Ambient light is a baseline light that's applied uniformly everywhere. It represents light that has bounced around the scene so much that its direction is no longer meaningful. Without ambient light, surfaces facing away from light sources would be completely black, which looks unrealistic.
Diffuse light depends on the angle between the surface normal (a vector perpendicular to the surface) and the direction to the light source. Surfaces facing the light are bright; surfaces at an angle are dimmer. This is what gives objects their basic shading and makes them appear three-dimensional.
Specular light creates highlights—bright spots that appear on shiny surfaces when they face the light source directly. The size and intensity of these highlights depend on the surface's shininess. A shiny object like polished metal has sharp, bright specular highlights, while a matte object like cloth has no specular highlights at all.
Physically Based Rendering
While Phong shading is effective and efficient, it doesn't always produce realistic results for all materials. Physically based rendering (PBR) takes a different approach: instead of using artistic parameters like shininess, PBR uses mathematically accurate material properties that are based on real-world physics. This allows surfaces to interact with light in a more realistic way, especially for materials like metals and ceramics. PBR has become increasingly important in games and films where photorealism is desired.
Step 5: Output to Screen
Finally, the graphics processing unit writes the completed image to your screen. For interactive applications like games, this happens in real time—the entire pipeline runs many times per second (typically 60 times per second or more) to create smooth animation.
For non-interactive media like animated movies, the pipeline can take much longer per frame. Software rendering generates images offline, allowing for higher quality results since there's no need to render in real time. A single frame in a modern movie might take hours to render on a powerful computer.
Vector and Raster Graphics Techniques
While the raster graphics pipeline is the dominant method for real-time graphics, it's important to understand that there are different ways to represent and store images. The two main approaches are vector graphics and raster graphics, and each has distinct advantages.
Vector Graphics
Vector graphics represent shapes using mathematical equations. Instead of storing a grid of colored pixels, vector graphics store descriptions of lines, curves, and other geometric shapes. A circle in vector graphics might be represented as "a circle centered at (100, 200) with radius 50, filled with blue." This mathematical description is scale-independent—you can zoom in as much as you want and the circle will always be perfectly smooth and crisp.
Vector graphics remain sharp and clear at any resolution and any scale. If you print a vector graphic on a large billboard or zoom in 1000% on a computer screen, the edges are always clean and smooth. This makes vector graphics ideal for:
Logos and branding that need to look perfect at any size, from tiny website icons to large building signs
Fonts and typography where sharp edges and precise proportions are essential
Computer-aided design (CAD) drawings where accuracy matters
Scalable diagrams and illustrations that need to adapt to different contexts
The trade-off is that vector graphics are less suitable for photorealistic images. Representing a photograph as curves and mathematical equations would be impractical.
Raster Graphics
Raster graphics take the opposite approach—they store a fixed array of colored pixels. A digital photograph, for example, is raster graphics: it's a grid of pixel values, typically stored with 8 bits per color channel (red, green, blue), giving 256 possible values per color.
The resolution of a raster image—the number of pixels in the grid—determines both the level of detail and the file size. A higher resolution image has more pixels and can represent finer details, but also requires more storage space.
Raster graphics are excellent for photorealistic images and complex visual details, but they have a limitation: they're resolution-dependent. If you zoom in on a raster image, you'll eventually see individual pixels and the image will appear blurry or pixelated. If you enlarge a raster image beyond its native resolution, the scaling algorithm has to guess what colors the new pixels should be, which often results in a blurry or jagged appearance.
Anti-aliasing
One of the challenges of raster graphics is that when you rasterize continuous geometric shapes (like lines or curves) onto a pixel grid, you often get jagged, stair-step edges. Anti-aliasing fixes this problem by blending colors at the edges of shapes. Instead of a pixel being either fully covered or not covered by a shape, anti-aliasing allows partially covered pixels to have intermediate colors. This smooths out the jagged edges and makes the image look more natural.
Texture Mapping
One of the most powerful techniques in computer graphics is texture mapping: the ability to "paint" detailed image patterns onto the surfaces of three-dimensional objects. Instead of having to define every detail of an object's surface with individual polygons, texture mapping allows us to apply a 2D image (called a texture) to 3D geometry.
Imagine a simple cube made of 8 vertices and 6 square faces. Without texture mapping, each face would be a solid color. With texture mapping, you could make it look like a brick wall, wood planks, or any other detailed surface by applying an image to it. This is incredibly efficient and is used extensively in games, films, and any other real-time graphics application.
Texture Coordinates
The key to texture mapping is texture coordinates. Each vertex of your 3D geometry has not only 3D position information, but also texture coordinates (usually called U and V, so they're sometimes called UV coordinates).
Texture coordinates range from 0 to 1 in each dimension and define where on the texture image that vertex maps to. For example, the top-left corner of a surface might have texture coordinates (0, 0), the top-right corner might be (1, 0), and so on. When the rasterizer draws a triangle, it interpolates these texture coordinates across the triangle's surface. For each pixel being drawn, it knows exactly which part of the texture image to look up the color from.
This system is very flexible. You can stretch, shrink, or repeat textures across surfaces. You can even map the same texture image to multiple objects in different ways.
Texture Filtering and Mipmapping
When rendering, a triangle on the screen might be much smaller or much larger than the original texture image, so texture colors rarely map exactly to screen pixels. Filtering determines how texture colors are combined or interpolated.
The simplest method is nearest-neighbor filtering: for each screen pixel, we look up the single nearest texel (texture pixel) in the texture image. This is fast but can look blocky or pixelated.
Bilinear filtering is higher quality: it looks at the four nearest texels and blends their colors based on how close the texture coordinate is to each one. This produces smoother results.
However, there's a deeper problem: when a triangle is far from the camera, it projects to very few screen pixels, but its texture might still be high resolution. If we naively sample from the full-resolution texture, different pixels on the screen might read from distant locations in the texture, causing visual artifacts and performance problems.
Mipmapping solves this elegantly. A mipmap is a series of progressively smaller copies of the texture image. The full resolution is the base level. The next level down is half the width and height (1/4 the area). The next is half again, and so on, until you reach a single pixel. When rendering, the graphics system chooses which mipmap level to sample from based on how large the triangle is on screen. Far-away objects use lower resolution mipmaps, improving both performance and visual quality. The texture lookups at each level are still filtered (usually with bilinear filtering), so the result is smooth.
Animation
Static images are interesting, but animation brings graphics to life. There are several approaches to animating objects and characters in computer graphics, each with different strengths.
Keyframe Animation
Keyframe animation is conceptually simple: the animator defines the important poses of an object at specific moments in time, called keyframes. These might be the extreme positions of a moving object or the characteristic poses of an animated character.
For example, to animate a bouncing ball, you might define keyframes at:
Frame 0: Ball at ground level
Frame 10: Ball at the peak of its bounce
Frame 20: Ball back at ground level
But you don't manually define every frame in between. That's where interpolation comes in.
Interpolation
Interpolation automatically generates the intermediate poses between keyframes, creating smooth motion. The simplest approach is linear interpolation: if a ball is at position 0 at frame 0 and position 100 at frame 10, then at frame 5 (halfway between), it's at position 50.
For many cases, linear interpolation works well. However, it can sometimes produce motion that feels mechanical or unnatural. Spline interpolation uses smooth curves to transition between keyframes, creating more natural-looking motion. Common splines for animation include Catmull-Rom splines and cubic Bézier curves.
Skeletal Animation
For complex characters, defining keyframes for the entire character's position at each frame would be extremely tedious. Skeletal animation provides a more practical solution.
In skeletal animation, a character model is built with an internal hierarchy of bones. Imagine a human skeleton: there's a spine, which has ribs attached, which have a ribcage, and the shoulders connect to the spine, the upper arms to the shoulders, the lower arms to the upper arms, and so on. When you move the upper arm bone, the lower arm and hand move with it because they're connected in the hierarchy.
The animator defines keyframes not for every vertex of the character mesh, but only for the bones. The bones rotate and translate, and the mesh vertices are deformed to follow the bones. This is called skinning or skeletal deformation. Each vertex of the mesh is typically influenced by multiple nearby bones, with weights that determine how much each bone affects that vertex.
This approach is much more efficient than keyframing every vertex individually, and it produces natural-looking character animation.
<extrainfo>
Advanced Animation Techniques
Beyond keyframe animation, there are more advanced techniques:
Motion capture records the real movements of actors and applies them to animated characters, producing very realistic motion
Procedural animation generates motion algorithmically based on rules or physics, useful for characters with many legs or tentacles that would be impractical to hand-animate
Blend shapes (also called morphs) define multiple different mesh configurations and blend between them, useful for facial animation and other deformations
</extrainfo>
<extrainfo>
Physical Simulation
For realistic motion and behavior, many graphics applications use physical simulation—running a physics engine to compute how objects move and deform based on forces like gravity, collisions, and friction.
Cloth Simulation
Cloth simulation models fabric behavior using a network of interconnected particles and springs. Each particle represents a small area of cloth and has properties like mass and velocity. Springs connect neighboring particles and exert forces to keep them at appropriate distances from each other. By solving the forces on each particle and integrating their motion over time, the cloth naturally drapes, sways, and wrinkles in response to forces like gravity and collisions with the body underneath. This is used extensively in films and games for realistic clothing animation.
Fluid Simulation
Fluid simulation solves the mathematical equations of fluid dynamics (the Navier-Stokes equations) to animate water, smoke, fire, and other fluid phenomena. These simulations divide space into a grid, track how fluid moves from cell to cell, and calculate how pressure, viscosity, and external forces affect the fluid's motion. Fluid simulation is computationally expensive but produces remarkably realistic results for water splashes, smoke effects, and fire.
Particle Systems
Particle systems represent many small objects—like sparks, rain droplets, dust, or debris—using simple physics rules. Rather than simulating each particle individually with complex physics, particles follow simple rules: they fall under gravity, bounce off surfaces, and may emit other particles. By using thousands or millions of simple particles, complex effects like explosions, fireworks, or dust clouds can be created efficiently.
</extrainfo>
<extrainfo>
Human-Computer Interaction in Graphics
Virtual and Augmented Reality
Modern graphics technology has enabled entirely new ways for humans to interact with computers.
Virtual reality (VR) immerses the user completely in a computer-generated three-dimensional environment. The user wears a headset that displays a slightly different image to each eye, creating a stereoscopic 3D view. As the user moves their head, the view updates in real time so they feel present in the virtual world. Hand controllers let them interact with objects in the environment. VR is used for games, training simulations, and virtual tourism.
Augmented reality (AR) takes the opposite approach: it blends computer-generated images with a live view of the real world. Using a phone camera, AR tablet, or AR glasses, virtual objects appear to be placed in the real environment. You might use AR to visualize how furniture would look in your home before buying it, or to see navigation arrows overlaid on the real streets in front of you. AR enhances the real world rather than replacing it.
User Interface Graphics
User interface (UI) graphics are the visual elements that help users interact with software: icons, buttons, menus, text, and other visual components. While UI graphics might seem simple compared to 3D graphics or visual effects, creating effective, beautiful, and usable user interfaces is its own complex discipline involving both technical knowledge and design principles.
</extrainfo>
<extrainfo>
Applications of Computer Graphics
Computer graphics extends far beyond entertainment. It's a tool for understanding and communicating across many fields.
Scientific Visualization
Scientific visualization renders data as images to help scientists understand complex phenomena. A medical researcher might visualize a 3D reconstruction of brain tissue from MRI scans to identify tumors. A climate scientist might render global temperature or wind data as a beautiful, interactive globe. An engineer might visualize stress patterns in a bridge design to identify weak points. By turning data into images, scientists can spot patterns and anomalies that might be invisible in raw numbers.
Design and Engineering
Design and engineering employ computer graphics for product modeling, architectural visualization, and simulation. An architect can create a virtual walkthrough of a building before it's constructed. A car designer can examine how light reflects off different surfaces and materials. Engineers can simulate how products will behave under stress or in different environments. These applications have dramatically reduced the time and cost of design by allowing exploration and testing in the virtual world before committing to physical prototypes.
</extrainfo>
Flashcards
How is computer graphics defined in terms of its primary actions?
Creating, manipulating, and displaying visual images using computers.
What core disciplines are combined in the field of computer graphics?
Mathematics, physics, and art.
What are the individual points that make up a three-dimensional model called?
Vertices.
What is the purpose of model transformations in the graphics pipeline?
To convert a model's local coordinates into world coordinates.
What is the function of view transformations?
Positioning the virtual camera relative to the world coordinates.
Which transformation converts 3D world coordinates into 2D screen coordinates?
Projection transformations.
What occurs during the rasterization stage of the pipeline?
Continuous geometry is converted into a regular grid of pixels.
What determines the color assigned to a pixel during the shading process?
Material properties, lights in the scene, and a shading algorithm.
What are the three light components used in Phong shading to compute pixel color?
Ambient
Diffuse
Specular
In what scenario is software rendering typically used instead of real-time GPU rendering?
Generating images offline for non-interactive media like animated movies.
How are shapes stored in vector graphics?
As mathematical equations (e.g., lines, curves, and Bézier splines).
Why do vector graphics remain crisp regardless of how much they are scaled?
They are resolution independent.
What comprises the fixed array used to store raster graphics?
Pixels (picture elements).
What is the purpose of anti-aliasing methods in raster graphics?
To smooth jagged edges.
What is the core concept of texture mapping in 3D graphics?
Painting detailed image patterns onto the surfaces of 3D objects.
How is a point on a surface linked to a point in a texture image?
Through texture coordinates.
What does filtering determine in the context of texture mapping?
How texture colors are interpolated between neighboring pixels.
How does mipmapping improve performance and visual quality for distant objects?
By storing and using reduced-resolution copies of a texture.
What process creates smooth motion by generating intermediate poses between keyframes?
Interpolation.
How is fabric behavior typically modeled in cloth simulation?
Using a network of interconnected particles and springs.
What is the mathematical basis for animating phenomena like water, smoke, and fire?
The equations of fluid dynamics.
What are particle systems used to represent in computer graphics?
Many small objects (e.g., sparks, rain, or dust) governed by simple physics.
How does augmented reality (AR) differ from virtual reality (VR)?
AR blends computer images with the real world, while VR immerses the user in a completely generated environment.
Quiz
Introduction to Computer Graphics Quiz Question 1: Why do vector graphics stay crisp when scaled?
- Because they are resolution independent (correct)
- Because they use higher pixel counts
- Because they store color information per pixel
- Because they rely on anti‑aliasing techniques
Introduction to Computer Graphics Quiz Question 2: What does fluid simulation solve to animate fluids?
- Equations of fluid dynamics (correct)
- Algorithms for polygon clipping
- Linear algebra for vertex transformations
- Particle system rules for sparks
Introduction to Computer Graphics Quiz Question 3: What is the most common method used today for producing computer graphics?
- The raster graphics pipeline (correct)
- Ray tracing without rasterization
- Procedural generation only
- Vector drawing with SVG alone
Introduction to Computer Graphics Quiz Question 4: What basic elements does a cloth simulation use to model fabric behavior?
- Interconnected particles and springs (correct)
- Rigid bodies linked by hinges
- Voxel grids with marching cubes
- Bezier curves controlling surface tension
Introduction to Computer Graphics Quiz Question 5: Which technology combines computer‑generated images with a live view of the real environment?
- Augmented reality (correct)
- Virtual reality
- Ray tracing
- Procedural generation
Introduction to Computer Graphics Quiz Question 6: Which three actions does computer graphics perform using computers?
- Create, manipulate, and display visual images (correct)
- Store, encrypt, and transmit data
- Analyze, sort, and visualize text documents
- Generate, compress, and stream audio signals
Introduction to Computer Graphics Quiz Question 7: What is the primary purpose of anti‑aliasing methods in raster graphics?
- To smooth jagged edges in rendered images (correct)
- To increase the number of pixels in an image
- To compress image files for faster download
- To convert vector shapes into raster pixels
Introduction to Computer Graphics Quiz Question 8: What does texture mapping achieve on three‑dimensional objects?
- Paints detailed image patterns onto object surfaces (correct)
- Reduces the polygon count of the model
- Calculates physical collisions between objects
- Generates procedural geometry from equations
Introduction to Computer Graphics Quiz Question 9: What structure does skeletal animation use to drive deformation of a character’s mesh?
- A hierarchy of bones (correct)
- A set of predefined keyframes
- A particle system representing skin
- A grid of control points for NURBS
Introduction to Computer Graphics Quiz Question 10: What does rasterization do in the graphics pipeline?
- Converts geometric primitives into pixels on a grid (correct)
- Applies lighting calculations to vertices
- Maps textures onto surfaces
- Transforms world coordinates to screen coordinates
Introduction to Computer Graphics Quiz Question 11: Which process creates the intermediate poses between keyframes in animation?
- Interpolation (correct)
- Lighting calculations for each pixel
- Texture filtering for magnification
- Collision detection between objects
Introduction to Computer Graphics Quiz Question 12: What type of graphics technique models many small objects like sparks and rain droplets using simple physics?
- Particle systems (correct)
- High‑resolution texture generation
- Rigid body dynamics of large structures
- Global illumination algorithms
Introduction to Computer Graphics Quiz Question 13: What is the function of view transformations in the raster graphics pipeline?
- They position the virtual camera relative to the world coordinates (correct)
- They convert local model coordinates to world coordinates
- They map 3D world coordinates to 2D screen coordinates
- They assign colors to pixels based on lighting
Introduction to Computer Graphics Quiz Question 14: Which technology immerses the user in a fully computer‑generated three‑dimensional environment?
- Virtual reality (correct)
- Augmented reality
- 2D graphical user interfaces
- Stereoscopic 3‑D movies
Introduction to Computer Graphics Quiz Question 15: In keyframe animation, what are the frames called where an object's pose is explicitly defined?
- Keyframes (correct)
- Morph targets
- Render passes
- Texture frames
Why do vector graphics stay crisp when scaled?
1 of 15
Key Concepts
Graphics Techniques
Computer graphics
Raster graphics pipeline
Vector graphics
Texture mapping
Physically based rendering
Animation and Simulation
Keyframe animation
Physical simulation
Immersive Technologies
Augmented reality
Virtual reality
Scientific visualization
Definitions
Computer graphics
The field that creates, manipulates, and displays visual images using computers.
Raster graphics pipeline
The sequence of steps that transforms 3D models into 2D pixel images for display.
Vector graphics
Image representation that stores shapes as mathematical equations, allowing resolution‑independent scaling.
Texture mapping
Technique of applying image patterns to the surfaces of 3D objects to add detail.
Keyframe animation
Method of defining important poses at specific times and interpolating between them to produce motion.
Physical simulation
Computational modeling of real‑world phenomena such as cloth, fluids, and particle effects.
Augmented reality
Technology that overlays computer‑generated graphics onto a live view of the real world.
Virtual reality
Immersive system that places the user inside a fully computer‑generated three‑dimensional environment.
Scientific visualization
Use of computer graphics to render complex data sets into understandable visual forms.
Physically based rendering
Rendering approach that simulates realistic light interaction using accurate material models.