OpenGL-ES 3.0 And Beyond Boston 2014 1 Photo credit :Johnson Cameraface OpenGL Basics.

Slides:



Advertisements
Similar presentations
COMPUTER GRAPHICS SOFTWARE.
Advertisements

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.
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.
Informationsteknologi Wednesday, December 12, 2007Computer Graphics - Class 171 Today’s class OpenGL Shading Language.
MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes Overview Today: - Make sure everyone is set up with an OpenGL environment - OpenGL basics:
Status – Week 277 Victor Moya.
Status – Week 283 Victor Moya. 3D Graphics Pipeline Akeley & Hanrahan course. Akeley & Hanrahan course. Fixed vs Programmable. Fixed vs Programmable.
The Graphics Pipeline CS2150 Anthony Jones. Introduction What is this lecture about? – The graphics pipeline as a whole – With examples from the video.
The programmable pipeline Lecture 10 Slide Courtesy to Dr. Suresh Venkatasubramanian.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
GAM532 DPS932 – Week 1 Rendering Pipeline and Shaders.
Michael Robertson Yuta Takayama. WebGL is OpenGL on a web browser. OpenGL is a low-level 3D graphics API Basically, WebGL is a 3D graphics API that generates.
REAL-TIME VOLUME GRAPHICS Christof Rezk Salama Computer Graphics and Multimedia Group, University of Siegen, Germany Eurographics 2006 Real-Time Volume.
Geometry Shaders. Visualizing Normal Vectors  textbook calls this a “hedgehog plot” but (I think) that this is a misuse of the term  a hedgehog plot.
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.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
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.
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360.
1 Graphics CSCI 343, Fall 2015 Lecture 4 More on WebGL.
CS 480/680 Intro Dr. Frederick C Harris, Jr. Fall 2014.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
COMPUTER GRAPHICS CSCI 375. What do I need to know?  Familiarity with  Trigonometry  Analytic geometry  Linear algebra  Data structures  OOP.
GAM532 DPS932 – Week 2 Vertex Shaders. The Shader Pipeline Vertex Processing Primitive Assembly / Processing Rasterization Fragment Process Pixel Output.
GRAPHICS PIPELINE & SHADERS SET09115 Intro to Graphics Programming.
Review of OpenGL Basics
Introduction to OpenGL  OpenGL is a graphics API  Software library  Layer between programmer and graphics hardware (and software)  OpenGL can fit in.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
CSE 381 – Advanced Game Programming GLSL. Rendering Revisited.
1 Graphics CSCI 343, Fall 2015 Lecture 5 Color in WebGL.
1 Graphics CSCI 343, Fall 2015 Lecture 25 Texture Mapping.
 Learn how you can use the shader through OpenGL ES  Add texture on object and make the object have a different look!!
 Learn some important functions and process in OpenGL ES  Draw some triangles on the screen  Do some transformation on each triangle in each frame.
Ray Tracing using Programmable Graphics Hardware
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.
Background image by chromosphere.deviantart.com Fella in following slides by devart.deviantart.com DM2336 Programming hardware shaders Dioselin Gonzalez.
OpenGL Shading Language
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS The GPU.
The Graphics Pipeline Revisited Real Time Rendering Instructor: David Luebke.
Advanced Texture Mapping Bump Mapping & Environment Mapping (Reflection)
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Models and Architectures 靜宜大學 資訊工程系 蔡奇偉 副教授 2012.
An Introduction to the Cg Shading Language Marco Leon Brandeis University Computer Science Department.
GLSL Review Monday, Nov OpenGL pipeline Command Stream Vertex Processing Geometry processing Rasterization Fragment processing Fragment Ops/Blending.
COMP 175 | COMPUTER GRAPHICS Remco Chang1/XX13 – GLSL Lecture 13: OpenGL Shading Language (GLSL) COMP 175: Computer Graphics April 12, 2016.
Shaders, part 2 alexandri zavodny.
Graphics Processing Unit
Introduction to OpenGL
Chapter 6 GPU, Shaders, and Shading Languages
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
GLSL I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico.
Introduction to Computer Graphics with WebGL
Day 05 Shader Basics.
Chapter VI OpenGL ES and Shader
Graphics Processing Unit
Programming with OpenGL Part 3: Shaders
Mickaël Sereno Shaders Mickaël Sereno 25/04/2019 Mickaël Sereno -
03 | Creating, Texturing and Moving Objects
Introduction to OpenGL
CS 480/680 Computer Graphics GLSL Overview.
OpenGL-Rendering Pipeline
CS 480/680 Fall 2011 Dr. Frederick C Harris, Jr. Computer Graphics
Presentation transcript:

OpenGL-ES 3.0 And Beyond Boston Photo credit :Johnson Cameraface OpenGL Basics

OpenGL-ES 3.0 And Beyond Boston OpenGL-ES Basics How to draw stuff Use the OS to create the display How to draw stuff Use the OS to create the display Connect the display to OpenGL How to draw stuff Use the OS to create the display Connect the display to OpenGL Initialization Steps –Load resources –Models, images, shaders, etc. How to draw stuff Use the OS to create the display Connect the display to OpenGL Initialization Steps –Load resources –Models, images, shaders, etc. Rendering Steps –Iterate through each visible object, making OpenGL state and rendering calls as needed How to draw stuff Use the OS to create the display Connect the display to OpenGL Initialization Steps –Load resources –Models, images, shaders, etc. Rendering Steps –Iterate through each visible object, making OpenGL state and rendering calls as needed Process Any Input How to draw stuff Use the OS to create the display Connect the display to OpenGL Initialization Steps –Load resources –Models, images, shaders, etc. Rendering Steps –Iterate through each visible object, making OpenGL state and rendering calls as needed Process Any Input Update object state based upon input or elapsed time How to draw stuff Use the OS to create the display Connect the display to OpenGL Initialization Steps –Load resources –Models, images, shaders, etc. Rendering Steps –Iterate through each visible object, making OpenGL state and rendering calls as needed Process Any Input Update object state based upon input or elapsed time Cleanup - release resources, disconnect OpenGL

OpenGL-ES 3.0 And Beyond Boston OpenGL-ES Basics OpenGL is a State Machine OpenGL is a state machine – in other words, it takes direct action by the user to change state. State changes are serial. The state is stored in the OpenGL context. State is: Active textures, active shaders, current vertex and index data, active render targets, shader uniforms, culling settings, winding order, raster operations, active stencil operations, blending, texture filtering, depth testing, etc. etc. etc. When you make a render call, what gets rendered depends upon what state was active at that time.

OpenGL-ES 3.0 And Beyond Boston OpenGL is a State Machine OpenGL-ES Basics OpenGL is a State Machine OpenGL is a state machine – in other words, it takes direct action by the user to change state. State changes are serial. The state is stored in the OpenGL context. State is: Active textures, active shaders, current vertex and index data, active render targets, shader uniforms, culling settings, winding order, raster operations, active stencil operations, blending, texture filtering, depth testing, etc. etc. etc. When you make a render call, what gets rendered depends upon what state was active at that time. Do not forget this….

OpenGL-ES 3.0 And Beyond Boston OpenGL-ES Basics Rendering an object Assuming that all vertex, texture data is loaded: 1.Set the state for the object. a)Position and Projection –Set the model transformation and projection matricies –(vertex shader) b)Shading –Lighting parameters, materials, blending –(fragment shader) c)Misc. state –Winding order, stencil, viewport, etc. –(glEnable/glDisable, etc.) 2.Invoke a render call

OpenGL-ES 3.0 And Beyond Boston OpenGL-ES 2.0/3.0 Pipeline Primitive Draw Processing Vertex Processing Vertex Primitive Processing Rasterization Fragment Processing Fragment Pixel Processing Pixel Image Vertex Shader Fragment Shader no stream/ discard fail/discard no write API CALL

