Computer Graphics in Java1 Objects and Viewers Two basic entities (one object seen from two different positions) :

Slides:



Advertisements
Similar presentations
Fundamentals of Computer Graphics Part 1
Advertisements

Graphics Pipeline.
UBI 516 Advanced Computer Graphics
Informationsteknologi Wednesday, November 7, 2007Computer Graphics - Class 51 Today’s class Geometric objects and transformations.
MAE152 Computer Graphicsfor Scientists and Engineers Revision of Matrices Relevance to Graphics.
Chapter 4.1 Mathematical Concepts
2/7/2001Hofstra University – CSC290B1 Review: Math (Ch 4)
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry Trigonometric functions Defined using right triangle  x y h.
CS5500 Computer Graphics March 22, Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Coordinate-Free Geometry When we learned simple.
Welcome to CSc 830 Advanced Computer Graphics
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
3-D Geometry.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer.
Vectors.
CSC 461: Lecture 2 1 CSC461 Lecture 2: Image Formation Objectives Fundamental imaging notions Fundamental imaging notions Physical basis for image formation.
Linear Algebra Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005.
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
1 Chapter 1: Graphics Systems and Models. 2 Applications of C. G. – 1/4 Display of information Maps GIS (geographic information system) CT (computer tomography)
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 46 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 46 Computer Graphics Introduction II.
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
Basic graphics. ReviewReview Viewing Process, Window and viewport, World, normalized and device coordinates Input and output primitives and their attributes.
CS 450: Computer Graphics REVIEW: OVERVIEW OF POLYGONS
Graphics CSE 581 – Interactive Computer Graphics Mathematics for Computer Graphics CSE 581 – Roger Crawfis (slides developed from Korea University slides)
Geometry CSC 2141 Introduction to Computer Graphics.
ISC/GAM 4322 ISC 6310 Multimedia Development and Programming Unit 1 Graphics Systems and Models.
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
Mathematical Foundations Sections A-1 to A-5 Some of the material in these slides may have been adapted from university of Virginia, MIT and Åbo Akademi.
CS 445 / 645 Introduction to Computer Graphics Lecture 3 Mathematical Primitives Introduction to Transformations Lecture 3 Mathematical Primitives Introduction.
Intro to 3D Models Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Mathematics for Graphics. 1 Objectives Introduce the elements of geometry  Scalars  Vectors  Points Develop mathematical operations among them in a.
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
CS 480/680 Computer Graphics Image Formation Dr. Frederick C Harris, Jr.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
10/3/02 (c) 2002 University of Wisconsin, CS 559 Last Time 2D Coordinate systems and transformations.
The Rendering Pipeline CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 52 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 52 Computer Graphics Three-Dimensional Graphics I.
Background Mathematics Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006.
CS 551 / 645: Introductory Computer Graphics Mathematical Foundations.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Computer Graphics, KKU. Lecture 41 The Computer Programming Laws Any given program, when running, is obsolete. Any given program costs more and.
David Luebke1/10/2016 CS 551 / 645: Introductory Computer Graphics David Luebke
1 Angel: Interactive Computer Graphics5E © Addison- Wesley 2009 Image Formation Fundamental imaging notions Fundamental imaging notions Physical basis.
Rendering Pipeline Fall, D Polygon Rendering Many applications use rendering of 3D polygons with direct illumination.
CSCE 552 Fall 2012 Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
David Luebke2/16/2016 CS 551 / 645: Introductory Computer Graphics Mathematical Foundations The Rendering Pipeline.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
2/28/2016 CS 551 / 645: Introductory Computer Graphics Framebuffer Mathematical Foundations The Rendering Pipeline.
Computer Graphics I, Fall 2010 Geometry.
Chapter 1 Graphics Systems and Models Models and Architectures.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Models and Architectures 靜宜大學 資訊工程系 蔡奇偉 副教授 2012.
Graphics Graphics Korea University kucg.korea.ac.kr Geometric Primitives 고려대학교 컴퓨터 그래픽스 연구실.
David Luebke6/12/2016 CS 551 / 645: Introductory Computer Graphics David Luebke
Graphics Graphics Korea University kucg.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실.
Introduction; Mathematical Foundations CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
Forward Projection Pipeline and Transformations CENG 477 Introduction to Computer Graphics.
CA 302 Computer Graphics and Visual Programming
Rendering Pipeline Fall, 2015.
CSCE 441 Computer Graphics 3-D Viewing
Models and Architectures
Models and Architectures
Models and Architectures
Introduction to Computer Graphics with WebGL
Models and Architectures
CSE 411 Computer Graphics Lecture #2 Mathematical Foundations
CS 551 / 645: Introductory Computer Graphics
Models and Architectures
Presentation transcript:

