introduction and overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · sketchup cse 167, winter...

45
Overview Computer Graphics CSE 167 Lecture 1

Upload: others

Post on 08-Jul-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Overview

Computer Graphics

CSE 167

Lecture 1

Page 2: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

CSE 167: Computer Graphics

• Today

– Course overview

– Logistics

CSE 167, Winter 2020 2

Page 3: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

What is computer graphics?

• Everything visual on computers• The representation and manipulation of image

data by a computer• The various technologies used to create and

manipulate images• The methods for synthesizing and manipulating

visual content using a computer• The manipulation of visual and geometric

information using computational techniques that focus on the mathematical and computational foundations of image generation and processing

CSE 167, Winter 2020 3

Page 4: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

History

• 1940s: Modern digital computers

• 1950s: High-level programming languages and the integrated circuit

• 1950s: Introduction of the cathode ray tube (CRT) as a viable computer display

• 1960s: Operating systems

• 1960: The phrase “computer graphics” is coined

• 1970s: Microprocessor

• 1980s: Personal computers (PCs)

CSE 167, Winter 2020 4

Page 5: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

History

• 1949: Manchester Mark 1

CSE 167, Winter 2020 5

Display

Page 6: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

History

• 1963: Sketchpad

– First interactive graphics system

https://www.youtube.com/watch?v=495nCzxM9PI

CSE 167, Winter 2020 6

Page 7: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

History

• c. 1975: Graphical user interface (GUI)

– Xerox Palo Alto Research Center (PARC)

CSE 167, Winter 2020 7Xerox Alto (1976) Microsoft Windows 1.01 (1985)

Page 8: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

History

• History of computer animation (20 min)

https://www.youtube.com/watch?v=LzZwiLUVaKg

https://www.youtube.com/watch?v=S3hqS6JlKEc

CSE 167, Winter 2020 8

Page 9: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Rendering: 1960s (visibility)• Roberts (1963), Appel (1967): hidden line algorithms

• Warnock (1969), Watkins (1970): hidden surface

• Sutherland (1974): visibility = sorting

CSE 167, Winter 2020 9Images from FvDFH, Pixar’s ShutterbugSlide ideas for history of Rendering courtesy Marc Levoy

Page 10: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Rendering: 1970s (raster graphics, lighting)• Gouraud (1971): diffuse lighting, Phong (1974): specular lighting

• Blinn (1974): curved surfaces, texture

• Catmull (1974): Z-buffer hidden surface algorithm

CSE 167, Winter 2020 10

Page 11: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Rendering: 1980s and 90s (global Illumination)

• Whitted (1980): ray tracing

• Goral, Torrance, et al. (1984): radiosity

• Kajiya (1986): the rendering equation

CSE 167, Winter 2020 11

Page 12: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Modern applications

• Movies

• Video games

• Computer aided design

• Visualization

• Virtual reality

• Augmented reality

• Mixed reality

CSE 167, Winter 2020 12

Page 13: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Entertainment

Movies: Brave, Pixar 2012CSE 167, Winter 2020 13

Page 14: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Entertainment

Games: Halo 3, Bungie 2007 CSE 167, Winter 2020 14

Page 15: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Lighting simulation

Interior Design

Automobile Visualization

CSE 167, Winter 2020 15

Page 16: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Computer aided design

Interiors Professional

Mechanical CADArchitectural CADElectronics CADCasual Users

Sketchup

CSE 167, Winter 2020 16

Page 17: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Visualization: science and medicine

CSE 167, Winter 2020 17

Visible Human Project: University of Hamburg

Page 18: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Virtual reality

• VR for design and entertainment

• Simulators: surgical, flight, driving, spacecraft

CSE 167, Winter 2020 18

Page 19: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Major computer graphics areas

CSE 167, Winter 2020 19

Modeling Animation Rendering

Page 20: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

• The mathematical specification of shape and appearance properties

• Basic 3D models consist of arrays of triangles

• Models are created with 3D modeling tools or constructed from 3D scans

• Models can be procedurally generated (e.g., curves)

Modeling

CSE 167, Winter 2020 20

Procedural tree

Page 21: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Animation

• A technique to create an illusion of motion through a sequence of images

