Image Synthesis Rabie A. Ramadan, PhD 2. 2 Java OpenGL Using JOGL: Using JOGL: Wiki: You can download JOGL from.

Slides:



Advertisements
Similar presentations
Today Composing transformations 3D Transformations
Advertisements

MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes Overview Goals of the course: 1. to introduce real-time 3D graphics programming with openGL.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Graphics Pipeline.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
3D Graphics Rendering and Terrain Modeling
CS 4363/6353 INTRODUCTION TO COMPUTER GRAPHICS. WHAT YOU’LL SEE Interactive 3D computer graphics Real-time 2D, but mostly 3D OpenGL C/C++ (if you don’t.
Transformations Objectives Understand how transformations work in 2D and 3D Understand the concept of homogenous coordinate system Understand scene graphs.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer.
OpenGL (II). How to Draw a 3-D object on Screen?
CHAPTER 7 Viewing and Transformations © 2008 Cengage Learning EMEA.
Rendering Pipeline Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006 (Slide set originally by Greg Humphreys)
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
3D Rendering with JOGL Introduction to Java OpenGL Graphic Library By Ricardo Veguilla
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
10/5/04© University of Wisconsin, CS559 Fall 2004 Last Time Compositing Painterly Rendering Intro to 3D Graphics Homework 3 due Oct 12 in class.
COMP 175: Computer Graphics March 10, 2015
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Image Synthesis Rabie A. Ramadan, PhD 3. 2 Our Problem.
CSE 381 – Advanced Game Programming Basic 3D Graphics
TWO DIMENSIONAL GEOMETRIC TRANSFORMATIONS CA 302 Computer Graphics and Visual Programming Aydın Öztürk
Week 2 - Wednesday CS361.
MIT EECS 6.837, Durand and Cutler Graphics Pipeline: Projective Transformations.
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
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.
Homogeneous Form, Introduction to 3-D Graphics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 20,
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360.
Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
COMPUTER GRAPHICS CSCI 375. What do I need to know?  Familiarity with  Trigonometry  Analytic geometry  Linear algebra  Data structures  OOP.
OpenGL: Introduction Yanci Zhang Game Programming Practice.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
OpenGL The Viewing Pipeline: Definition: a series of operations that are applied to the OpenGL matrices, in order to create a 2D representation from 3D.
Mark Nelson 3d projections Fall 2013
Image Synthesis Rabie A. Ramadan, PhD 4. 2 Review Questions Q1: What are the two principal tasks required to create an image of a three-dimensional scene?
2 COEN Computer Graphics I Evening’s Goals n Discuss viewing and modeling transformations n Describe matrix stacks and their uses n Show basic geometric.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Chapters 5 2 March Classical & Computer Viewing Same elements –objects –viewer –projectors –projection plane.
MIT EECS 6.837, Durand and Cutler The Graphics Pipeline: Projective Transformations.
David Luebke1/10/2016 CS 551 / 645: Introductory Computer Graphics David Luebke
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.
Lecture 7 Midterm Review. OpenGL Libraries gl: Basic OpenGL library, e.g. primitives. glu: OpenGL Utility library, a set of functions to create texture.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 15 Creating 3D Models.
The Graphics Pipeline Revisited Real Time Rendering Instructor: David Luebke.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
Honors Geometry.  We learned how to set up a polygon / vertex matrix  We learned how to add matrices  We learned how to multiply matrices.
Chapter 1 Graphics Systems and Models Models and Architectures.
CS 551 / 645: Introductory Computer Graphics Viewing Transforms.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Models and Architectures 靜宜大學 資訊工程系 蔡奇偉 副教授 2012.
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
GLSL Review Monday, Nov OpenGL pipeline Command Stream Vertex Processing Geometry processing Rasterization Fragment processing Fragment Ops/Blending.
OpenGL LAB III.
3D Ojbects: Transformations and Modeling. Matrix Operations Matrices have dimensions: Vectors can be thought of as matrices: v=[2,3,4,1] is a 1x4 matrix.
Introduction to 3-D Viewing Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 27, 2003.
Graphics Pipeline Bringing it all together. Implementation The goal of computer graphics is to take the data out of computer memory and put it up on the.
Introduction to Computer Graphics
- Introduction - Graphics Pipeline
Rendering Pipeline Aaron Bloomfield CS 445: Introduction to Graphics
3D Transformations Source & Courtesy: University of Wisconsin,
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.
3D Graphics Rendering PPT By Ricardo Veguilla.
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
Graphics Processing Unit
Projection in 3-D Glenn G. Chappell
Chapter V Vertex Processing
Geometric Objects and Transformations (II)
CS297 Graphics with Java and OpenGL
Presentation transcript:

Image Synthesis Rabie A. Ramadan, PhD 2

2 Java OpenGL Using JOGL: Using JOGL: Wiki: You can download JOGL from and To deploy an embedded applet, you‘ll use Sun‘s JNLP wrappers, which provide signed applets wrapped around native JOGL binaries.

3 3D Transformation OpenGL has a simple and powerful transformation model Vertices can be created with position, normal direction, and sets of texture coordinates.

4 Data Representation OpenGL represents vertex coordinates, texture coordinates, normal vectors, and colors generically as tuples. Tuples can be thought of as 4-component vectors. When working with the 1D, 2D, and 3D forms of commands the tuples are implicitly expanded to fill in unspecified components. e.g., for vertex coordinates, an unspecified z coordinate is set to 0

5 Data Representation OpenGL represents transforms as 4 × 4 matrices, plane equaions as 4-component tuples,

6 Transformation Pipeline OpenGL transformation pipeline can be thought of as a series of Cartesian coordinate spaces connected by transformations that can be directly set by the application. Object space, which starts with the application’s coordinates, Eye space, where the scene is assembled,

7 Transformation Pipeline Clip space, which defines the geometry that will be visible in the scene, NDC space, the canonical space resulting from perspective division, and Window space, which maps to the frame buffer’s pixel locations.

Behind the scenes Two players: The CPU, your processor and friend The GPU (Graphical Processing Unit) or equivalent software The CPU passes streams of vertices and of data to the GPU. The GPU processes the vertices according to the state that has been set; here, that state is “every four vertices is one quadrilateral polygon”. The GPU takes in streams of vertices, colors, texture coordinates and other data; constructs polygons and other primitives; then draws the primitives to the screen pixel-by-pixel. This process is called the rendering pipeline.

Anatomy of a rendering pipeline 1) Geometry is defined in local space. The vertices and coordinates of a surface are specified relative to a local basis and origin. This encourages re-use and replication of geometry; it also saves the tedious math of storing rotations and other transformations within the vertices of the shape itself. This means that changing the position of a highly complex object requires only changing a 4x4 matrix instead of recalculating all vertex values. World space Viewing space 3D screen space 2D display space Local space

