CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

31
CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review

Transcript of CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Page 1: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

CS 445: Introduction to Computer Graphics

David Luebke

University of Virginia

Review

Page 2: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Admin

Course evaluations: please do during class today (available on Toolkit)

Page 3: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Math

Mathematical foundations– Vector arithmetic – Affine spaces: points, vectors, scalars– Parametric representation of a line/ray/segment– Dot product, cross product– Matrix-matrix and matrix-vector arithmetic

Page 4: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Display technologies

CRTs– Underlying technology– Vector vs. raster– Framebuffer, pixel, scanline, rasterize

LCDs– Underlying technology– Pros & cons

Other – don’t need to know details– Plasma display– OLED

Page 5: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Rendering pipeline

Know the various stages:– Transforms

Modeling Camera Projection

– Illuminate– Clip– Homogeneous divide– Rasterize

Be able to reason about which stages go where

Page 6: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.
Page 7: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Transformations

Modeling transforms– Objectworld coords– Common xforms:

Translate Rotate Scale (uniform vs. nonuniform)

– Composing xforms Multiplying matrices – know the correct order! Be able to compose a rotation matrix about an arbitrary axis Be able to compose rotation & translation matrices

Page 8: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Transformations

Homogeneous coordinates– Homogeneous coordinate akin to a scale factor– Homogeneous points vs. vectors– Enables translation, projection

Projection transforms– Uses the homogeneous coordinate– Be ready to reason about simple projection xforms

Page 9: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

OpenGL

Specifying transforms– Understand how to use the matrix stacks

GL_MODELVIEW GL_PROJECTION

– Understand the principles of hierarchical transforms Nest xforms Functions shouldn’t have side effects

– Understand the concept of a scene graph

Page 10: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Clipping

2D: Cohen-Sutherland– Outcodes & how to use them– Clipping a line segment to an edge

3D: Sutherland-Hodgeman Clipping in the graphics pipeline

Page 11: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Rasterization

Line rasterization– DDA– Optimization strategies

Triangle rasterization– Edge walking– Edge equations

Polygon rasterization– Parity test– Active edge table

Page 12: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Color

Physiology of the eye– Cornea, lens, retina– Photoreceptors

Rods (low light, luminance) vs. cones (high light levels, color) Color-sensitivity of cones: S, M, L (B, G, R) Density: fovea (high spatial resolution, all cones) vs. periphery

(low spatial resolution, largely rods)

– Metamers: different spectra with the same perceptual response

E.g., a monochromatic orange light (spectral spike) vs. combinations of red, green, tiny bit of blue: same perceived color!

– Color gamuts and CIE chromaticity diagram

Page 13: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

The Human Visual System

The human visual system has four types of sensors: rods and S, M, and L cones

νν

11

0.10.1

0.010.01

1010

100100

rodsrods

conesconesLL

MM

SS

sensitivitysensitivity

Court

esy

Nath

anie

l H

off

man

Page 14: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Rods are the most sensitive– Used in weak illumination (scotopic) conditions– Sensitivity peaks at cyan (blue-green)– Only one kind: monochromatic vision

Cones enable color vision– Used in strong illumination (photopic) conditions– Total sensitivity peaks at yellow-green– Three kinds: trichromatic vision

The Human Visual System

Courtesy Nathaniel Hoffman

Page 15: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

The Human Visual System

Trichromatic vision enables us to somewhat sense the spectral distribution

νν

0.50.5

0.250.25

11

LL

MM

SS

sensitivitysensitivity

0.10.1

Courtesy Nathaniel Hoffman

Page 16: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Metamers

A spectral power distribution is an infinite-dimensional signal.

Since we perceive color only as a three-dimensional signal, there is an infinite number of different spectral power distributions which map onto the same perceived color.

These are known as metamers.

Courtesy Nathaniel Hoffman

Page 17: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Metamers700nm

600nm

500nm

400nm

470nm

480nm

white

spectrallocus

more blue

more redmore green

more yellow

Courtesy Nathaniel Hoffman

Page 18: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Metamers700nm

600nm

500nm

400nm

470nm

480nm

white

spectrallocus

more blue

more redmore green

more yellow

Courtesy Nathaniel Hoffman

Page 19: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Metamers700nm

600nm

500nm

400nm

470nm

480nm

white

spectrallocus

more blue

more redmore green

more yellow

Courtesy Nathaniel Hoffman

Page 20: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Metamers700nm

600nm

500nm

400nm

470nm

480nm

white

spectrallocus

more blue

more redmore green

more yellow

Courtesy Nathaniel Hoffman

Page 21: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Lighting

Illumination models– Global vs. local illumination models– Empirical vs. physically based

Know and understand the Phong model: – Local, empirical, implemented in OpenGL– Ambient, diffuse, and specular terms

Shading: flat vs. smooth (Gouraud) vs. Phong

Page 22: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Phong Lighting:OpenGL Implementation

The final Phong model as we studied it:

OpenGL variations:– Every light has an ambient component– Surfaces can have “emissive” component to simulate glow

Added directly to the visible reflected intensity Not actually a light source (does not illuminate other surfaces)

lights

i

n

sdiambientatotal

shiny

RVkLNkIIkI#

1

ˆˆˆˆ

#

1

ˆ ˆ ˆ ˆ shinylights n

total e a a d d s si

I k I k I k N L I k V R

Page 23: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Visibility in the small

Painter’s algorithm Z-buffer BSP trees: organize all of space (hence partition) into a

binary tree– Preprocess: overlay a binary tree on objects in the scene– Runtime: correctly traversing this tree enumerates objects

from back to front– Idea: divide space recursively into half-spaces by choosing

splitting planes Splitting planes can be arbitrarily oriented Notice: nodes are always convex

Page 24: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Visibility in the large

View-frustum culling Cells & portals (architectural/urban models)

– Cells form the basic unit of PVS– Create an adjacency graph of cells– Starting with cell containing eyepoint, traverse graph,

rendering visible cells – A cell is only visible if it can be seen through a sequence of

portals So cell visibility reduces to testing portal sequences for a line of

sight…

Occlusion query (modern hardware)

Page 25: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Texture mapping

Establishing correspondences (parameterization): texture coordinates

Interpolating texture coordinates in screen space during rasterization

Texture map antialiasing: – know MIP-mapping, be aware of others– Related to antialiasing subject: prefiltering

Applications of texture mapping:– Bump mapping, gloss mapping, displacement mapping, light

mapping

Page 26: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Modern GPUs

Programmable GPUs– Programmable vertex & fragment engines– Render to texture– Floating point precision

Programming model: stream computing– Registers zeroed out, no accumulators across

vertices/fragments– Lends itself to efficient parallel implementation– Cg language

Page 27: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

GPGPU

Trends: GPUs fast, getting faster faster Approach: data as textures, computational kernels as

fragment programs Advance simulation step-by-step using render-to-texture

Page 28: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Ray tracing

Basic algorithm: recursive ray tracing– Reflection– Refraction– Shadows

Ray-primitive intersection– Be able to reason about common primitives, or figure out a

new intersection test Acceleration structures

Page 29: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Antialiasing

Reason at a high level about what aliasing is and how we can prevent/mitigate it– Basic signal theory behind Nyquist limit– Supersampling: pros and cons– Prefiltering: pros and cons– Stochastic supersampling: high freqs noise, not aliases

Page 30: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

LOD

Basic concept (easy) Discrete vs. continuous vs. view-dependent : pros and

cons

Page 31: CS 445: Introduction to Computer Graphics David Luebke University of Virginia Review.

Shadows

Basic concept of shadow volumes– Stencil buffer– Problem case: clipping