1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 15 Creating 3D Models.

Slides:



Advertisements
Similar presentations
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
Advertisements

H331: Computer Graphics Philip Dutré Department of Computer Science Wednesday, February 25.
2IV60 Computer graphics Graphics primitives and attributes Jack van Wijk TU/e.
Drawing Geometric Objects
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Programming with OpenGL Part 2: Complete Programs Ed Angel Professor of Computer Science,
1 Lecture 4 Graphical primitives Rasterization: algorithmic approach Rasterization: geometric approach 2D discrete lines, triangles Discrete planes 3D.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer.
Computer Graphics CS 385 February 7, Fundamentals of OpenGl and Glut Today we will go through the basics of a minimal OpenGl Glut project, explaining.
3D Rendering with JOGL Introduction to Java OpenGL Graphic Library By Ricardo Veguilla
CAP 4703 Computer Graphic Methods Prof. Roy Levow Lecture 2.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 19 Other Graphics Considerations Review.
1 Perception and VR MONT 104S, Spring 2008 Lecture 22 Other Graphics Considerations Review.
Basics of Rendering Pipeline Based Rendering –Objects in the scene are rendered in a sequence of steps that form the Rendering Pipeline. Ray-Tracing –A.
COS 397 Computer Graphics Assoc. Prof. Svetla Boytcheva AUBG 2013 COS 397 Computer Graphics Practical Session №1 Introduction to OpenGL, GLFW and CG.
Basic OpenGL Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, September 10, 2003.
Drawing Basic Graphics Primitives Lecture 4 Wed, Sep 3, 2003.
CSE 381 – Advanced Game Programming Basic 3D Graphics
Week 2 - Wednesday CS361.
Image Synthesis Rabie A. Ramadan, PhD 2. 2 Java OpenGL Using JOGL: Using JOGL: Wiki: You can download JOGL from.
CSE 470: Computer Graphics. 10/15/ Defining a Vertex A 2D vertex: glVertex2f(GLfloat x, GLfloat y); 2D vertexfloating pointopenGL parameter type.
Graphics Systems and OpenGL. Business of Generating Images Images are made up of pixels.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
CSE Real Time Rendering Week 2. Graphics Processing 2.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
P RACTICING O PEN GL- P RIMITIVES. O PEN GL O UTPUT P RIMITIVES  Each geometric object is described by a set of vertices and the type of primitive to.
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
1 Graphics CSCI 343, Fall 2015 Lecture 2 Introduction to HTML, JavaScript and WebGL.
COMPUTER GRAPHICS CSCI 375. What do I need to know?  Familiarity with  Trigonometry  Analytic geometry  Linear algebra  Data structures  OOP.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Computer Graphics Bing-Yu Chen National Taiwan University.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
1 Graphics CSCI 343, Fall 2015 Lecture 3 Introduction to WebGL.
2/19/04© University of Wisconsin, CS559 Spring 2004 Last Time Painterly rendering 2D Transformations –Transformations as coordinate system changes –Transformations.
1 Angel: Interactive Computer Graphics5E © Addison- Wesley 2009 Image Formation Fundamental imaging notions Fundamental imaging notions Physical basis.
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)
1 Perception and VR MONT 104S, Fall 2008 Lecture 20 Computer Graphics and VR.
What are Computer Graphics Basically anything that is on you Monitor – This includes the text that you will see Text isn’t Advanced Graphics But…. Understanding.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
1 Programming with OpenGL Part 2: Complete Programs.
OpenGL API 2D Graphic Primitives Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
OpenGL: Introduction #include main() { OpenWindow() ; glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0,
CIS 681 Review: OpenGL. CIS 681 Command Syntax OpenGL commands start with a gl. This is followed by the base command such as Color. Followed by the number.
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.
Computer Graphics I, Fall Programming with OpenGL Part 2: Complete Programs.
OpenGL CS418 Computer Graphics John C. Hart. OpenGL Based on GL (graphics library) by Silicon Graphics Inc. (SGI) Advantages: Runs on everything, including.
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
Program Studi S-1 Teknik Informatika FMIPA Universitas Padjadjaran
CSC Graphics Programming
- Introduction - Graphics Pipeline
Modeling 101 For the moment assume that all geometry consists of points, lines and faces Line: A segment between two endpoints Face: A planar area bounded.
Programming with OpenGL Part 2: Complete Programs
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
OpenGL API 2D Graphic Primitives
Models and Architectures
Programming with OpenGL Part 2: Complete Programs
Models and Architectures
Models and Architectures
Introduction to Computer Graphics with WebGL
Drawing in the plane 455.
The Graphics Pipeline Lecture 5 Mon, Sep 3, 2007.
Models and Architectures
OpenGL program.
Models and Architectures
Programming with OpenGL Part 2: Complete Programs
Programming with OpenGL Part 2: Complete Programs
Programming with OpenGL Part 2: Complete Programs
Presentation transcript:

1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 15 Creating 3D Models