Anatomy of a rendering pipeline 2) The pipeline transforms vertices and surface normals from local to world space. A series of matrices are concatenated together to form the single transformation which is applied to each vertex. The rendering engine (e.g., OpenGL) is responsible for associating the state that transforms each group of vertices with the actual vertex values themselves. World space Viewing space 3D screen space 2D display space Local space

Anatomy of a rendering pipeline 3) Rotate and translate the geometry from world space to viewing or camera space. At this stage, all vertices are positioned relative to the point of view of the camera. (The world really does revolve around you!) This makes operations such as clipping and hidden- object removal much faster. Viewing space World space 3D screen space 2D display space Local space

Anatomy of a rendering pipeline 4) Perspective: Transform the viewing frustum into an axis- aligned box. Coordinates are now in 3D screen space. 3D screen space World space Viewing space 2D display space Local space

Anatomy of a rendering pipeline 5) Collapse the box to a plane. Rasterize primitives using Z-axis information for depth-sorting and hidden-surface- removal. Clip primitives to the screen. Scale raster image to the final raster buffer and rasterize primitives. 2D display space World space Viewing space 3D screen space Local space

OpenGL’s matrix stacks OpenGL uses matrix stacks to store stacks of matrices, where the topmost matrix is (usually) the product of all matrices below. This allows you to build a local frame of reference— local space—and apply transforms within that space. Remember: matrix multiplication is associative but not commutative. ABC = A(BC) = (AB)C ≠ ACB ≠ BCA Pre-multiplying matrices that will be used more than once is faster than multiplying many matrices every time you render a primitive. A AB ABC

OpenGL’s matrix stacks GL has three matrix stacks: Modelview – positioning things relative to other things Projection – camera transforms Texture – texture-mapping transformations You choose your current matrix with glMatrixMode(); this sets the state for all following matrix operations. Each time you call glTranslate(), glRotate(), etc., these commands modify the current topmost matrix on the current stack. If you want to make local changes that only have limited effect, you use glPushMatrix() to push a new copy of your current matrix onto the top of the stack; then you modify it freely and, when done, call glPopMatrix().

Matrix stacks and scene graphs Matrix stacks are designed for nested relative transforms.

Rendering simple primitives GL’s state machine applies its state to each vertex in sequence. To render simple primitives, tell GL what kind of primitive to render: glBegin(GL_LINES) glBegin(GL_LINE_STRIP) glBegin(GL_TRIANGLES) glBegin(GL_QUADS) glBegin(GL_TRIANGLE_STRIP) And several others After calling glBegin(), you can call glVertex() repeatedly, passing in triples (or quads) of floats (or doubles) which are interpreted as positions in the context of the current rendering state. GL is very flexible about data sizes and data types When you’re done, call glEnd(). Your primitives will now be rasterized. glBegin(GL.GL_QUADS); glVertex3f(-1, -1, 0); glVertex3f( 1, -1, 0); glVertex3f( 1, 1, 0); glVertex3f(-1, 1, 0); glEnd();

18 Your assignment

19 OpenGL OpenGL installation

20 Try it Out

21 How does the program work? OpenGL uses the standard x and y axes, The positive x direction pointing toward the right and The positive y direction pointing upward. However, in 3D we need another dimension, the z dimension. The positive z direction points out of the screen.

22 How does OpenGL use these 3D coordinates? It simulates the way that our eyes work. Take a look at the picture. OpenGL converts all of the 3D points to pixel coordinates before it draws anything. To do this, it draws a line from each point in the scene to your eye and takes the intersection of the lines and the screen rectangle, as in the picture.

23 How does OpenGL use these 3D coordinates? When OpenGL wants to draw a triangle, it converts the three vertices into pixel coordinates and draws a "2D" triangle using those coordinates. The user's "eye" is always at the origin and looking in the negative z direction.

24 Going Through the Source Code

Will look into the details next time ISA 25