1 / 34

Introduction to Computer Graphics

Introduction to Computer Graphics. CS 4363/6353. What You’ll see. Interactive 3D computer graphics Real-time 2D, but mostly 3D OpenGL C/C++ (if you don’t know them) The math behind the scenes Shaders Simple and not-so-simple 3D file formats (OBJ and FBX). What you Won’t See.

Download Presentation

Introduction to Computer Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Computer Graphics CS 4363/6353

  2. What You’ll see • Interactive 3D computer graphics • Real-time • 2D, but mostly 3D • OpenGL • C/C++ (if you don’t know them) • The math behind the scenes • Shaders • Simple and not-so-simple 3D file formats (OBJ and FBX)

  3. What you Won’t See • Applications (though they are useful) • Photoshop/Gimp/Paint.NET • Maya • Web graphics • Art • Character animations • Very complex • Usually require 3rd party software

  4. WhY? • Senior Graphics Engineer at Autodesk – 1/6/2012

  5. Why? • C/C++ Game Programmer at Addmired – 1/5/2012

  6. Why? • Graphics Engineer at LucasArts – 1/4/2012

  7. Early Graphics • Das Blinkenlights • Dot matrix printers • Shortly after printers came the CRT… http://james.seng.sg/files/public/starwar-ascii-art.jpg

  8. Early Graphics • The CRT was able to draw more than ASCII characters. It could draw dots! http://www.gamasutra.com/view/feature/3900/the_history_of_pong_avoid_missing_.php

  9. Early Graphics • If you can draw a dot, you can draw a line! • Bresenham’s Line Drawing algorithm http://kobi.nat.uni-magdeburg.de/patrick/uploads/BEng/bresenham_line.png http://i18.photobucket.com/albums/b106/mspeir/Grid.jpg

  10. Things to Note… • Everything at this time • was 2D • Looked really bad, but was playable! • was in real time • How did the “animation” work?

  11. Into the 3rd Dimension • Add depth dimension • How do you perceive depth everyday? • You have two eyes • The image for your left eye is different than the right • Brain extracts the differences to understand depth • 3DTVs – how do they work? http://static3.businessinsider.com/image/4b45f3b20000000000533ed7/3d-tv.jpg

  12. But Wait! • Monitors are one “flat image on a flat surface” • How do we perceive depth now? • Farther objects are smaller (foreshortening) • Subtle lighting changes • We’ll use mathematics to do this for us http://www.oceansbridge.com/paintings/artists/c/canaletto/oil-big/perspective_1765_XX_venice.jpg

  13. Common TErminology • Rendering: the entire process of drawing an image to the screen • Vertex: a single 3D point (x, y, z) • Edge: a line between two vertices • Face: Most often 3 vertices and their edges • Transformations: moving one or more vertices • Translate: pushing vertices along the x, y or z axis • Rotate: revolving vertices around some 3D point • Scale: increasing or decreasing the distance of vertices from their center • Model matrix – a mathematical structure for holding transformations (later) • View matrix – another used for holding the viewpoint (camera) • Projection matrix – another, used to get images on the screen (later) • Rasterization– putting the actual pixels on the screen (final phase of rendering)

  14. Transformations • Translate • Rotate • Scale

  15. Terminology(IMAGE From the OpenGL SuperBible) • Wireframe – rendering only the edges of the model (old games)

  16. Terminology(IMAGE From the OpenGL SuperBible) • Hidden Surface Removal (HSR) – occluded objects can’t be seen • Backface culling - drawing only the triangles that are facing the camera

  17. Terminology(IMAGE From the OpenGL SuperBible) • Solid shading (this isn’t a definition) – note that everything’s hard-coded red!

  18. Terminology(IMAGE From the OpenGL SuperBible) • Flat Shading – simulate lighting

  19. Terminology(IMAGE From the OpenGL SuperBible) • Texture mapping – using an image during the rasterization process

  20. Terminology(IMAGE From the OpenGL SuperBible) • Blending – mixing colors by rendering more than one thing in one spot • The floor is rendered semi-transparent (yes, there are two cubes)

  21. What about this?(non-Real-time)

  22. Coordinate Systems • We have several spaces: • Local/Object – the coordinate system the mesh was modeled in • World – the coordinate system of the virtual environment • View/Camera – the coordinate system relative to the camera • Clip – windowing system • We use mathematics to transform vertices from one space to another

  23. Coordinate Systems(for Windowing Systems) • Because your screen is flat, we must work with 2D Cartesian Coordinates • x = horizontal, y = vertical • (0, 0) is origin +y -x +x -y

  24. Coordinate CLipping • When creating a window, we must define where we are in the Cartesian system • The window header doesn’t count in this equation • Middle of screen is (0, 0) +75 +100 -100 -75

  25. Another Example • Middle of screen is (75, 100) +150 +200 0 0

  26. Setting A Window’s Viewport • Window size usually doesn’t match clipping size • The viewport maps the clipping area to part (or all) of the window • Most often, the viewport fills the entire window • Sometimes, you want a “Picture in Picture” (PIP) rendering

  27. Example – Entire Window (150, 200) 1900x1200 Window 0 0

  28. PIP Example (150, 200) 1900x1200 Window 0 0

  29. 3D Coordinate Systems • We live (and think) in 3 dimensions • x = horizontal, y = vertical, z = depth (can be RHS or LHS) • (0, 0, 0) is origin +y -z -x +x +z -y http://people.ece.cornell.edu/land/courses/ece4760/FinalProjects/s2010/ky237_zy49/ky237_zy49/index.html

  30. Basic Problem • We need to convert our 3D models and display them on a 2D screen • To do this, we use projections by defining a viewing volume • These “flatten” the 3D world • There are two kinds: • Orthographic (aka “parallel”) • All objects that have the same dimension are the same size, regardless of distance • Viewing volume is rectangular • Perspective • Objects shrink with distance • Viewing volume is shaped like a pyramid

  31. Example(Upper-right is a Perspective View)

  32. Orthographic View Volume(you can see the parallel now…) Far clipping plane Near clipping plane

  33. Perspective View Volume Far clipping plane Near clipping plane

More Related