• Keyframing

– Manually animate key frames

– Inbetweening is performed automatically using interpolation

• Motion capture

CSE 167, Winter 2020 21

Page 22: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Rendering

• The creation of shaded images from 3D computer models

• Photorealistic rendering– Physics-based simulation of light– Slow (minutes or hours to render an image)– Used in movies

• Interactive rendering– Often “as photorealistic as possible”– Fast (within milliseconds to render an image)– Used in games

CSE 167, Winter 2020 22

Page 23: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Why study 3D computer graphics?

• Applications • Fundamental intellectual challenges

– Create and interact with realistic virtual world– Requires understanding of all aspects of physical

world– New computing methods, displays, and technologies

• Technical challenges– Math of (perspective) projections, curves, and

surfaces– Physics of lighting and shading– 3D graphics software programming and hardware

CSE 167, Winter 2020 23

Page 24: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

CSE 167 topics

• Vectors, matrices, and linear algebra• Geometric primitives (e.g., points)• Geometric transformations• Coordinate frames• Projection and viewing• Rasterization• Surface shading• Textures• Curves• Ray tracing

CSE 167, Winter 2020 24

Page 25: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Geometric primitives

• Points• Line segments (and chains of connected line segments)• Triangles• And that’s all!

– Curves• Approximate them with chains of line segments

– Polygons• Break them up into triangles

– Curved surfaces• Approximate them with triangles

• Trend over the decades towards minimal primitives– Simple, uniform, repetitive = good for parallelism

CSE 167, Winter 2020 25

Page 26: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Transformations, coordinate frames, projection, and viewing

ModelTransformation M

ViewTransformation V

Object (or Model) Coordinate Frame

World Coordinate Frame

Camera (or Eye) Coordinate Frame

ProjectionTransformation P

Normalized Device Coordinate Frame

ViewportTransformation D

Window (or Screen) Coordinate Frame

World coordinate frame

Object (or model)coordinate frame

Camera (or eye)coordinate frame

View frustum in camera (or eye)

coordinate frame

Canonical view volume in normalized device coordinate frame

(x0, y0)

(x1, y1)

x

y

window

viewport

Window (or screen) coordinate frame

CSE 167, Winter 2020 26

Page 27: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Rasterization

• At each pixel, we need to

determine which triangle

is visible

CSE 167, Winter 2020 27

Page 28: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Local illumination

• Model reflection of light at surfaces

– Assumption: no subsurface scattering

• Bidirectional reflectance distribution function (BRDF)

– Given light direction, viewing direction, how much light is reflected towards the viewer

– For any pair of light/viewing directions!

CSE 167, Winter 2020 28

Page 29: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Local illumination

• Not a physics-based simulation

• Uses simplified models that reproduce perceptually most important effects

– One bounce of light

• Direct (from light source) illumination

– Indirect illumination with an “ambient” term

• Computationally very fast

• Used in interactive applications

CSE 167, Winter 2020 29

Page 30: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Surface normals

• Important to bring out 3D appearance

• Important for correct shading under lights

• The way shading is done also important

– Flat: Each facet has single normal

– Smooth: Each vertex has a single normal, interpolate normal vectors to determine normal at point on facet

Flat

SmoothCSE 167, Winter 2020 30

Page 31: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Large triangles

• Advantages

– Often sufficient for simple geometry

– Fast to render

• Disadvantages

– Per vertex colors look boring and computer-generated

CSE 167, Winter 2020 31

Page 32: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Texture mapping

• Map textures (images) onto surface polygons

• Same triangle count, much more realistic appearance

CSE 167, Winter 2020 32

Page 33: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

APPLICATION

COMMAND STREAM

VERTEX PROCESSING

TRANSFORMED GEOMETRY

RASTERIZATION

FRAGMENTS

FRAGMENT PROCESSING

FRAMEBUFFER IMAGE

DISPLAY

You are here

3D transformations, shading

Conversion of primitives to pixels

Blending, compositing, shading

User sees this

Pipeline overview

CSE 167, Winter 2020 33

Page 34: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Programming hardware pipelines

• Modern hardware graphics pipelines are flexible– Programmer defines exactly what happens at each stage

