Computer Graphics Practical Lesson 7

Slides:



Advertisements
Similar presentations
Compositing and Blending Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive Computer Graphics.
Advertisements

OPENGL Return of the Survival Guide. Buffers (0,0) OpenGL holds the buffers in a coordinate system such that the origin is the lower left corner.
CS 4363/6353 BASIC RENDERING. THE GRAPHICS PIPELINE OVERVIEW Vertex Processing Coordinate transformations Compute color for each vertex Clipping and Primitive.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
Week 7 - Monday.  What did we talk about last time?  Specular shading  Aliasing and antialiasing.
Compositing and Blending Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
Blending MAE152 Computer Graphics for Engineers and Scientists Fall 03.
Compositing and Blending - Chapter 8 modified by Ray Wisman Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Image Compositing Angel 8.11 Angel: Interactive Computer Graphics5E © Addison-Wesley
OpenGL Son of the Survival Guide. Last Time on OpenGL Windowing … glut Rendering Primatives Transformations Projections State Management.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Better Interactive Programs Ed Angel Professor of Computer Science, Electrical and Computer.
CSC461 Lecture 11: Interactive Programs Contents and Objectives Picking Writing modes – XOR/Copy Rubberbanding Display list.
Antialiasing CAP4730: Computational Structures in Computer Graphics.
Computer Graphics Ben-Gurion University of the Negev Fall 2012.
An Interactive Introduction to OpenGL Programming Ed Angel
Korea University Korea University Computer Graphics Laboratory Computer Graphics Laboratory Jung Lee, Chapter 13.
Lecture 12 Blending, Anti-aliasing, Fog, Display Lists.
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
Advanced Computer Graphics Depth & Stencil Buffers / Rendering to Textures CO2409 Computer Graphics Week 19.
1 Better Interactive Programs. 2 Objectives Learn to build more sophisticated interactive programs using ­Picking Select objects from the display Three.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
MAE152 Computer Graphics for Scientists and Engineers Fall 03 Display Lists.
OpenGL Architecture Display List Polynomial Evaluator Per Vertex Operations & Primitive Assembly Rasterization Per Fragment Operations Frame Buffer Texture.
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
Compositing and Blending
Computer Graphics Blending CO2409 Computer Graphics Week 14.
UniS CS297 Graphics with Java and OpenGL Blending.
OpenGL Special Effects Jian-Liang Lin 2002 Blending: Alpha Channel Alpha value can be specify by glColor* When blending is enabled, the alpha value is.
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.
WORKING WITH SELECTIONS MASKS and CHANNELS 3D IMAGES LAYER BASICS PHOTO.
1 Computer Graphics Week11 : Hidden Surface Removal.
Compositing and Blending Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Computer Graphics I, Fall 2008 Compositing and Blending.
1© 2009 Autodesk Hardware Shade – Presenting Your Designs Hardware and Software Shading HW Shade Workflow Tessellation Quality Settings Lighting Settings.
2.01 Investigate graphic image design.
Graphic Format Factors
Visible surface determination
Graphic Format Factors
Week 7 - Monday CS361.
Introduction to Computer Graphics with WebGL
Week 2 - Friday CS361.
1.01 Investigate graphic types and file formats.
Better Interactive Programs
The Graphics Rendering Pipeline
I = a I + ( ) 1 – a I BLENDING, ANTIALIASING, AND FOG l l 1 l 2 Earth
Flicker Free Animation Using Vray
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
Graphic Format Factors
Graphic Format Factors
Display Lists & Text Glenn G. Chappell
Better Interactive Programs
UMBC Graphics for Games
Lecture 13 Clipping & Scan Conversion
3D Game Programming Texture Mapping
2.01 Investigate graphic image design.
Graphic Format Factors
2.01 Investigate graphic image design.
Graphic Format Factors
Computer Graphics Practical Lesson 8
Computer Graphics 4Practical Lesson
2.01 Investigate graphic image design.
Computer Graphics 5Practical Lesson
Chapter X Output Merger.
03 | Creating, Texturing and Moving Objects
Graphic Format Factors
Graphic Format Factors
2.01 Investigate graphic image design.
3D Game Programming Texture Mapping
Introduction to Ray Tracing
Graphic Format Factors
Presentation transcript:

Computer Graphics Practical Lesson 7 Display Lists, blending and anti alias

OFF files OFF files are standard format to represent 3D model. Starts with number of points, then number of polygons ( usually triangles ). List of points. List of polygons – number of points of polygon and list of points index. Easy to write OFF file reader and draw these models.

What is display list? Each command we give in OpenGL is compiled into the data format of the graphic device. Display list - save a sequence of commands that are compiled on startup and run them as many times as we want, so we save the compile time. Not too efficient, hardly being used today. We will see more effective methods on next practical session.

Create a display list To create a display list: glNewList(list_index, GL_COMPILE); …… write list’s command. glEndList(); List index is int value that is index of value Second parameter is working mode. There are 2 options: compile only(GL_COMPILE) or compile and run immediately(GL_COMPILE_AND_EXECUTE) NODE: Only OpenGL commands are stored in display list.

Deleting a list To delete a list: glDeleteList(list_index) Where list_index is the id of the list.

Running a display list To run a display list: glCallList(list_index) The parameter is the id of the list. In OpenGL we can create nested lists calls.

Managing Display lists When we assign ourselves the id’s of each lists, it can cause problems. We may overrun previous lists for example. OpenGl can assign lists’ id’s, so we won’t overrun existing lists: int glGenLists(int range) Where range is the number of list we want to assign. After that we need to call glNewList for each list separately.

Blending When transparent objects are drawn with other objects behind them, we need to mix between their colors. Until now, it was done automatically using alpha values of objects colors. Blending allow us to define how the colors of objects will be mixed.

Defining Blending (cont’) flBlendFunc(Glenum sfactor, Glenum dfactor). This function set the ratio between source and destination objects colors. There are many values for this enum, for example: GL_ZERO ( object color is disabled ) GL_ONE (Fully use of color) If source and destination values are set with GL_ONE, both objects color will have the same weight.

Defining Blending(cont’) The order of drawing objects affects the final results since the first object that was drawn receives the factor of destination, so if the order is changed, it will receive the destination factor.

Blending transparent and opaque objects When we use the depth buffer, each time we render an object, we check in depth buffer if an object has been drawn closer to the camera. If not, we render the object and update the depth buffer. If we have transparent object like windshield close to the eye, it will prevent the drawing of any object behind him.

Blending transparent and opaque objects(cont’) To solve this problem, we need to prevent writing to depth buffer for transparent objects. Void glDepthMask(bool) This function enable or disable the writing to depth buffer. When we draw transparent objects, we disable the writing.

Antialiasing When objects and lines are drawn, the borders are coarse. To receive an image with higher quality the boarders are blurred. Each boarder point color is calculated as weighted average of adjunct pixels depend on covered space by line and selected policy.

Antialiasing parameters To enable antialiasing on lines: glEnable(GL_LINE_SMOOTH) To set quality of antialiasing: void glHint(Glenum target, Glenum hint). Target can be GL_LINE_SMOOTH_HINT, GL_POINT_SMOOTH_HINT and GP_POLYGON_SMOOTH_HINT. Hint can be GL_NICEST( per pixel ) or GL_FASTEST( per vertex)

Antialiasing Example Click on ‘R’ rotates the lines Click on ‘E’ sets antialias on. Click on ‘D’ sets antialias off.