Computer Graphics in Java1 Objects and Viewers Two basic entities (one object seen from two different positions) :

Computer Graphics in Java2 Lights & Images Others attributes:  light sources

Computer Graphics in Java3 Colors Light is a form of electromagnetic radiation Visible spectrum 350 – 780 nm

Computer Graphics in Java4 Ray Tracing Ray tracing  building an imaging model by following light from a source  a ray is a semi-infinite line that emanates from a point and “travels” to infinity in a particular direction  portion of these infinite rays contributes to the image on the film plane of the camera surfaces:  diffusing  reflecting  refracting

Computer Graphics in Java5 Ray Tracing A different approach must be used: for each pixel intensity must be computed all contributions must be taken into account a ray is “followed” in the opposite direction, when intersect a surface it is split into two rays contribution from light sources and reflection from other resources are counted

Computer Graphics in Java6 Pinhole Camera Box with a small hole film plane z = - d !!!yp,-d

Computer Graphics in Java7 Pinhole Camera point (x p,y p,-d) – projection of the point (x,y,z) angle of view or field of the camera – angle  ideal camera – infinite depth of field

Computer Graphics in Java8 Synthetic Camera Model computer-generated image based on an optical system – Synthetic Camera Model viewer behind the camera can move the back of the camera – change of the distance d i.e. additional flexibility objects and viewer specifications are independent – different functions within a graphics library Imaging system

Computer Graphics in Java9 Synthetic Camera Model a – situation with a camera b – mathematical model – image plane moved in front of the camera center of projection – center of the lens projection plane – film plane

Computer Graphics in Java10 Synthetic Camera Model Imaging with the Synthetic Camera Model film plane position in a camera projected scene to the projection plane

Computer Graphics in Java11 Synthetic Camera Model Not all objects can be seen limit due to viewing angle Solution: Clipping rectangle or clipping window placed inn front of the camera ad b shows the case when the clipping rectangle is shifted aside – only part of the the scene is projected

Computer Graphics in Java12 Programmer’s Interface Numerous ways for user interaction with a graphics system using input devices - pads, mouse, keyboards etc. different orientation of coordinate systems canvas

Computer Graphics in Java13 Application Programmer’s Interface API functionality should match the conceptual model Synthetic Camera Model used for APIs like Java3D, VRML etc. Functionality needed in the API to specify: Objects Viewers Light sources Material properties

Computer Graphics in Java14 Application Programmer’s Interface Objects are defined by points or vertices, line segments, polygons etc. to represent complex objects API primitives are displayed rapidly on the hardware usual API primitives:  points  line segments  polygons  text

Computer Graphics in Java15 Application Programmer’s Interface Camera specification in APIs: position – usually center of lens orientation – camera coordinate system in center of lens camera can rotate around those three axis focal length of lens determines the size of the image on the film actually viewing angle film plane - camera has a height and a width

Computer Graphics in Java16 Graphics Architectures Early graphics systems – CRT had just basic capability to generate line segments connecting two points vector based with refreshing – length of line segments limited light pen often used for manipulation systems with memory CRT – the whole picture redrawn if changed

Computer Graphics in Java17 Graphics Architectures Display processors standard architecture with capabilities to display primitives composition made at the host memory – display list – contains primitives to be displayed.

Computer Graphics in Java18 Pipeline Architectures VLSI circuits enabled major advances in graphics architectures - simple arithmetic pipeline a + b * c - when addition of (b * c) and a is performing new b * c is computed in parallel – pipelining enabled significant speed up - similar approach can be used for processing of geometric primitives as well

Computer Graphics in Java19 Pipeline Architectures There are 4 major steps in the geometric pipeline: transformations – like scaling, rotations, translation, mirroring, sheering etc. clipping – removal of those parts that are out of the viewing field projection rasterization homogeneous coordinates and matrix operations geometric transformations are used

