40
CS171 Computer Graphics Time: 3pm-3:55pm MW(F) - Location: Annenberg 105 - Text: Mostly Self-Contained on course Web pages Instructor: - Al Barr [email protected] , TAs: - Kevin (Kevli) Li - [email protected] - Nailen Matschke [email protected] - Parker Won [email protected] - Kevin Yuh [email protected] - Andrew Zhao [email protected]

Lecture 1. Overview of Computer Graphics

  • Upload
    volien

  • View
    221

  • Download
    3

Embed Size (px)

Citation preview

Page 1: Lecture 1. Overview of Computer Graphics

CS171 Computer Graphics

Time: 3pm-3:55pm MW(F) - Location: Annenberg 105 - Text: Mostly Self-Contained on course Web pages

Instructor: - Al Barr [email protected],

TAs: - Kevin (Kevli) Li - [email protected] - Nailen Matschke [email protected] - Parker Won [email protected] - Kevin Yuh [email protected] - Andrew Zhao [email protected]

Page 2: Lecture 1. Overview of Computer Graphics

Today’s Topics

Introduction, Definition of Computer Graphics Course Syllabus, Structure of Assignments Examples

- Geometric Modeling - Physically-based Modeling - Rendering - Human-Computer Interaction …

Page 3: Lecture 1. Overview of Computer Graphics

What is Computer Graphics?

… Using computers to construct models and turn them into images …

Models

Images

Computer(s) Computational and Mathematical Model

Representations

Page 4: Lecture 1. Overview of Computer Graphics

Main Areas in Computer Graphics

Modeling – making mathematical representations of objects - e.g., Geometric models - Physical/Newtonian models, Collision models, etc. - Scientific simulation methods (molecular biology, weather, etc.)

Rendering – making images from these representations - Vector images (the oldest CG days, line drawings on paper, pen-plots,

or in analog displays on a radar screen CRT) - Raster images (color images made out of PIXELS) - Stereo images, etc. (one image per eye, etc.) Interaction –

- human /computer, gestural, verbal, comunication methods from humans to computers and back, also human-to-human with computer intermediary, etc.

Page 5: Lecture 1. Overview of Computer Graphics

Computer Graphics

Computer graphics: - Modeling (representations of things) - Rendering, (images of things) - Simulation, - Scientific visualization, and

human/computer interaction. Uses mathematical principles, eg

differential geometry, constrained optimization, integral equations; Physical principles, eg, mechanics

of solids, physics of light. Emphasizes correct underlying

mathematics and on careful realization in efficient, provably robust algorithms

Page 6: Lecture 1. Overview of Computer Graphics

Examples of Rendered Models

Fur “Texels” for light ray probability distributions

“Dynamic constraints” to hold chain links together and do physics

Page 7: Lecture 1. Overview of Computer Graphics

Tentative Course Topics

Introduction and 3D Geometry. Rotation. 4x4 transforms, etc. Intro to Surface Representations (Polygonal, Parametric, Implicit) OpenGL and Event Programming Intro to Visibility, Rasterization Shading, Lighting calculations Ray Tracing Texture Mapping methods Anti-Aliasing, Linear Filtering Theory Quaternions, Dual Quaternions Intro. Animation, Inverse Kinematics GPU Digital filtering

Page 8: Lecture 1. Overview of Computer Graphics

Structure of Assignments

Nine (or so) Assignments, generally due Wed 3pm - See web site, http://courses.cms.caltech.edu/cs171/ - click on Assignments (assignments and policies still being updated)

Assignment 0: relatively straightforward mini-assignment - Setting up the OpenGL development environment, Getting familiar

with using parsers and the C++ Matrix Library Eigen, Outputting images in the Portable Pixel Map (PPM) format

Assignment 1: 3D Wireframe Renderer - Covers 4x4 Geometric Transformations (Translation, Rotation, and

Scaling), World and Camera Coordinate Spaces, Perspective Projection and Normalized Device Coordinates (NDC), Line Rasterization using Bresenham's Line Drawing Algorithm

Page 9: Lecture 1. Overview of Computer Graphics

Assignment 2: 3D Shaded Surface Renderer, - builds on Assignment 1 to render 3D shaded surfaces based on file

input. Covers Triangle Rasterization and Interpolation using Barycentric Coordinates, Surface Normals, Ambient, Diffuse, and Specular Reflections, Lighting Attenuation, Phong Reflection Model (also known as the “standard” Lighting Model), Depth Buffering, Backface Culling, Gouraud and Flat Shading Algorithms

Assignment 3: Intro to OpenGL - You recreate the 3D shaded surface renderer program from

Assignment 2 using OpenGL; add arcball mouse interface. - Covers OpenGL Syntax and Functionality, Arcball Mouse User

Interface

Page 10: Lecture 1. Overview of Computer Graphics

Assignment 4: Animation (To be out) - Two animation programs: one using physics and one using keyframe

interpolation. Covers Time Integrators, Symplecticity, part of Lagrangian Mechanics, The Discrete Lagrangian Integrator, Keyframes, Cubic Splines, Cardinal and Catmull-Rom Splines,Quaternions, Spherical Linear Interpolation (Slerp)

Assignment 5: Meshing and Texturing (To be out) - Render bump mapped textured meshes. Covers Half-Edge Mesh Data

Structure, Texture Mapping and Mipmapping, Surface Normal Computations for Meshes, Bump Mapping

Assignment 6: Ray Tracing (To be out) - Geometric Optics, Shadowing, Reflection, Refraction, alg speedups.

Page 11: Lecture 1. Overview of Computer Graphics

Ray Tracing, HW 6,7

Pinhole Camera algorithm to trace computational light rays “in reverse time” – shadows, reflections, refractions in one method

