Tz-Huan Huang National Taiwan University

Slides:



Advertisements
Similar presentations
Programming with OpenGL - Getting started - Hanyang University Han Jae-Hyek.
Advertisements

CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Understanding the graphics pipeline Lecture 2 Original Slides by: Suresh Venkatasubramanian Updates by Joseph Kider.
Graphics Pipeline.
Status – Week 257 Victor Moya. Summary GPU interface. GPU interface. GPU state. GPU state. API/Driver State. API/Driver State. Driver/CPU Proxy. Driver/CPU.
RealityEngine Graphics Kurt Akeley Silicon Graphics Computer Systems.
Computer Graphics(Fall 2003) COMS 4160, Lecture 7: OpenGL 3 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
University of Sulaimani - School of Science - Computer Dept.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
Projective Texture Mapping
Compositing and Blending Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
Compositing and Blending - Chapter 8 modified by Ray Wisman Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
COMP Advanced Graphics Advanced Graphics - Part 6 The big picture: –Still working on advanced polygonal techniques with a special focus on OpenGL.
Image Compositing Angel 8.11 Angel: Interactive Computer Graphics5E © Addison-Wesley
Chapter 6. More on Color and Material Presented by Garrett Yeh.
Status – Week 277 Victor Moya.
GPU Simulator Victor Moya. Summary Rendering pipeline for 3D graphics. Rendering pipeline for 3D graphics. Graphic Processors. Graphic Processors. GPU.
GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware.
Jittering, Introduction to Stenciling Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Friday, February 6, 2004.
Creating Reflections and Shadows Using Stencil Buffers Mark J. Kilgard NVIDIA Corporation.
Shadows Computer Graphics. Shadows Shadows Extended light sources produce penumbras In real-time, we only use point light sources –Extended light sources.
© Copyright Khronos Group, Page 1 Harnessing the Horsepower of OpenGL ES Hardware Acceleration Rob Simpson, Bitboys Oy.
CS 480/680 Computer Graphics Course Overview Dr. Frederick C Harris, Jr. Fall 2012.
What is ? Open Graphics Library A cross-language, multi-platform API for rendering 2D and 3D computer graphics. The API is used to interact with a Graphics.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Programmable Pipelines. 2 Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 Going-through.
Computer Graphics Tz-Huan Huang National Taiwan University.
CS 638, Fall 2001 Multi-Pass Rendering The pipeline takes one triangle at a time, so only local information, and pre-computed maps, are available Multi-Pass.
© Copyright Khronos Group, Page 1 Shaders Go Mobile: An Introduction to OpenGL ES 2.0 Tom Olson, Texas Instruments Inc.
CS 4363/6353 OPENGL BACKGROUND. WHY IS THIS CLASS SO HARD TO TEACH? (I’LL STOP WHINING SOON) Hardware (GPUs) double in processing power ever 6 months!
1 10/24/ :01 UML Graphics II Shadows Session 4.
COMPUTER GRAPHICS CSCI 375. What do I need to know?  Familiarity with  Trigonometry  Analytic geometry  Linear algebra  Data structures  OOP.
Shadow Mapping Chun-Fa Chang National Taiwan Normal University.
Programmable Pipelines Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Advanced OpenGL Technique Jian Huang, CS 594, Fall 2002 Redbook: Chapters 6.1, 9.5, 9.6, 10.
Review of OpenGL Basics
1 3D API OPENGL ES v1.0 Owned by Silicon Graphics (SGL) Control was then transferred to Khronos Group Introduction.
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
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Programming With OpenGL
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.
11/24/ :45 Graphics II Shadow Maps Reflections Session 5.
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.
Background image by chromosphere.deviantart.com Fella in following slides by devart.deviantart.com DM2336 Programming hardware shaders Dioselin Gonzalez.
Compositing and Blending Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
The Framebuffer Hyun-Chul Cho. HyunChul Cho - KUCG -2 Buffer Goal of a graphics program Draw pictures on the screen Screen Rectangular array.
Tan-Chi Ho, CGGM Lab., CSIE of NCTU Pixel Operations and Buffers.
Introduction to OpenGL (INF 250) Veronika Solteszova et al., UiB Dept. of Informatics,
Computer Graphics I, Fall 2008 Compositing and Blending.
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
CSC Graphics Programming Budditha Hettige Department of Statistics and Computer Science.
Draw a Simple Object.
Programmable Pipelines
Computer Graphics Lecture 32
School of Computer Science
Real-Time Rendering Shadow Volumes
Important stuff that doesn’t fit elsewhere Evan Hart
Graphics Processing Unit
Visibility (hidden surface removal)
Chapter X Output Merger.
Ref: OpenGL Programming Guide (The Red Book)
The Framebuffer 1 Lecture 37 Fri, Nov 30, 2007.
OpenGL Background CS 4722.
OpenGL-Rendering Pipeline
Presentation transcript:

Tz-Huan Huang National Taiwan University Computer Graphics Tz-Huan Huang National Taiwan University

OpenGL ES and other topics Shadow Antialiasing Text rendering

OpenGL ES and other topics Shadow Antialiasing Text rendering

OpenGL ES OpenGL for Embedded System 1.X: fixed function hardware OpenGL ES 1.0 vs. OpenGL 1.3 OpenGL ES 1.1 vs. OpenGL 1.5 OpenGL ES 2.0 vs. OpenGL 2.0 1.X: fixed function hardware 2.X: programmable hardware OpenGL ES 1.1 is fully backward compatible with 1.0, but 2.0 is NOT.

OpenGL ES 1.x Common vs. Common-Lite profiles Common: Common-lite single-precision floating point type Common-lite fixed point type Khronos OpenGL ES API Registry Difference specification

Difference specification

OpenGL operations (1/2) In: Out: Vertex array related functions VertexPointer, DrawArray, etc Vertex buffer object realted functions BindBuffer, GenBuffer, etc ViewPort, Frustum, Ortho Matrix stack related functions Out: Begin/End paradigm and related functions

OpenGL operations (2/2) In: Out: ClipPlane Coloring and lighting related functions Out: TexGen RasterPos, WindowPos

Rasterization (1/2) In: Out: antialiasing: MULTISAMPING, POINT_SMOOTH, LINE_SMOOTH CullFace, PolygonOffset PixelStorei Out: 2D rasterization related functions Image processing related functions

Rasterization (2/2) In: 2D texture Fog Out: 1D/3D texture

Per-Fragment operations and the framebuffer In: Scissor/stencil/depth/alpha test Blending, dither, logic operation ReadPixels Out: Query DrawBuffer/ReadBuffer/CopyPixels Accumulation buffer

Special functions In: Out: Flush/Finish Hints Evaluators Selection Feedback Display Lists

State and state requests Only states related to supported features and types can be queried In: GetIntegerv GetFloatv Out: GetDoublev GetMap

OpenGL ES 2.X Only Common profile Khronos OpenGL ES API Registry single-precision floating point type Khronos OpenGL ES API Registry Difference specification

OpenGL operations (1/2) In: Out: VertexAttrib/VertexAttribPointer DrawArray/DrawElements Vertex buffer object Out: Begin/End paradigm VertexPointer, NormalPointer, … etc

OpenGL operations (2/2) In: Out: Viewport Vertex shader Transform related function matrix stack, frustrum, ortho, etc ClipPlane Lighting realted functions RasterPos, WindowPos

Rasterization (1/2) In: Out: antialiasing: MULTISAMPING, POINT_SMOOTH CullFace, PolygonOffset PixelStorei Out: 2D rasterization related functions Image processing related functions

Rasterization (2/2) In: Out: 2D texture Mipmap generation Fragment shader Out: 1D/3D texture Fog

Per-Fragment operations and the framebuffer In: Scissor/stencil/depth test Blending, dither, logic operation ReadPixels Frame buffer object Out: alpha test/query DrawBuffer/ReadBuffer/CopyPixels Accumulation buffer

Special functions In: Out: Flush/Finish Hints: only GENERATE_MIPMAP_HINT Out: Evaluators Selection Feedback Display Lists

State and state requests Only states related to supported features and types can be queried In: GetIntegerv GetFloatv Out: GetDoublev GetMap

OpenGL ES and other topics Shadow Antialiasing Text rendering

Review of OpenGL buffers Color buffer Depth buffer Stencil buffer Accumulation buffer

Color buffer glClear glBegin, glEnd, glVertex glDraw*

Depth buffer glEnable(GL_DEPTH_TEST) glClear glDepthFunc(func) func: GL_NEVER, GL_LESS, GL_EQUAL, GL_LEQUAL, GL_GREATER, GL_NOTEQUAL, GL_GEQUAL, GL_ALWAYS