OpenGL-ES 3.0 And Beyond Boston D Math overview

OpenGL-ES 3.0 And Beyond Boston World Coordinates Each object starts off in it’s own 3D coordinate system Object CoordinatesEye Coordinates View Matrix Model Matrix Down the pipeline - Viewing the scene

OpenGL-ES 3.0 And Beyond Boston For multiple objects, they need to be set into world coordinates through the use of the Model Matrix Object CoordinatesWorld CoordinatesEye Coordinates View Matrix Model Matrix Down the pipeline - Viewing the scene

OpenGL-ES 3.0 And Beyond Boston After the transformation, the are all in the same coordinate system – World Coordinates World CoordinatesObject CoordinatesEye Coordinates View Matrix Model Matrix Down the pipeline - Viewing the scene

OpenGL-ES 3.0 And Beyond Boston Eye Coordinates Then we use the View Matrix to put everything relative to the eye World CoordinatesObject CoordinatesWorld CoordinatesEye Coordinates View Matrix Model Matrix Down the pipeline - Viewing the scene

OpenGL-ES 3.0 And Beyond Boston Eye Coordinates Then we use the View Matrix to put everything relative to the eye World CoordinatesObject CoordinatesWorld CoordinatesEye Coordinates View Matrix Model Matrix Down the pipeline - Viewing the scene

OpenGL-ES 3.0 And Beyond Boston World Coordinates For multiple objects, they need to be set into world coordinates through the use of the Model Matrix Object CoordinatesWorld CoordinatesEye Coordinates View Matrix Model Matrix Down the pipeline - Viewing the scene

OpenGL-ES 3.0 And Beyond Boston Shader Overview OpenGL ES: 2 programmable stages - “shaders”. Vertex Shader: Convert vertex position into “eye space” – called for each vertex in a primitive Fragment Shader: Compute color of fragment – called for each fragment (i.e. pixel) A primitive is created from vertices in 3D space A Fragment is aligned to the pixel grid.

OpenGL-ES 3.0 And Beyond Boston Vertex Shaders The Vertex Shader is the programmable shader stage in the rendering pipeline that handles the processing of individual vertices. The Vertex Shader takes Vertex Attribute data, process one vertex at a time and generates one output vertices. Vertex shaders typically perform transformations to post-projection space, for consumption later rendering stages. They can also be used to do per-vertex lighting, or to perform setup work for later shader stages. Any per- vertex calculations can be done in a vertex shader.

OpenGL-ES 3.0 And Beyond Boston Vertex Shader (OpenGL-ES-3.0) #version 300 es layout (location = 0) in highp vec3 a_Position; layout (location = 1) in mediump vec4 a_Color; out mediump vec4v_color; uniform mat4 u_MVP; void main() { gl_Position = u_MVP * vec4(a_Position, 1.0); v_color = a_Color; }

OpenGL-ES 3.0 And Beyond Boston Vertex Shader #version 300 es layout (location = 0) in highp vec3 a_Position; layout (location = 1) in mediump vec4 a_Color; out mediump vec4v_color; uniform mat4 u_MVP; void main() { gl_Position = u_MVP * vec4(a_Position, 1.0); v_color = a_Color; }

OpenGL-ES 3.0 And Beyond Boston Vertex Shader #version 300 es layout (location = 0) in highp vec3 a_Position; layout (location = 1) in mediump vec4 a_Color; out mediump vec4v_color; uniform mat4 u_MVP; void main() { gl_Position = u_MVP * vec4(a_Position, 1.0); v_color = a_Color; }

OpenGL-ES 3.0 And Beyond Boston Vertex Shader #version 300 es layout (location = 0) in highp vec3 a_Position; layout (location = 1) in mediump vec4 a_Color; out mediump vec4v_color; uniform mat4 u_MVP; void main() { gl_Position = u_MVP * vec4(a_Position, 1.0); v_color = a_Color; }