– Do this by writing shader programs in domain-specific languages called shading languages

– Rasterization is fixed-function, as are some other operations (depth test, many data conversions, …)

• One example: OpenGL and GLSL (GL Shading Language)– Several types of shaders process primitives and vertices;

most basic is the vertex program

– After rasterization, fragments are processed by a fragment program

CSE 167, Winter 2020 34

Page 35: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Interactive rendering results

CSE 167, Winter 2020 35

Page 36: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Two approaches to rendering

for each object in the scene {for each pixel in the image {

if (object affects pixel) {do something

}}

}

object orderor

rasterization

image orderor

ray tracing

for each pixel in the image {for each object in the scene {

if (object affects pixel) {do something

}}

}

CSE 167, Winter 2020 36

Page 37: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Ray tracing algorithm

for each pixel {compute viewing rayintersect ray with scenecompute illumination at visible pointput result into image

}

CSE 167, Winter 2020 37

Page 38: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Photorealistic rendering results

CSE 167, Winter 2020 38

Page 39: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

CSE 167 objectives

• Theory: mathematical aspects and algorithms underlying modern 3D graphics systems

• Systems: development of complex 3D graphics programs

• Note: although we will be using modern OpenGL (3.3 and later), this course is not about the specifics of 3D graphics programs and APIs like Maya, Alias, Direct3D, Vulkan, and Metal, but about the concepts underlying them

CSE 167, Winter 2020 39

Page 40: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Syllabus

• Instructor: Ben Ochoa• TAs: Ronald Baldonado, Yihang (Stacy) Cheng, and Xinming

(David) Zhang• Tutors: Guangyan (Nick) Cai, Kevin Huang, and Wenlin Mao• Course website

– https://cseweb.ucsd.edu/classes/wi20/cse167-a/

• 18 lecture meetings– 2 university holidays (Jan 20 and Feb 17)

• Homework discussion: Thursdays 8:00 PM-8:50 PM• Class discussion

– Piazza

CSE 167, Winter 2020 40

Page 41: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Syllabus

• Grading– 5 homework assignments (80% of grade)

• Significant amount of work, but rewarding

• Start early!

• Graded in person on Fridays, 1:00 PM-3:00 PM

• Late policy: 30% grade reduction– Will not be accepted 1 week after the due date

– Midterm exam (20% of grade)

– No final exam

– Piazza• Ask (and answer) questions using Piazza, not email

• Good participation could raise your grade (e.g., raise a B+ to an A-)

CSE 167, Winter 2020 41

Page 42: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Academic integrity policy

Integrity of scholarship is essential for an academic community. The University expects that both faculty and students will honor this principle and in so doing protect the validity of University intellectual work. For students, this means that all academic work will be done by the individual to whom it is assigned, without unauthorized aid of any kind.

CSE 167, Winter 2020 42

Page 43: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Collaboration policy

It is expected that you complete your academic assignments on your own and in your own words and code. The assignments have been developed by the instructor to facilitate your learning and to provide a method for fairly evaluating your knowledge and abilities (not the knowledge and abilities of others). So, to facilitate learning, you are authorized to discuss assignments with others; however, to ensure fair evaluations, you are not authorized to use the answers developed by another, copy the work completed by others in the past or present, or write your academic assignments in collaboration with another person.

CSE 167, Winter 2020 43

Page 44: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Academic integrity violation

If the work you submit is determined to be other than your own, you will be reported to the Academic Integrity Office for violating UCSD's Policy on Integrity of Scholarship. In accordance with the CSE department academic integrity guidelines, students found committing an academic integrity violation will receive an F in the course.

CSE 167, Winter 2020 44

Page 45: Introduction and Overviewcseweb.ucsd.edu/classes/wi20/cse167-a/lec1.pdf · Sketchup CSE 167, Winter 2020 16. Visualization: science and medicine ... –Slow (minutes or hours to render

Wait list

• Number of enrolled students is limited by

– Size of room

– Number of instructional assistants (TAs and tutors)

• General advice

– Wait for as long as you can

• UCSD policy: concurrent enrollment (Extension) students have lowest priority

CSE 167, Winter 2020 45