image synthesis rabie a. ramadan, phd 1. 2 about my self rabie a. ramadan my website and...

26
Image Synthesis Rabie A. Ramadan, PhD 1

Upload: darcy-powers

Post on 13-Jan-2016

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

Image Synthesis

Rabie A. Ramadan, PhD

1

Page 2: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

2

About my self

Rabie A. Ramadan

My website and publications • http://www.rabieramadan.org

Page 3: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

3

Class Rules

I am not here to punish you

Trust yourself and do your best

I want you to learn and compete with others working on the same field

I want you to be confident when you speak with others

Page 4: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

Class Rules

You can bring anything to drink but NO FOOD PLEASE

When you come in , DO NOT knock on the door

When you want to leave , do not tell me Just leave but you will be counted as absent• I do not take attendance every class but sometimes I

do

Page 5: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

5

Class Rules

Attendance is a vey important

Assignments must be delivered on time

• All assignments are individual assignments unless it is clearly stated that you can work on groups.

• Assignments or part of them that are copied (including the programming assignments) will not be counted towards your grades.

Page 6: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

6

Class Information

Textbook

Page 7: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

7

Class Information Website

http://www.rabieramadan.org/classes/2011/image/

Page 8: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

OpenGl and Image Synthesis

Two principal tasks are required to create an image of a three-dimensional scene: • Modeling

• Rendering.

Page 9: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

OpenGl and Image Synthesis

Modeling : • The description of an object that is going to

be used by the graphics system. E.g mathematical model.

• Models must be created for every object in a scene;

• Accurately capture the geometric shape and appearance of the object.

Page 10: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

OpenGl and Image Synthesis

Rendering: • Takes models as input and generates pixel values

for the final image.

OpenGL: • Principally concerned with object rendering;

• it does not provide explicit support for creating object models

Page 11: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

What is OpenGL?

A software interface to graphics hardware

Graphics rendering API (Low Level) • High-quality color images composed of geometric and

image primitives

• Window system independent

• Operating system independent

Page 12: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

OpenGL Basics Rendering

• Typically execution of OpenGL commands• Converting geometric/mathematical object descriptions

into frame buffer values OpenGL can render:

• Geometric primitives • Lines, points, polygons, etc…

• Bitmaps and Images• Images and geometry linked through texture mapping

Graphics Pipeline

Page 13: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

Polygonal Representation

A simple object, such as a box, can be represented using a polygon for each face in the object.

Modeling task consists of :

• Determining the 3D coordinates of each vertex in each polygon that makes up a model.

• To provide accurate rendering of a model’s appearance or surface shading,

• the modeler may also have to determine color values, and texture coordinates for the model’s vertices and faces.

Page 14: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

Decomposition and Tessellation

Tessellation • The process of decomposing a complex surface.

• A sphere simpler primitives such as triangles.

OpenGL does not specify a decomposition algorithm

Page 15: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

Tessellation

latitude-longitude tessellation for a sphere

Octahedron easily splits into four triangles

Page 16: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

Shading Normals

Normals are perpendicular the surface,

You can find the normal at a particular point on a surface by

• First Finding the flat plane that just touches the surface at that point.

The normal is the vector that’s perpendicular to that plane.

Page 17: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

Shading Normals

Page 18: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

Smooth Shading

Example for more than one polygon

Page 19: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

Shading Normals

Selecting the vectors depends on the type of polygon.

Page 20: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

Triangle Stripping

To speedup OpenGL and save space, polygons are divided into triangles strips.

Decide whether the first triangle should have a clockwise or counterclockwise winding

Triangle strip winding.

Page 21: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

Triangle Stripping

Triangle fan winding

Page 22: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

Triangle Stripping

OpenGL does not have a way to specify generalized triangle strips.

• The user must choose between GL_TRIANGLE_STRIP and GL_TRIANGLE_FAN

The triangle strip is the more versatile primitive.

The triangle fans are ideal for large convex polygons

Page 23: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

Triangle Stripping For regular meshes, triangle strips should be lined up side

by side. The goal here is to minimize the number of total strips and

try to avoid “orphan” triangles (also known as singleton strips)

Page 24: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

Greedy Tri-stripping

A simple method of converting a model into triangle strips.

For OpenGL,• A better algorithm is to choose a polygon, convert it to

triangles, then move to the polygon which has an edge that is shared with the last edge of the previous polygon.

• A given starting polygon and starting edge determines the strip path.

• The strip grows until it runs off the edge of the model or reaches a polygon that is already part of another strip

Page 25: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

Example

“Greedy” triangle strip generation.

Page 26: Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications

C# Code

How to install OpenGL http://www.videotutorialsrock.com/opengl_tut

orial/get_opengl_setup_windows/video.php