Computer Graphics in Java20 Clipping, Projection & Rasterization Clipping is used to remove those parts of the world that cannot be seen. Objects representation is “kept” in 3D as long as possible. After transformation and clipping must be projected to 2D somehow projected objects or their parts must be displayed – and therefore rasterized. All those steps are performed on your graphics cards in haerware nowadays.

Computer Graphics in Java21 Where We’re Going Today’s lectures:  Mathematical Foundations  The graphics pipeline: the big picture  Rigid-body transforms  Homogeneous coordinates

Computer Graphics in Java22 Mathematical Foundations A brief, informal review of some of the mathematical tools employed in graphics  Geometry (2D, 3D)  Trigonometry  Vector and affine spaces Points, vectors, and coordinates  Dot and cross products  Linear transforms and matrices

Computer Graphics in Java23 2D Geometry Know your high-school geometry:  Total angle around a circle is 360° or 2π radians  When two lines cross: Opposite angles are equivalent Angles along line sum to 180°  Similar triangles: All corresponding angles are equivalent Corresponding pairs of sides have the same length ratio and are separated by equivalent angles Any corresponding pairs of sides have same length ratio

Computer Graphics in Java24 Trigonometry Sine: “opposite over hypotenuse” Cosine: “adjacent over hypotenuse” Tangent: “opposite over adjacent” Unit circle definitions:  sin (  ) = x  cos (  ) = y  tan (  ) = x/y  Etc… (x, y)

Computer Graphics in Java25 3D Geometry To model, animate, and render 3D scenes, we must specify:  Location  Displacement from arbitrary locations  Orientation We’ll look at two types of spaces:  Vector spaces  Affine spaces The distinction is often sloppy or loose

Computer Graphics in Java26 Vector Spaces Two types of elements:  Scalars (real numbers):  …  Vectors (n-tuples): u, v, w, … Supports two operations:  Addition operation u + v, with: Identity 0 v + 0 = v Inverse - v + (- v ) = 0  Scalar multiplication: Distributive rule:  ( u + v ) =  ( u ) +  ( v ) (  +  ) u =  u +  u

Computer Graphics in Java27 Vector Spaces A linear combination of vectors results in a new vector: v =  1 v 1 +  2 v 2 + … +  n v n If the only set of scalars such that  1 v 1 +  2 v 2 + … +  n v n = 0 is  1 =  2 = … =  3 = 0 then we say the vectors are linearly independent The dimension of a space is the greatest number of linearly independent vectors possible in a vector set For a vector space of dimension n, any set of n linearly independent vectors form a basis

Computer Graphics in Java28 Vector Spaces: A Familiar Example Our common notion of vectors in a 2D plane is (you guessed it) a vector space:  Vectors are “arrows” rooted at the origin  Scalar multiplication “streches” the arrow, changing its length (magnitude) but not its direction  Addition uses the “trapezoid rule”: u+v y x u v

Computer Graphics in Java29 Vector Spaces: Basis Vectors Given a basis for a vector space:  Each vector in the space is a unique linear combination of the basis vectors  The coordinates of a vector are the scalars from this linear combination  Best-known example: Cartesian coordinates Draw example on the board  Note that a given vector v will have different coordinates for different bases

Computer Graphics in Java30 Vectors And Point We commonly use vectors to represent:  Points in space (i.e., location)  Displacements from point to point  Direction (i.e., orientation) But we want points and directions to behave differently  Ex: To translate something means to move it without changing its orientation  Translation of a point = different point  Translation of a direction = same direction

Computer Graphics in Java31 Affine Spaces To be more rigorous, we need an explicit notion of position Affine spaces add a third element to vector spaces: points (P, Q, R, …) Points support these operations  Point-point subtraction: Q - P = v Result is a vector pointing from P to Q  Vector-point addition: P + v = Q Result is a new point  Note that the addition of two points is not defined P Q v

Computer Graphics in Java32 Affine Spaces Points, like vectors, can be expressed in coordinates  The definition uses an affine combination  Net effect is same: expressing a point in terms of a basis Thus the common practice of representing points as vectors with coordinates

