What is Computer Graphics? - UVic.cablob/downloads/cg-intro.pdf · •Graphics Data Structures and...

92
The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then insert it again. What is Computer Graphics? by Brian Wyvill The University of Victoria Graphics Group

Transcript of What is Computer Graphics? - UVic.cablob/downloads/cg-intro.pdf · •Graphics Data Structures and...

  • The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then insert it again.

    What is Computer Graphics?

    by Brian Wyvill

    The University of Victoria Graphics Group

  • University of Victoria Graphics Lab. CSC 106 2011 page 2

  • University of Victoria Graphics Lab. CSC 106 2011 page 3

    The Great Train Rubbery (1986/88)

  • University of Victoria Graphics Lab. CSC 106 2011 page 4

    September-October 2006 First Place Winner Ghost Light by Bill Pragnell

    Internet Ray Tracing Contest 2006

  • University of Victoria Graphics Lab. CSC 106 2011 page 5 Frozen Fire by Robert W. McGregor

  • University of Victoria Graphics Lab. CSC 106 2011 page 6

    Frozen Fire Statistics: RENDER TIME: 37 hours @ 1280x1024 px HARDWARE USED: Dell PC, Pentium 4 (w/HT), 3 Ghz, 1 GB RAM

  • University of Victoria Graphics Lab. CSC 106 2011 page 7

    Overview

    Computer Graphics What Body of knowledge is studied? E.g. 305 course: • Graphics Fundamentals • Geometric Transformations + Maths • Graphics Data Structures and Algorithms • Modelling • Rendering • Animation

  • University of Victoria Graphics Lab. CSC 106 2011 page 8

    Hardware and Fundamentals

    Pixels Colour Tables OpenGl support Graphics Primitives (Scan Conversion) GPU

  • University of Victoria Graphics Lab. CSC 106 2011 page 9

    Technology: Cathode Ray Tube (CRT) Plasma Panel Liquid Crystal Display (LCD)

    Raster Displays

  • University of Victoria Graphics Lab. CSC 106 2011 page 10

    CRT

  • University of Victoria Graphics Lab. CSC 106 2011 page 11

    LCs (1888) do not emit light. Works by letting varying amounts of fixed intensity backlight through active filter, LEDs can be used for backlight. Liquid Crystal (organic compound) long molecules line up in with long axes parallel. Grooved surface causes them to line up parallel with the grooves. Sandwich LC between two finely grooved surfaces (perpendicular to each other) Light follows alignment of molecules and twisted through 90 degrees. When voltage applied causes molecules to realign allowing light to pass untwisted. Polarising filter wikipedia or http://www.pctechguide.com/07panels.htm

    Liquid Crystal Displays

  • University of Victoria Graphics Lab. CSC 106 2011 page 12

    Display Coordinate Systems

    Depends on the API

    X

    Y

    0,0

    OpenGL nx-1,ny-1

    X

    Y

    ny-1

    0 Qt

    0 nx-1

    Pixel = Picture Element indexed by an ordered pair

  • University of Victoria Graphics Lab. CSC 106 2011 page 13

    One Bit Display

  • University of Victoria Graphics Lab. CSC 106 2011 page 14

    Look Up Table (LUT)

  • University of Victoria Graphics Lab. CSC 106 2011 page 15

    Geometric Transformations

    Homogeneus Coordinate Systems Transformations Properties 2D/3D Viewing Algorithms and Maths DAGS and DACS

  • University of Victoria Graphics Lab. CSC 106 2011 page 16

    Translation

  • University of Victoria Graphics Lab. CSC 106 2011 page 17

    Scaling

  • University of Victoria Graphics Lab. CSC 106 2011 page 18

    Rotation

  • University of Victoria Graphics Lab. CSC 106 2011 page 19

    Column Vector post multiplication notation.

  • University of Victoria Graphics Lab. CSC 106 2011 page 20

  • University of Victoria Graphics Lab. CSC 106 2011 page 21

  • University of Victoria Graphics Lab. CSC 106 2011 page 22

    DAGS

    Instancing – The Scene Graph

    Mat

    Obj

    Obj

    Transform Node next

    Or Primitive

  • University of Victoria Graphics Lab. CSC 106 2011 page 23

    DAGS - Instancing

  • University of Victoria Graphics Lab. CSC 106 2011 page 24

    Model to be transformed

    Model Node

    Transform Node

    Recursive Loops (DCGs)

  • University of Victoria Graphics Lab. CSC 106 2011 page 25

    Multiple Recursion

    tree

    Cylinder

    Mat

    next Mat

    next Mat

    next

    tree tree

    Mat

    next tree

    Mat next

    tree

  • University of Victoria Graphics Lab. CSC 106 2011 page 26

    def h limit 12 a square scale 10 0.5 trans -5 -0.5 fill 1 col 0.3 0.2 0 a h scale 0.7 0.7 rotate 90 trans -5 0 a h scale 0.7 0.7 rotate -90 trans 5 0 endef

  • University of Victoria Graphics Lab. CSC 106 2011 page 27

    traverse(model* x, matrix m) { if (x is primitive) draw(x, m); else { transform* t;

    t=x->firstTransform; if (x->limit>0) { x->limit--; while (t != NULL) { if (t->mdl->limit==local)traverse(t->mdl, m*t->m); t=t->next; } x->limit++; }

    } }

    If Limit

  • University of Victoria Graphics Lab. CSC 106 2011 page 28

    3

  • University of Victoria Graphics Lab. CSC 106 2011 page 29

    def h limit 12 a square scale 10 0.5 trans -5 -0.5 fill 1 col 0.3 0.2 0 a h scale 0.7 0.7 rotate 90 trans -5 0 a h scale 0.7 0.7 rotate -90 trans 5 0 vlim 9 endef

    1975

  • Shows: Mutual Recursion If limit Local Limit

    Tree

  • Op Art?

    Dragon Curve and variations

  • University of Victoria Graphics Lab. CSC 106 2011 page 32

  • University of Victoria Graphics Lab. CSC 106 2011 page 33

    u v

    -w

  • University of Victoria Graphics Lab. CSC 106 2011 page 34

    Modelling

    Parametric Curves and Surfaces Generalised Cylinders Subdivision Modelling Implicit Modelling

  • University of Victoria Graphics Lab. CSC 106 2011 page 35

    CSG

    Parametric Generalised Cylinders

    Implicit Model Stanford Bunny (mesh)

  • University of Victoria Graphics Lab. CSC 106 2011 page 36

    NURBS: The most important modeling technique in CAD

  • University of Victoria Graphics Lab. CSC 106 2011 page 37

    B-Spline Basis for cubics

  • University of Victoria Graphics Lab. CSC 106 2011 page 38

    DEMO

  • University of Victoria Graphics Lab. CSC 106 2011 page 39

  • University of Victoria Graphics Lab. CSC 106 2011 page 40

  • University of Victoria Graphics Lab. CSC 106 2011 page 41

  • University of Victoria Graphics Lab. CSC 106 2011 page 42

  • University of Victoria Graphics Lab. CSC 106 2011 page 43

  • University of Victoria Graphics Lab. CSC 106 2011 page 44

  • University of Victoria Graphics Lab. CSC 106 2011 page 45

    Rendering

    Lighting Z-Buffer BSP Trees Ray Tracing Antialiasing (A-Buffer) Texturing Global Illumination

  • University of Victoria Graphics Lab. CSC 106 2011 page 46

    P201 Shirley

  • University of Victoria Graphics Lab. CSC 106 2011 page 47

  • University of Victoria Graphics Lab. CSC 106 2011 page 48

  • University of Victoria Graphics Lab. CSC 106 2011 page 49

    Refraction

  • University of Victoria Graphics Lab. CSC 106 2011 page 50

    Reflections and Transparency

  • University of Victoria Graphics Lab. CSC 106 2011 page 51

    Ray Traced Images Sphere with hard shadow point sampling source Sphere with soft shadow sampling wide light source

    Ray Traced Shadows

  • University of Victoria Graphics Lab. CSC 106 2011 page 52

    Shadows (hard edged)

    Shadows (soft edged)

  • V

    F1,2,3,4

    Mesh Presentation: a common way

    l  list of vertices l  list of faces storing pointers for its vertices l  efficient for many applications (well fit to Graphics pipeline)

    l  “obj” format from Alias/wavefront (Maya) l  MD2 format (Games)

  • University of Victoria Graphics Lab. CSC 106 2011 page 54

    One Step of Doo Subdivision v  One Step of Subdivision (F,V) (NF,NV)

    v  Line Face Curve Surface

  • University of Victoria Graphics Lab. CSC 106 2011 page 55 3D Studio Max

    Example of Doo Subdivision

  • University of Victoria Graphics Lab. CSC 106 2011 page 56 University of Victoria Graphics Lab. CSC 472/578c 2010 page 56

    V -Clark Subdivision l  It is introduced in Computer Aided Design 1978. l  based on the tensor product of cubic B-spline l  at regular points and with the smooth tangent at extra-ordinary points

    SIGGRAPH 98

  • University of Victoria Graphics Lab. CSC 106 2011 page 57

    Example

    v  Geri’s v Head v Hands v Clothing: Jacket, pants, shirt, tie and shoes

  • University of Victoria Graphics Lab. CSC 106 2011 page 58

    The Geoff Function

    Field Function

    Proximity Blending: Add contributions from generating skeletal elements in the neighbourhood

    Click Me

  • University of Victoria Graphics Lab. CSC 106 2011 page 59

    Blending and The Soft Train

    Polygonizer Info.

    1986

  • University of Victoria Graphics Lab. CSC 106 2011 page 60

  • University of Victoria Graphics Lab. CSC 106 2011 page 61

    The Great Train Rubbery (1986/88)

  • University of Victoria Graphics Lab. CSC 106 2011 page 62

    Invert

    Warping: Example Vector Warp

  • University of Victoria Graphics Lab. CSC 106 2011 page 63

    Barr Operators

  • University of Victoria Graphics Lab. CSC 106 2011 page 64

  • University of Victoria Graphics Lab. CSC 106 2011 page 65

    Ray Traced Canmore Coffee Grinder by Kees van Overveld and Brian Wyvill

  • University of Victoria Graphics Lab. CSC 106 2011 page 66

    Model of 9ft. Steinway Concert Grand 1994

    L-System Plant by Dr. Prusinkiwicz

  • University of Victoria Graphics Lab. CSC 106 2011 page 67

  • University of Victoria Graphics Lab. CSC 106 2011 page 68

    American Type 4-4-0

  • University of Victoria Graphics Lab. CSC 106 2011 page 69

    Controlled Blending and PCM

    Controlled Blending with Precise Contact Modelling

    Mari-Paule Cani

  • University of Victoria Graphics Lab. CSC 106 2011 page 70

    Constructive Solid Geometry (CSG)

    Primitives are combined using boolean set operations: Union, Intersection, Difference. Each primitive represents a half space, ie the set of points defining the half space E.g.

    Boolean expression (u= union, d= difference, i= intersection) d( sphere, cylinder) u( sphere, i( i( cylinder, plane1), plane2) )

    - - +

    Sphere

    - - +

    Cylinder -

    +

    Plane

    The cylinder is infinite in extent it is first intersected with two half space planes.

  • University of Victoria Graphics Lab. CSC 106 2011 page 71

    CSG Tree

    CSG Implementation

    Boolean Expressions are usually represented as a binary tree.

  • University of Victoria Graphics Lab. CSC 106 2011 page 72

    The BlobTree 1996 Andy Guy

    +Eric Galin, Andy Guy

    CSG + scene graph + blends + warps

  • University of Victoria Graphics Lab. CSC 106 2011 page 73

    The Final Shell

    Student: Callum Galbraith

  • University of Victoria Graphics Lab. CSC 106 2011 page 74

    Global to Local – Inverse Modelling

    Global Shape defined by set of functions Positional

    Information

    Colour change represents a new year Length of branches

    Orientation of branch segments defined by interpolating between two functions for short and long branches

    Loss of branches

  • University of Victoria Graphics Lab. CSC 106 2011 page 76

  • Sketch Based Modelling with the BlobTree

    ShapeShop 2005 Ryan Schmidt

  • University of Victoria Graphics Lab. CSC 106 2011 page 78

    l  Benefits Include: –  Solid (Volume) Modeling –  Shape composition is easy and

    robust –  Scene Graph –  BlobTree is a full construction

    history and can be animated

    Interaction - ShapeShop U. Calgary Student : Ryan Schmidt see SBIM ’05 http://www.shapeshop3d.com/

  • University of Victoria Graphics Lab. CSC 106 2011 page 79

    Examples

    Demo

  • NPR : Pauline Jepp and Kevin Foster

  • University of Victoria Graphics Lab. CSC 106 2011 page 81

    Animation - What You Should Know: Maths Programming Graphics Useful: Some Physics

    Lagrange

    0=!

    !"

    !

    !

    ii

    LdtdL

    ## !)cos1(

    21 2 !! ""="= mglmlUTL !

  • University of Victoria Graphics Lab. CSC 106 2011 page 82

    Interpolation and Key-Framing

  • University of Victoria Graphics Lab. CSC 106 2011 page 83

    Deforming and Morphing

  • University of Victoria Graphics Lab. CSC 106 2011 page 84

    Camera and Path Control

  • University of Victoria Graphics Lab. CSC 106 2011 page 85

    Flexible Objects

  • University of Victoria Graphics Lab. CSC 106 2011 page 86

    Natural Phenomena

  • University of Victoria Graphics Lab. CSC 106 2011 page 87

    Motion Synthesis

  • University of Victoria Graphics Lab. CSC 106 2011 page 88

    Movie Production, Animation, Special Effects

  • Movie Production, Animation, Special Effects

  • University of Victoria Graphics Lab. CSC 106 2011 page 90

    0sin

    2

    2

    =+

    =!"

    #$%

    &'

    '

    ='

    '

    ((

    ((

    ((

    lg

    mlLdtd

    mlL

    !!

    !!!

    !!

    Same as Newton!!

    Lagrange Looks more complicated than Newton but for more complex problems is simpler. E.g. Pendulum solve for theta.

    Simple Pendulum

    Lagrange

    0=!

    !"

    !

    !

    ii

    LdtdL

    ## ! !!

    sinmglL "=#

    #

    )cos1(21 2 !! ""=

    "=

    mglmlL

    UTL

    !

    θ

    l

  • University of Victoria Graphics Lab. CSC 106 2011 page 91

    Flocking l  AKA swarming or herding l  Relate to groups of characters

    l  Craig W. Reynolds, “Flocks, herds and schools: A distributed behavioral model”, SIGGRAPH 87

    l  Three simple rules (steering behavior):

    –  Separation, Alignment, Cohesion

    –  Together gives groups of autonomous agents (boids) a realistic form of group behavior similar to flocks of birds, schools of fish, or swarms of bees. ex1, ex2

    –  The steering behavior determines how a character reacts to other characters in its local neighborhood.

    Birds plus -oids

    http://www.codepuppies.com/~steve/aqua.html

  • University of Victoria Graphics Lab. CSC 106 2011 page 92