Stencil buffer glStencilFunc(func, ref, mask) GL_NEVER: always fail GL_LESS: pass if (ref&mask)<(stencil&mask) GL_LEQUAL, GL_GREATER, GL_GEQUAL, GL_EQUAL, GL_NOTEQUAL, GL_ALWAYS glStencilOp(sfail, dpfail, dppass) Actions: GL_KEEP, GL_ZERO, GL_REPLACE, GL_INCR, GL_INCR_WRAP, GL_DECR, GL_DECR_WRAP

Accumulation buffer glAccum(op, value) op: GL_ACCUM: accum += color*value GL_LOAD: accum = color GL_ADD: accum += value GL_MULT: accum *= value GL_RETURN: color = accum

OpenGL ES and other topics Shadow Antialiasing Text rendering

Shadow

OpenGL vs. ray tracing OpenGL: Ray tracing: local shading Ambient+Diffuse+specular Ray tracing:

Simple case Squish objects into plane

Shadow projection L: location of light n: normal vector of plane P: vertex location P’: location of the vertex shadow Plane equation: ax+by+cz+d=0

Shadow map Idea: render a depth map from light position For every vertex, test if the z value is less then value from depth map

Shadow volume Idea: render a “volume” in the scene test if object is in the volume or not and update the stencil buffer render scene based on stencil buffer

OpenGL ES and other topics Shadow Antialiasing Text rendering

Antialiasing OpenGL specific Vendor extension Software-based antialiasing

OpenGL specific antialiasing Point, line, polygon antialiasing glHint(): GL_POINT_SMOOTH_HINT GL_LINE_SMOOTH_HINT GL_POLYGON_SMOOTH_HINT Fullscreen antialiasing glEnable(GL_MULTISAMPLE)

Vendor extensions NVIDIA: __GL_FSAA_MODE 0: FSAA disabled 1: 2x Bilinear Multisampling 4: 4x Bilinear Multisampling 7: 4x Bilinear Multisampling by 4x Supersampling 9: 8x Bilinear Multisampling 13: 8x Bilinear Multisampling by 4x Supersampling

Software-based antialiasing Blending Accumulation buffer

Blending in OpenGL glEnable(GL_BLEND) glBlendFunc(sfactor, dfactor) GL_ZERO GL_ONE GL_SRC_ALPHA …

Blending example Color = SRC_ALPHA*SRC_COLOR + (1-SRC_ALPHA)*NEW_COLOR glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // draw scene1 // draw scene2 … Color = SRC_ALPHA*SRC_COLOR + (1-SRC_ALPHA)*NEW_COLOR

Accumulation buffer Range = right – left glTranslate(-0.2*range/width, -0.2*range/height, 0.0); // draw scene glAccum(GL_LOAD, 0.25); glTranslate(-0.2*range/width, 0.2*range/height, 0.0); glAccum(GL_ACCUM, 0.25); glTranslate(0.2*range/width, -0.2*range/height, 0.0); glTranslate(0.2*range/width, 0.2*range/height, 0.0);

OpenGL ES and other topics Shadow Antialiasing Text rendering

Text rendering Text rendering is important for presentation of textual information However, there is no native font support in OpenGL. The Reasons: Font format: type1, type3, truetype, opentype, etc. Font rendering: related to window system

Text rendering in OpenGL Bitmap font Outline font Texture mapped font

Bitmap font Pros: Cons: Requirements Very fast Doesn’t support scaling, rotation, etc Quality 2D only Requirements glBitmap() glRasterPos()

Outline font Pros Cons Requirements Supports rotation, scaling, coloring, material, lighting, antialiasing, texture mapping, etc Cons Might be very slow Requirements Font format parsing/conversion

Texture mapped text Pros Cons Requirements High quality text rendering results Cons Might be difficult to integrated into OpenGL scene Requirements Offline text rendering

3rd party libraries GLX WGL GLUT Queso GLC http://quesoglc.sourceforge.net GLTT http://gltt.sourceforge.net FTGL http://ftgl.wiki.sourceforge.net

GLX X-window system only Can use any X font in the system Supports only bitmap font Usage XLoadQueryFont() glXUseXFont()

WGL Microsoft Windows only Can use any windows font Supports bitmap and outline font Usage: wglUseFontBitmaps() wglUseFontOutlines() Win32 api to load bitmap/truetype fonts

GLUT Easy to use Supports bitmap and outlines Limited in choice of fonts Usage: glutBitmapCharacter() glutStrokeCharacter()

Queso GLC Free implementation of SGI IRIS GLC Based on freetype2 and fontcnofig Supports bitmap and outline font

GLTT and FTGL GLTT uses freetype1, while FTGL uses freetype2 Supports bitmap and outline fonts

Thank you very much