Computer Graphics in Java33 Affine Lines: An Aside Parametric representation of a line with a direction vector d and a point P 1 on the line: P(  ) = P origin +  d Restricting 0   produces a ray Setting d to P - Q and restricting 0    1 produces a line segment between P and Q

Computer Graphics in Java34 Dot Product The dot product or, more generally, inner product of two vectors is a scalar: v 1 v 2 = x 1 x 2 + y 1 y 2 + z 1 z 2 (in 3D) Useful for many purposes  Computing the length of a vector: length(v) = sqrt(v v)  Normalizing a vector, making it unit-length  Computing the angle between two vectors: u v = |u| |v| cos(θ)  Checking two vectors for orthogonality  Projecting one vector onto another θ u v

Computer Graphics in Java35 Cross Product The cross product or vector product of two vectors is a vector: The cross product of two vectors is orthogonal to both Right-hand rule dictates direction of cross product Use a determinate to compute the cross product

Computer Graphics in Java36 Linear Transformations A linear transformation:  Maps one vector to another  Preserves linear combinations Thus behavior of linear transformation is completely determined by what it does to a basis Turns out any linear transform can be represented by a matrix

Computer Graphics in Java37 Matrices By convention, matrix element M rc is located at row r and column c: By (OpenGL) convention, vectors are columns:

Computer Graphics in Java38 Matrices Matrix-vector multiplication applies a linear transformation to a vector: Recall how to do matrix multiplication

Computer Graphics in Java39 Matrix Transformations A sequence or composition of linear transformations corresponds to the product of the corresponding matrices  Note: the matrices to the right affect vector first  Note: order of matrices matters! The identity matrix I has no effect in multiplication Some (not all) matrices have an inverse:

Computer Graphics in Java40 3-D Graphics: A Whirlwind Tour Transform Illuminate Transform Clip Project Rasterize Model & Camera Parameters Rendering Pipeline FramebufferDisplay

Computer Graphics in Java41 The Display You Know Transform Illuminate Transform Clip Project Rasterize Model & Camera Parameters Rendering Pipeline FramebufferDisplay

Computer Graphics in Java42 The Framebuffer You Know Transform Illuminate Transform Clip Project Rasterize Model & Camera Parameters Rendering Pipeline FramebufferDisplay

Computer Graphics in Java43 The Rendering Pipeline Transform Illuminate Transform Clip Project Rasterize Model & Camera Parameters Rendering Pipeline FramebufferDisplay Why do we call it a pipeline?

Computer Graphics in Java44 2-D Rendering You Know Transform Illuminate Transform Clip Project Rasterize Model & Camera Parameters Rendering Pipeline FramebufferDisplay

Computer Graphics in Java45 The Rendering Pipeline: 3-D Transform Illuminate Transform Clip Project Rasterize Model & Camera Parameters Rendering Pipeline FramebufferDisplay

Computer Graphics in Java46 The Rendering Pipeline: 3-D Modeling Transforms Scene graph Object geometry Lighting Calculations Viewing Transform Clipping Projection Transform Result: All vertices of scene in shared 3-D “world” coordinate system All vertices of scene in shared 3-D “world” coordinate system Vertices shaded according to lighting model Vertices shaded according to lighting model Scene vertices in 3-D “view” or “camera” coordinate system Scene vertices in 3-D “view” or “camera” coordinate system Exactly those vertices & portions of polygons in view frustum Exactly those vertices & portions of polygons in view frustum 2-D screen coordinates of clipped vertices 2-D screen coordinates of clipped vertices

Computer Graphics in Java47 The Rendering Pipeline: 3-D Scene graph Object geometry Lighting Calculations Clipping Result: All vertices of scene in shared 3-D “world” coordinate system All vertices of scene in shared 3-D “world” coordinate system Vertices shaded according to lighting model Vertices shaded according to lighting model Scene vertices in 3-D “view” or “camera” coordinate system Scene vertices in 3-D “view” or “camera” coordinate system Exactly those vertices & portions of polygons in view frustum Exactly those vertices & portions of polygons in view frustum 2-D screen coordinates of clipped vertices 2-D screen coordinates of clipped vertices Modeling Transforms Viewing Transform Projection Transform