2 Creating Graphics for VR The synthetic camera model: 1) Define the 3D object(s) in space. 2) Specify lighting, shading and material properties 3) Specify camera properties (position, orientation, projection system, etc). 4) Imaging process: i) Transformation: Put the object in the camera's coordinate system. ii)Clipping: Eliminate points outside the camera's field of view. iii)Projection: Convert from 3D to 2D coordinates. iv)Rasterization: Projected objects represented as pixels in the frame buffer.

3 Building 3D models Objects in the computer graphics world are specified by the 3D positions of corners (called vertices). All curves are made up of line segments. All Surfaces are made up of polygons (e.g. triangles).

4 Lighting and Shading The physics of light is too complex to compute in real time. Simplified models of lighting and shading are used to make objects appear realistically shaded. Position, color and type of light sources are specified. Material properties indicate color and shininess of the material.

5 Specifying Camera and Object Positions Specifying the camera position: The position of the simulated camera relative to the objects in the scene determine what will appear on the screen. Changing the simulated camera position over time gives the appearance of moving around within the scene. Specifying the object position: Objects can be positioned in the 3D world using transformations. The object can be translated, rotated, or scaled.

6 Clipping The simulated camera in a graphics system cannot see everything, but has a limited field of view. The region of the synthetic world that the camera can see is specified by the clipping volume. Objects (or parts of objects) that are outside the clipping volume are not rendered in the image. Camera position Clipping Volume Rendered Not Rendered

7 Projection and Rasterization The projection converts the 3D model of the world to a 2D image. Different types of projection can be used: Perspective projection: Uses the pinhole camera model to project onto the image plane Orthographic projection: Simply sets the Z value to zero. The lines of projection are perpendicular to the image plane. Rasterization converts the 2D image into a pixelated image stored in the frame buffer. Problems: How do you draw a straight line on a pixelated monitor? How do you fill the inside of a polygon? (What's inside?) How do you keep track of which object is in front of other objects (so you only render the nearest object)?

8 Computer Programs and Functions A computer program is a set of step-by-step instructions that tell the computer how to solve a problem or accomplish a task. It is like a recipe. E.g. a recipe to make a cake. A function within a computer program is a named set of instructions to accomplish some piece of the program. The program can simply reference the function name to tell the computer to run all the instructions given in the function. Example: An icing recipe that is referenced by the cake recipe.

9 Function Parameters A parameter is a piece of information that the function needs to perform its task. Recipe example: The icing recipe may need to know if its chocolate or vanilla icing. Parameters have types, that tell the computer what kind of information it is. Examples: floatA real number in decimal form, e.g intAn integer, e.g. 14 charAn alpha-numeric character, e.g. 'b'

10 OpenGL vertices OpenGL (open graphics language) is a library of functions that perform the tasks required by computer graphics applications. OpenGL defines all objects in terms of vertices (points). 2D shapes are polygons defined by vertices. 3D shapes are groups of polygons. Example: OpenGL commands to draw two 2D points. glBegin(GL_POINTS); glVertex2f(3.0, 2.0); glVertex2f(5.0, 6.0); glEnd(); (3, 2) (5, 6) 2D image plane

11 Defining a Vertex A 2D vertex: glVertex2f(GLfloat x, GLfloat y); 2D vertexfloating pointopenGL parameter type (like floating point) A 3D vertex: glVertex3f(GLfloat x, GLfloat y, GLfloat z); Example: A 3D vertex using integer values: glVertex3i(4, 5, 2);

12 Connecting the Dots glBegin(GL_LINES); GL_LINES connects pairs of points. (x1, y1) (x2, y2) (x3, y3) (x4, y4) glVertex2f(x1, y1); glVertex2f(x2, y2); glVertex2f(x3, y3); glVertex2f(x4, y4); glEnd();

13 Other Drawing functions GL_LINE_STRIP: Connect each consecutive point with previous one. p1 p2 p3 p4 p5 p6 p1 p2 p3 p4 p1p2 p3p4 GL_LINE_LOOP: Same as line strip, except also connects last point with first point. GL_POLYGON: Vertices define the vertices of a polygon. Polygons have special properties that differ from line loops (e.g. you can fill in a polygon).

14 Examples Example 1: Draw a connected set of lines. glBegin(GL_LINE_STRIP); glVertex2f(3.0, 2.0); glVertex2f(5.0, 2.0); glVertex2f(5.0, 5.0); glVertex2f(4.0, 5.0); glEnd(); Example 2: Draw a connected line loop. glBegin(GL_LINE_LOOP); glVertex2f(3.0, 2.0); glVertex2f(5.0, 2.0); glVertex2f(5.0, 5.0); glVertex2f(4.0, 5.0); glEnd();

15 More Examples Example 3: Draw a polygon glBegin(GL_POLYGON); glVertex2f(3.0, 2.0); glVertex2f(5.0, 2.0); glVertex2f(5.0, 5.0); glVertex2f(4.0, 5.0); glEnd(); Other things that OpenGL can draw are: GL_TRIANGLES (connect groups of 3 points into triangles) GL_TRIANGLE_STRIP GL_QUADS GL_QUAD_STRIP