Images by Al Barr, 1981, Ray Tracing Superquadrics

Page 12: Lecture 1. Overview of Computer Graphics

Ray Tracing, continued

HW 7 Image (2014) by David Warrick

Page 13: Lecture 1. Overview of Computer Graphics

3D Geometry and Physics

Need reliable ways to represent and “run” the model Geometry, movement and configuration of modeled items, cameras, etc. Everything that’s needed for object color, texture, camera motion, etc. Physical interaction properties if objects are supposed to be “physical”

like billiards

Requires a powerful computational approach to scoped Language tools for time dependent shape representation, interaction, etc., also needs very robust mathematical methods.

Many parts of computer graphics involve efforts using Parsers in

line with the need for “Languages”

Page 14: Lecture 1. Overview of Computer Graphics
Page 15: Lecture 1. Overview of Computer Graphics

Inspired by common foundation for Mechanical, Biological simulation

A source of motivation, long term goal for some of the research: the creation of tools for simulation and behavioral prediction of mechanical and biophysical structures

Page 16: Lecture 1. Overview of Computer Graphics
Page 17: Lecture 1. Overview of Computer Graphics

Implicit Fairing of Surface Meshes

Mathieu Desbrun et al, Siggraph 99 Improved set of “parameterization independent” Curvature

flow and Laplacian smoothing operators

Original Previous New

Page 18: Lecture 1. Overview of Computer Graphics
Page 19: Lecture 1. Overview of Computer Graphics

Original Smoothed

Page 20: Lecture 1. Overview of Computer Graphics

Interactive-speed Physical Simulations

Real-time flexible sheets w/ collision and contact constraints implemented on Responsive Workbench Developing methods for combining sheets and real-time

deformable volumes with real-time articulated rigid bodies, with body-body contact constraints. (See Billiards demo, also Flexible demo)

Page 21: Lecture 1. Overview of Computer Graphics

Real-time Flexible sheets

Mathieu Desbrun et al, CGI 99, uses inverse Euler and angular momentum correction – see demo on Responsive Workbench

Page 22: Lecture 1. Overview of Computer Graphics

Old

New Old

New

Finding Global contact points

Page 23: Lecture 1. Overview of Computer Graphics

Level Set methods for Computer Graphics

Representing surface shapes with implicit functions f(x) = 0 3D level-set morphing method that allows topology changes Research for using volumes as ‘first-rate’ modeling

primitives.

Page 24: Lecture 1. Overview of Computer Graphics

Long Term Goals for Physically Based Modeling

Develop robust mathematical methods and a PBM “language”; imitate success of 2D languages used for printing, but for 3D mechanics. Enable nonexpert people to reliably specify, design, control and build

computational models of physical systems of rigid, flexible, and fluid objects. Make PBM and rapid simulation a key enabling technology for Virtual

Engineering, Biological Simulation, Mechanical Simulation, Manufacturing New methods to create, modify, and represent increasingly complex and/or

realistic models. Modeling research augments research in rendering, interaction,

visualization and performance

Page 25: Lecture 1. Overview of Computer Graphics

Example: PBM Language enables Model Extraction Pipeline

Page 26: Lecture 1. Overview of Computer Graphics
Page 27: Lecture 1. Overview of Computer Graphics
Page 28: Lecture 1. Overview of Computer Graphics
Page 29: Lecture 1. Overview of Computer Graphics
Page 30: Lecture 1. Overview of Computer Graphics
Page 31: Lecture 1. Overview of Computer Graphics
Page 32: Lecture 1. Overview of Computer Graphics
Page 33: Lecture 1. Overview of Computer Graphics
Page 34: Lecture 1. Overview of Computer Graphics

OpenGL

OpenGL is a low-level graphics API (C/C++ library) -API= Application Program Interface: routines, protocols, and tools for building software applications. - A good API makes it easier to develop a program by providing all the needed building blocks.

Window system independent, but Has no facility for window events/user input. Use other libraries for interaction (eg. GLUT)

Vertex driven Geometric “Primitives” assembled from vertices

***OpenGL creates/runs a state machine***

Page 35: Lecture 1. Overview of Computer Graphics

OpenGL Overview

per vertex operations & primitive assembly

Rasterization per pixel operations

Frame Buffer

Commands or display list

Page 36: Lecture 1. Overview of Computer Graphics

Clearing the Buffers

Clears the buffers using the specified values glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) glClear(GLbitfield mask)

Masks: GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_ACCUM_BUFFER_BIT, GL_STENCIL_BUFFER_BIT

Page 37: Lecture 1. Overview of Computer Graphics

Drawing Primitives

Begin/End drawing a primitive

glBegin(GLenum mode) glEnd()

Modes:

GL_POINTS, GL_LINES, GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_QUADS, GL_POLYGON

Page 38: Lecture 1. Overview of Computer Graphics

Basic Mathematical Types

Scalars: s (a real number) Column Vectors: Rep of 3D Points:

Column Vectors: Rep of 3D Directions:

zyx

zyx

Page 39: Lecture 1. Overview of Computer Graphics

Math Types, continued

Matrices (3x3 rotation, 4x4 transformation) We will be using Eigen – see HW 0 to set up environment.

Higher order Tensors

- Tensors can be defined as the abstract geometric mathematical objects that are Linear

- 0th order tensors are scalars, 1st order are vectors, 2nd order are matrices, etc

- 3-D tensors of order N are represented with 3n components …

Page 40: Lecture 1. Overview of Computer Graphics

Summary

Covered intro to Computer Graphics - Modeling, Rendering and Interaction - Need reliable mathematics and algorithms to implement these

Touched on several course topics Gave several examples …