OpenGL-ES 3.0 And Beyond Boston Vertex Shader Application code Shader code glVertexAttribPointer(0,3,GL_FLOAT,GL_FALSE,i,vdata); glVertexAttribPointer(1,4,GL_FLOAT,GL_FALSE,i,vdata+3); glEnableVertexAttribArray( 0 ); glEnableVertexAttribArray( 1 ); #version 300 es layout (location = 0) in highp vec3 a_Position; layout (location = 1) in mediump vec4 a_Color;

OpenGL-ES 3.0 And Beyond Boston Vertex Shader glVertexAttribPointer(0,3,GL_FLOAT,GL_FALSE,i,vdata); glVertexAttribPointer(1,4,GL_FLOAT,GL_FALSE,i,vdata+3); glEnableVertexAttribArray( 0 ); glEnableVertexAttribArray( 1 ); #version 300 es layout (location = 0) in highp vec3 a_Position; layout (location = 1) in mediump vec4 a_Color; Application code Shader code

OpenGL-ES 3.0 And Beyond Boston Vertex Shader glVertexAttribPointer(0,3,GL_FLOAT,GL_FALSE,i,vdata); glVertexAttribPointer(1,4,GL_FLOAT,GL_FALSE,i,vdata+3); glEnableVertexAttribArray( 0 ); glEnableVertexAttribArray( 1 ); #version 300 es layout (location = 0) in highp vec3 a_Position; layout (location = 1) in mediump vec4 a_Color; Application code Shader code

OpenGL-ES 3.0 And Beyond Boston Vertex Shader #version 300 es layout (location = 0) in highp vec3 a_Position; layout (location = 1) in mediump vec4 a_Color; out mediump vec4v_color; uniform mat4 u_MVP; void main() { gl_Position = u_MVP * vec4(a_Position, 1.0); v_color = a_Color; }

OpenGL-ES 3.0 And Beyond Boston Vertex Shader #version 300 es layout (location = 0) in highp vec3 a_Position; layout (location = 1) in mediump vec4 a_Color; out mediump vec4v_color; uniform mat4 u_MVP; void main() { gl_Position = u_MVP * vec4(a_Position, 1.0); v_color = a_Color; }

OpenGL-ES 3.0 And Beyond Boston Vertex Shader #version 300 es layout (location = 0) in highp vec3 a_Position; layout (location = 1) in mediump vec4 a_Color; out mediump vec4v_color; uniform mat4 u_MVP; void main() { gl_Position = u_MVP * vec4(a_Position, 1.0); v_color = a_Color; }

OpenGL-ES 3.0 And Beyond Boston Vertex Shader #version 300 es layout (location = 0) in highp vec3 a_Position; layout (location = 1) in mediump vec4 a_Color; out mediump vec4v_color; uniform mat4 u_MVP; void main() { gl_Position = u_MVP * vec4(a_Position, 1.0); v_color = a_Color; }

OpenGL-ES 3.0 And Beyond Boston Vertex Shader #version 300 es layout (location = 0) in highp vec3 a_Position; layout (location = 1) in mediump vec4 a_Color; out mediump vec4v_color; uniform mat4 u_MVP; void main() { gl_Position = u_MVP * vec4(a_Position, 1.0); v_color = a_Color; }

OpenGL-ES 3.0 And Beyond Boston Vertex Shader #version 300 es layout (location = 0) in highp vec3 a_Position; layout (location = 1) in mediump vec4 a_Color; out mediump vec4v_color; uniform mat4 u_MVP; void main() { gl_Position = u_MVP * vec4(a_Position, 1.0); v_color = a_Color; }

OpenGL-ES 3.0 And Beyond Boston Vertex Shader #version 300 es layout (location = 0) in highp vec3 a_Position; layout (location = 1) in mediump vec4 a_Color; out mediump vec4v_color; uniform mat4 u_MVP; void main() { gl_Position = u_MVP * vec4(a_Position, 1.0); v_color = a_Color; }

OpenGL-ES 3.0 And Beyond Boston Vertex Shader  Fragment Shader Overview The vertex shader is responsible for converting input vertices into projected out vertices. Eventually the rasterization engine will convert these vertices into interpolated pixel locations for processing by the fragment shader. A primitive is created from vertices in 3D space A Fragment is aligned to the pixel grid.

OpenGL-ES 3.0 And Beyond Boston Vertex Shader  Fragment Shader Interpolation The rasterization step is how the pipeline gets from vertices to pixels. The vertex shader converts input to output vertices. The rasterizer converts the transformed primitives to pixel-grid fragments. The fragment shader get run – ONCE FOR EACH FRAGMENT. Potentially millions of times!

OpenGL-ES 3.0 And Beyond Boston Rasterization & Interpolation

OpenGL-ES 3.0 And Beyond Boston Fragment Shader #version 300 es precision mediump float; in mediump vec4 v_color; layout (location = 0) out lowp vec4 o_Color; void main() { o_Color = v_color; }

OpenGL-ES 3.0 And Beyond Boston Vertex Shader #version 300 es layout (location = 0) in highp vec3 a_Position; layout (location = 1) in mediump vec4 a_Color; out mediump vec4v_color; uniform mat4 u_MVP; void main() { gl_Position = u_MVP * vec4(a_Position, 1.0); v_color = a_Color; }

OpenGL-ES 3.0 And Beyond Boston Fragment Shader #version 300 es precision mediump float; in mediump vec4 v_color; layout (location = 0) out lowp vec4 o_Color; void main() { o_Color = v_color; }

OpenGL-ES 3.0 And Beyond Boston Fragment Shader #version 300 es precision mediump float; in mediump vec4 v_color; layout (location = 0) out lowp vec4 o_Color; void main() { o_Color = v_color; }

OpenGL-ES 3.0 And Beyond Boston Fragment Shader #version 300 es precision mediump float; in mediump vec4 v_color; layout (location = 0) out lowp vec4 o_Color; void main() { o_Color = v_color; }

OpenGL-ES 3.0 And Beyond Boston Fragment Shader #version 300 es precision mediump float; in mediump vec4 v_color; layout (location = 0) out lowp vec4 o_Color; void main() { o_Color = v_color; }

OpenGL-ES 3.0 And Beyond Boston Fragment Shader #version 300 es precision mediump float; in mediump vec4 v_color; layout (location = 0) out lowp vec4 o_Color; void main() { o_Color = v_color; }

OpenGL-ES 3.0 And Beyond Boston Fragment Shader #version 300 es precision mediump float; in mediump vec4 v_color; layout (location = 0) out lowp vec4 o_Color; void main() { o_Color = v_color; }

OpenGL-ES 3.0 And Beyond Boston Vertex Shader #version 300 es layout (location = 0) in highp vec3 a_Position; layout (location = 1) in mediump vec4 a_Color; out mediump vec4v_color; uniform mat4 u_MVP; void main() { gl_Position = u_MVP * vec4(a_Position, 1.0); v_color = a_Color; }

OpenGL-ES 3.0 And Beyond Boston Vertex Shader #version 300 es layout (location = 0) in highp vec3 a_Position; layout (location = 1) in mediump vec4 a_Color; out mediump vec4v_color; uniform mat4 u_MVP; void main() { gl_Position = u_MVP * vec4(a_Position, 1.0); v_color = a_Color; } smooth flat

OpenGL-ES 3.0 And Beyond Boston Fragment Shader #version 300 es precision mediump float; flat in mediump vec4 v_color; layout (location = 0) out lowp vec4 o_Color; void main() { o_Color = v_color; }