OpenSceneGraph 3.0 Beginners Guide. WGM # 52 Gustavo Rovelo
|
|
- Roger Curtis
- 6 years ago
- Views:
Transcription
1 OpenSceneGraph 3.0 Beginners Guide Chapter 6. Creating Realistic Rendering Effects WGM # 52 Gustavo Rovelo April 27th, 2012
2 2 Index OpenGL state machine in OSG Setting up different rendering attributes and modes for scene objects Inheriting rendering states in the scene graph Controlling scene lights Adding textures to geometry Drawing transparent and translucent objects Working with vertex, geometry and fragment shaders
3 3 OpenGL State Machine in OSG OpenGL state machine Configuration of the drawing system at any particular time Depth test Textures Lights Color Line width OSG encapsulates the OpenGL state machine to manage the scene graph culling and rendering traversals
4 4 OpenGL State Machine in OSG The osg::stateset class Can be applied to: Nodes or Drawableobjects node->setstateset( stateset); stateset = node->getorcreatestateset(); * It distinguish between texture and nontextures attributes and modes. setattribute(osg::stateattribute) setmode(osg::stateattribute::on/off) setattributeandmodes(osg::stateattribute, osg::stateattribute::on/off) Texture attributes and modes methods require and extra parameter to specify the texture unit, and the names have the Texture infix settextureattributeandmodes( texunit, texattribute, mode);
5 5 OpenGL State Machine in OSG Example #1 model1 = osgdb::readnodefile( "cessna.osg" ); transformation1 = new MatrixTransform(); transformation2 = new MatrixTransform(); transformation1->setmatrix( Matrix::translate( Vec3(-25.0, 0.0, 0.0) ) ); transformation1->addchild( model1.get() ); transformation2->setmatrix( Matrix::translate( Vec3( 25.0, 0.0, 0.0) ) ); transformation2->addchild( model1.get() ); //Create a rendering attribute to modify t he way the model is drawn pm = new PolygonMode(); pm->setmode( PolygonMode::FRONT_AND_BACK, PolygonMode::LINE ); //Get and attach the statesetfrom and to the node stateset = transformation1->getorcreatestateset(); stateset->setattribute( pm.get() );
6 6 Inheriting Render States The state set of a node will affect the node and it s children. A node can: Inherit, stateset->setattribute( attr, osg::stateattribute::inherit ); Override or, stateset->setattribute( attr, osg::stateattribute::override ); Protect (ignore), stateset->setattribute( attr, osg::stateattribute::protected ); Set PolygonMode to Outlined Inherit Override Outlined Inherit Set PolygonMode to Filled Protected Filled Outlined
7 7 Inheriting Render States Example #2 model1 = osgdb::readnodefile( glider.osg"); transformation1 = new MatrixTransform(); transformation2 = new MatrixTransform(); transformation1->setmatrix( Matrix::translate( Vec3(-0.5, 0.0, 0.0) )); transformation1->addchild( model1.get() ); transformation2->setmatrix( Matrix::translate( Vec3( 0.5, 0.0, 0.0) )); transformation2->addchild( model1.get() ); transformation1->getorcreatestateset()->setmode( GL_LIGHTING, StateAttribute::OFF ); transformation2->getorcreatestateset()->setmode( GL_LIGHTING, StateAttribute::OFF StateAttribute::PROTECTED ); root->getorcreatestateset()->setmode( GL_LIGHTING, StateAttribute::ON StateAttribute::OVERRIDE );
8 8 OpenGL Rendering Attributes and Modes in OSG Several classes that derives from classes that derived from StateAtribute class...\include\osg\stateattribute Type ID Class name Associatedmode Related OpenGL functions BLENDFUNC osg::blendfunc GL_BLEND glblendfunc() and glblendfunseparate() COLORMASK osg::colormask - glcolormask() DEPTH osg::depth GL_DEPTH_TEST gldepthfun(), gldepthrange(), and gldepthmask() LINEWIDTH osg::linewidth - gllinewidth() LIGHT osg::light GL_LIGHTi() i=[0,7] gllight() Used as parameter of stateset->getattribute(stateattribute::polygonmode); Null pointer if the attribute has not been set
9 9 OpenGL Rendering Attributes and Modes in OSG Several classes that derives from classes that derived from StateAtribute class...\include\osg\stateattribute Type ID Class name Associatedmode Related OpenGL functions BLENDFUNC osg::blendfunc GL_BLEND glblendfunc() and glblendfunseparate() COLORMASK osg::colormask - glcolormask() DEPTH osg::depth GL_DEPTH_TEST gldepthfun(), gldepthrange(), and gldepthmask() LINEWIDTH osg::linewidth - gllinewidth() LIGHT osg::light GL_LIGHTi() i=[0,7] gllight() The way OSG calls OpenGL modes stateset->setattributeandmodes(stateattribute::gl_lighting); stateset->getmode( GL_LIGHTING );
10 10 OpenGL Rendering Attributes and Modes in OSG Example #3 fog= new Fog(); fog->setmode( Fog::LINEAR ); fog->setstart( 500.0f ); fog->setend( f); fog->setcolor( Vec4(1.0f,1.0f,0.0f,1.0f) ); model1= osgdb::readnodefile( "lz.osg" ); model1->getorcreatestateset()->setattributeandmodes( fog.get() ); viewer.setscenedata( model1.get() );
11 11 Lights and Light Sources osg::light class 8 Light sources as OpenGL It won t automatically generate and cast shadows OSG provide different methods to handle lights properties osg::lightsource class Add lights to the scene graph It should be used as a leaf node with a single light attribute All the other nodes with GL_LIGHTimode ON will be affected by it. Can be treated as a geometry representing the physical shape of the light
12 12 Lights and Light Sources Example #4 Node* createlightsource( unsigned int num, const Vec3 trans, const Vec4 color){ ref_ptr<light> light; ref_ptr<lightsource> lightsource; ref_ptr<matrixtransform> sourcetrans; light = new Light(); light->setlightnum( num); light->setdiffuse( color ); light->setposition( Vec4(0.0f,0.0f,0.0f,1.0) ); lightsource = new LightSource(); lightsource->setlight( light ); sourcetrans = new MatrixTransform(); sourcetrans->setmatrix( Matrix::translate( trans) ); sourcetrans->addchild( lightsource.get() ); return sourcetrans.release(); } int main (int argc, char** argv){ light0 = createlightsource( 0, Vec3(-20.0f, 0.0f, 0.0f), Vec4(1.0f,1.0f,0.0f,1.0f) ); light1 = createlightsource( 1, Vec3( 0.0f,-20.0f, 0.0f), Vec4(0.0f,1.0f,1.0f,1.0f) ); root->getorcreatestateset()->setmode( GL_LIGHT0, StateAttribute::ON ); root->getorcreatestateset()->setmode( GL_LIGHT1, StateAttribute::ON ); root->addchild( light0 ); root->addchild( light1 ); }
13 13 The Image Class The osg::image class manage everything related to images. To load an image from disk use: ref_ptr<osg::image> img = osgdb::readimagefile( picture.bmp ) BMP, JPG, PNG, TIFF, etc. getpixelformat() -> GL_RGB t getdatatype()->gl_unsigned_byte s getdata() unsigned char*
14 14 Texture Mapping osg::texture class encapsulates all kinds of textures. To use texture mapping in OSG we have to: Set texture coordinates to the geometry. Normalized [0,1] Set the texture mapping unit (0 to use only one) Load the image(s) we will use as texture(s) Set the texture attribute and modes to a state set Set the state set to the geometry
15 15 Texture Mapping Example #5 quad = new Geometry(); quad->setvertexarray( vertices.get() ); quad->setnormalarray( normals.get() ); quad->setnormalbinding(geometry::bind_overall); quad->settexcoordarray( 0, texcoords.get() ); quad->addprimitiveset( new DrawArrays(GL_QUADS, 0, 4) ); texture = new Texture2D(); image = osgdb::readimagefile( "Images/lz.rgb" ); texture->setimage( image.get() ); root = new Geode(); root->adddrawable( quad.get() ); root->getorcreatestateset()->settextureattributeandmodes( 0, texture.get() );
16 16 Handling Rendering Order It s especially important when using blending options to render transparent objects. Opaque objects first Translucent objects second Opaque objects second Translucent objects fisrt setrenderinghint() method of the osg::stateset class control the rendering order or nodes and drawables, drawing opaque objects first. node->getorcreatestateset()->setrenderinghint(osg::stateset::transparent_bin);
17 17 Handling Rendering Order Example # 6 texture = new Texture2D(); image = osgdb::readimagefile( "Images/lz.rgb" ); texture->setimage( image.get() ); blendfunc = new BlendFunc(); blendfunc->setfunction( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); stateset =geode->getorcreatestateset(); stateset->settextureattributeandmodes( 0, texture.get() ); stateset->setattributeandmodes( blendfunc.get() ); stateset->setrenderinghint(stateset::transparent_bin ); root = new Group(); root->addchild( geode.get() ); root->addchild( osgdb::readnodefile( "glider.osg" ) );
18 18 Understanding Graphic Shaders OpenGL Shading Language (GLSL) allow Programmability in the rendering pipeline at the vertex and fragment level Get more realistic rendering effects, instead of using only the fixed-function states. Shadersare written in a text file like C programs. Shaderstotally replace fixed functionalities (fog, lighting, texture mapping, etc.)
19 19 Understanding Graphic Shaders You can specify only one shaderper type: Vertex Transformations to each vertex Geometry Regenerate geometry from existing vertices Fragment Color of individual pixels
20 20 Understanding Graphic Shaders OSG defines osg::shader class setshadersource(string) setshadersourcefromfile() osgdbdefines one method to read shadersources and check shadertypes according to file extensions osg::shader* frshader=osgdb::readshaderfile( source.frag ); After we load the shadersource we have to use the osg::program class to add the shadersto a state set.
21 21 Understanding Graphic Shaders There are three types of inputs and outputs in a tyipical shader: Uniforms Read-Only during shaderexecution. Vertex attributes Writable by host applications Varyings Passing data from shaderto another. Invisible to external programs osg::uniform defines a GLSL uniform variable float leght = 1.0f; osg::ref_ptr<osg::uniform> = new osg::uniform( length, length );
22 22 Understanding Graphic Shaders There should be a variable defined in one of the loaded shader sources uniform float length; Otherwise, the uniform variable will not be available. Uniforms can be of any basic type or any aggregation of types: Boolean Float Integer 2D/3D/4D vector Matrix Texture samplers
23 23 Understanding Graphic Shaders Example #7 static const char* vertsource = { "varying vec3 normal;\n "void main()\n "{\n normal = normalize(gl_normalmatrix * gl_normal);\n" gl_position = ftransform();\n "}\n" }; static const char* fragsource = { uniform vec4 color1;\n uniform vec4 color2;\n uniform vec4 color3;\n uniform vec4 color4;\n varying vec3 normal;\n void main()\n {\n float intensity = dot(vec3(gl_lightsource[0].position), normal);\n if( intensity > 0.95) gl_fragcolor = color1;\n else if(intensity > 0.5) gl_fragcolor = color2;\n else if(intensity > 0.25) gl_fragcolor = color3;\n else gl_fragcolor = color4;\n }\n" };
24 24 Understanding Graphic Shaders Example 6-8 static const char* geomsource = { "#version 120\n "#extension GL_EXT_geometry_shader4 : enable\n "uniform int segments;\n "void main()\n "{\n " float delta = 1.0 / float(segments);\n " vec4 v;\n " for( int i=0; i <= segments; i++ )\n " {\n " float t = delta * float(i);\n " float t2 = t * t;\n " float one_minus_t = t;\n«" float one_minus_t2 = one_minus_t * one_minus_t;\n " v = gl_positionin[0] * one_minus_t2 * one_minus_t +\n " gl_positionin[1] * 3.0 * t * one_minus_t2 +\n«" gl_positionin[2] * 3.0 * t2 * one_minus_t +\n«" gl_positionin[3] * t2 * t;\n " gl_position = v;\n " EmitVertex();\n " }\n " EndPrimitive();\n "}\n" };
25 25 References RiuWang and XueleiQian. OpenSceneGraph 3.0 Beginner s guide Chapter 6 Creating Realistic Rendering Effects Pages: Ed. Packt Publishing 2010
Programming with OpenGL Part 3: Shaders. Ed Angel Professor of Emeritus of Computer Science University of New Mexico
Programming with OpenGL Part 3: Shaders Ed Angel Professor of Emeritus of Computer Science University of New Mexico 1 Objectives Simple Shaders - Vertex shader - Fragment shaders Programming shaders with
More informationEECE 478. Learning Objectives. Learning Objectives. Rasterization & Scenes. Rasterization. Compositing
EECE 478 Rasterization & Scenes Rasterization Learning Objectives Be able to describe the complete graphics pipeline. Describe the process of rasterization for triangles and lines. Compositing Manipulate
More informationShader Programs. Lecture 30 Subsections 2.8.2, Robb T. Koether. Hampden-Sydney College. Wed, Nov 16, 2011
Shader Programs Lecture 30 Subsections 2.8.2, 2.8.3 Robb T. Koether Hampden-Sydney College Wed, Nov 16, 2011 Robb T. Koether (Hampden-Sydney College) Shader Programs Wed, Nov 16, 2011 1 / 43 Outline 1
More informationOpen Scene Graph Lecture Note #1
Setup OSG Open Scene Graph Lecture Note #1 448430 Spring 2009 4/6/2009 Kyoung Shin Park Multimedia Engineering Dankook University Download OSG 2.6.0 http://dis.dankook.ac.kr/lectures/msd09/osg-2.6.0.zip
More informationShader Programming. Daniel Wesslén, Stefan Seipel, Examples
Shader Programming Daniel Wesslén, dwn@hig.se Stefan Seipel, ssl@hig.se Examples 1 Per-pixel lighting Texture convolution filtering 2 Post-processing, animated procedural textures Vertex displacement mapping
More informationLecture 5 Vertex and Fragment Shaders-1. CITS3003 Graphics & Animation
Lecture 5 Vertex and Fragment Shaders-1 CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives The rendering pipeline and the shaders Data
More informationShaders. Slide credit to Prof. Zwicker
Shaders Slide credit to Prof. Zwicker 2 Today Shader programming 3 Complete model Blinn model with several light sources i diffuse specular ambient How is this implemented on the graphics processor (GPU)?
More informationIntroduction to Shaders.
Introduction to Shaders Marco Benvegnù hiforce@gmx.it www.benve.org Summer 2005 Overview Rendering pipeline Shaders concepts Shading Languages Shading Tools Effects showcase Setup of a Shader in OpenGL
More informationGLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people
GLSL Introduction Fu-Chung Huang Thanks for materials from many other people Shader Languages Currently 3 major shader languages Cg (Nvidia) HLSL (Microsoft) Derived from Cg GLSL (OpenGL) Main influences
More informationGLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people
GLSL Introduction Fu-Chung Huang Thanks for materials from many other people Programmable Shaders //per vertex inputs from main attribute aposition; attribute anormal; //outputs to frag. program varying
More informationOPENGL RENDERING PIPELINE
CPSC 314 03 SHADERS, OPENGL, & JS UGRAD.CS.UBC.CA/~CS314 Textbook: Appendix A* (helpful, but different version of OpenGL) Alla Sheffer Sep 2016 OPENGL RENDERING PIPELINE 1 OPENGL RENDERING PIPELINE Javascript
More informationCPSC 436D Video Game Programming
CPSC 436D Video Game Programming OpenGL/Shaders Opengl RENDERING PIPELINE Copyright: Alla Sheffer 1 Opengl RENDERING PIPELINE C/C++ OpenGL GLSL (automatic) (automatic) GLSL (automatic) opengl Low-level
More informationShadows. Prof. George Wolberg Dept. of Computer Science City College of New York
Shadows Prof. George Wolberg Dept. of Computer Science City College of New York Objectives Introduce Shadow Algorithms Expand to projective textures 2 Flashlight in the Eye Graphics When do we not see
More informationWebGL and GLSL Basics. CS559 Fall 2015 Lecture 10 October 6, 2015
WebGL and GLSL Basics CS559 Fall 2015 Lecture 10 October 6, 2015 Last time Hardware Rasterization For each point: Compute barycentric coords Decide if in or out.7,.7, -.4 1.1, 0, -.1.9,.05,.05.33,.33,.33
More informationSign up for crits! Announcments
Sign up for crits! Announcments Reading for Next Week FvD 16.1-16.3 local lighting models GL 5 lighting GL 9 (skim) texture mapping Modern Game Techniques CS248 Lecture Nov 13 Andrew Adams Overview The
More informationOverview. Java and OpenSceneGraph. Introduction. OpenSceneGraph. Introduction Scene graph structure
Overview Java and OpenSceneGraph Introduction Scene graph structure Node types Example Vectors, Matrices and Transformations Events Picking Introduction A scene graph system Used for Visual simulations,
More informationFog example. Fog is atmospheric effect. Better realism, helps determine distances
Fog example Fog is atmospheric effect Better realism, helps determine distances Fog Fog was part of OpenGL fixed function pipeline Programming fixed function fog Parameters: Choose fog color, fog model
More informationToday s Agenda. Basic design of a graphics system. Introduction to OpenGL
Today s Agenda Basic design of a graphics system Introduction to OpenGL Image Compositing Compositing one image over another is most common choice can think of each image drawn on a transparent plastic
More informationSupplement to Lecture 22
Supplement to Lecture 22 Programmable GPUs Programmable Pipelines Introduce programmable pipelines - Vertex shaders - Fragment shaders Introduce shading languages - Needed to describe shaders - RenderMan
More informationProgrammable GPUs. Real Time Graphics 11/13/2013. Nalu 2004 (NVIDIA Corporation) GeForce 6. Virtua Fighter 1995 (SEGA Corporation) NV1
Programmable GPUs Real Time Graphics Virtua Fighter 1995 (SEGA Corporation) NV1 Dead or Alive 3 2001 (Tecmo Corporation) Xbox (NV2A) Nalu 2004 (NVIDIA Corporation) GeForce 6 Human Head 2006 (NVIDIA Corporation)
More informationLecture 31 Sections 9.1, 9.2, 9.3. Mon, Nov 23, 2009
Lecture 31 Sections 9.1, 9.2, 9.3 Hampden-Sydney College Mon, Nov 23, 2009 Outline 1 2 3 4 5 Outline 1 2 3 4 5 The extension wrangler (glew) will check to see which extensions are supported by the installed
More informationC P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev
C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE UGRAD.CS.UBC.C A/~CS314 Mikhail Bessmeltsev 1 WHAT IS RENDERING? Generating image from a 3D scene 2 WHAT IS RENDERING? Generating image
More informationProgrammable Graphics Hardware
CSCI 480 Computer Graphics Lecture 14 Programmable Graphics Hardware [Ch. 9] March 2, 2011 Jernej Barbic University of Southern California OpenGL Extensions Shading Languages Vertex Program Fragment Program
More informationIntroduction to Computer Graphics. Hardware Acceleration Review
Introduction to Computer Graphics Hardware Acceleration Review OpenGL Project Setup Create a command-line style project in Xcode 4 Select the project file and click Build Phases tab Add OpenGL.framework
More informationCSE 167: Introduction to Computer Graphics Lecture #7: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016
CSE 167: Introduction to Computer Graphics Lecture #7: GLSL Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016 Announcements Project 2 due Friday 4/22 at 2pm Midterm #1 on
More informationOpenGL refresher. Advanced Computer Graphics 2012
Advanced Computer Graphics 2012 What you will see today Outline General OpenGL introduction Setting up: GLUT and GLEW Elementary rendering Transformations in OpenGL Texture mapping Programmable shading
More informationShader Programming 1. Examples. Vertex displacement mapping. Daniel Wesslén 1. Post-processing, animated procedural textures
Shader Programming 1 Examples Daniel Wesslén, dwn@hig.se Per-pixel lighting Texture convolution filtering Post-processing, animated procedural textures Vertex displacement mapping Daniel Wesslén 1 Fragment
More informationWebGL and GLSL Basics. CS559 Fall 2016 Lecture 14 October
WebGL and GLSL Basics CS559 Fall 2016 Lecture 14 October 24 2016 Review Hardware Rasterization For each point: Compute barycentric coords Decide if in or out.7,.7, -.4 1.1, 0, -.1.9,.05,.05.33,.33,.33
More informationGLSL 1: Basics. J.Tumblin-Modified SLIDES from:
GLSL 1: Basics J.Tumblin-Modified SLIDES from: Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New Mexico and
More informationIntroduction to Shaders for Visualization. The Basic Computer Graphics Pipeline
Introduction to Shaders for Visualization Mike Bailey The Basic Computer Graphics Pipeline Model Transform View Transform Per-vertex Lighting Projection Transform Homogeneous Division Viewport Transform
More information12.2 Programmable Graphics Hardware
Fall 2018 CSCI 420: Computer Graphics 12.2 Programmable Graphics Hardware Kyle Morgenroth http://cs420.hao-li.com 1 Introduction Recent major advance in real time graphics is the programmable pipeline:
More informationContent. Building Geometry Appearance Lights Model Loaders
Content Building Geometry Appearance Lights Model Loaders Building Geometry A Geometry represents a 3D object: Mesh: The form or structure of a shape (What to draw) Material: The color, transparency, and
More informationCS452/552; EE465/505. Image Processing Frame Buffer Objects
CS452/552; EE465/505 Image Processing Frame Buffer Objects 3-12 15 Outline! Image Processing: Examples! Render to Texture Read: Angel, Chapter 7, 7.10-7.13 Lab3 new due date: Friday, Mar. 13 th Project#1
More informationInformation Coding / Computer Graphics, ISY, LiTH GLSL. OpenGL Shading Language. Language with syntax similar to C
GLSL OpenGL Shading Language Language with syntax similar to C Syntax somewhere between C och C++ No classes. Straight ans simple code. Remarkably understandable and obvious! Avoids most of the bad things
More informationTechnical Game Development II. Reference: Rost, OpenGL Shading Language, 2nd Ed., AW, 2006 The Orange Book Also take CS 4731 Computer Graphics
Shader Programming Technical Game Development II Professor Charles Rich Computer Science Department rich@wpi.edu Reference: Rost, OpenGL Shading Language, 2nd Ed., AW, 2006 The Orange Book Also take CS
More informationProgramming with OpenGL Shaders I. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico
Programming with OpenGL Shaders I Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico 0 Objectives Shader Basics Simple Shaders Vertex shader Fragment shaders 1 Vertex
More informationTechnical Game Development II. Reference: Rost, OpenGL Shading Language, 2nd Ed., AW, 2006 The Orange Book Also take CS 4731 Computer Graphics
Shader Programming Technical Game Development II Professor Charles Rich Computer Science Department rich@wpi.edu Reference: Rost, OpenGL Shading Language, 2nd Ed., AW, 2006 The Orange Book Also take CS
More informationReal-Time Rendering (Echtzeitgraphik) Michael Wimmer
Real-Time Rendering (Echtzeitgraphik) Michael Wimmer wimmer@cg.tuwien.ac.at Walking down the graphics pipeline Application Geometry Rasterizer What for? Understanding the rendering pipeline is the key
More informationThe Transition from RenderMan to the OpenGL Shading Language (GLSL)
1 The Transition from RenderMan to the OpenGL Shading Language (GLSL) Mike Bailey mjb@cs.oregonstate.edu This work is licensed under a Creative Commons Attribution-NonCommercial- NoDerivatives 4.0 International
More informationSHADER PROGRAMMING. Based on Jian Huang s lecture on Shader Programming
SHADER PROGRAMMING Based on Jian Huang s lecture on Shader Programming What OpenGL 15 years ago could do http://www.neilturner.me.uk/shots/opengl-big.jpg What OpenGL can do now What s Changed? 15 years
More informationOUTLINE. Learn the basic design of a graphics system Introduce pipeline architecture Examine software components for a graphics system
GRAPHICS PIPELINE 1 OUTLINE Learn the basic design of a graphics system Introduce pipeline architecture Examine software components for a graphics system 2 IMAGE FORMATION REVISITED Can we mimic the synthetic
More informationLecture 19: OpenGL Texture Mapping. CITS3003 Graphics & Animation
Lecture 19: OpenGL Texture Mapping CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Introduce the OpenGL texture functions and options
More informationGLSL Applications: 2 of 2
Administrivia GLSL Applications: 2 of 2 Patrick Cozzi University of Pennsylvania CIS 565 - Spring 2011 Assignment 2 due today 11:59pm on Blackboard Assignment 3 handed out today Due Wednesday, 02/09 at
More informationCSE 4431/ M Advanced Topics in 3D Computer Graphics. TA: Margarita Vinnikov
CSE 4431/5331.03M Advanced Topics in 3D Computer Graphics TA: Margarita Vinnikov mvinni@cse.yorku.ca The OpenGL 4.x pipeline 2 new Programmable stages Tessellation Control Shader(GL_TESS_CONTROL_SHADER)
More informationGLSL Geometry Shaders
GLSL Geometry Shaders 1 This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License Mike Bailey mjb@cs.oregonstate.edu geometry_shaders.pptx Here s
More informationLecture 17: Shading in OpenGL. CITS3003 Graphics & Animation
Lecture 17: Shading in OpenGL CITS3003 Graphics & Animation E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012 Objectives Introduce the OpenGL shading methods - per vertex shading
More informationMobile Application Programing: Android. OpenGL Operation
Mobile Application Programing: Android OpenGL Operation Activities Apps are composed of activities Activities are self-contained tasks made up of one screen-full of information Activities start one another
More informationThe Application Stage. The Game Loop, Resource Management and Renderer Design
1 The Application Stage The Game Loop, Resource Management and Renderer Design Application Stage Responsibilities 2 Set up the rendering pipeline Resource Management 3D meshes Textures etc. Prepare data
More informationOSG: MEMORY MANAGEMENT. Class 2
OSG: MEMORY MANAGEMENT AND GEOMETRY CLASSES Class 2 MEMORY MANAGEMENT Memory Management Memory Management Memory Management osg::referenced osg::ref_ptr The Referenced Class Main components Protected
More informationSUMMARY. CS380: Introduction to Computer Graphics Texture Mapping Chapter 15. Min H. Kim KAIST School of Computing 18/05/03.
CS380: Introduction to Computer Graphics Texture Mapping Chapter 15 Min H. Kim KAIST School of Computing Materials SUMMARY 2 1 Light blob from PVC plastic Recall: Given any vector w (not necessarily of
More informationRSX Best Practices. Mark Cerny, Cerny Games David Simpson, Naughty Dog Jon Olick, Naughty Dog
RSX Best Practices Mark Cerny, Cerny Games David Simpson, Naughty Dog Jon Olick, Naughty Dog RSX Best Practices About libgcm Using the SPUs with the RSX Brief overview of GCM Replay December 7 th, 2004
More informationCMSC427 Fall 2017 OpenGL Notes A: Starting with JOGL and OpenGL Objectives of notes Readings Computer Graphics Programming in OpenGL with Java
CMSC427 Fall 2017 OpenGL Notes A: Starting with JOGL and OpenGL Objectives of notes Show how to program full OpenGL in JOGL Start on shader programing Readings Computer Graphics Programming in OpenGL with
More informationCS4621/5621 Fall Computer Graphics Practicum Intro to OpenGL/GLSL
CS4621/5621 Fall 2015 Computer Graphics Practicum Intro to OpenGL/GLSL Professor: Kavita Bala Instructor: Nicolas Savva with slides from Balazs Kovacs, Eston Schweickart, Daniel Schroeder, Jiang Huang
More informationOpenGL shaders and programming models that provide object persistence
OpenGL shaders and programming models that provide object persistence COSC342 Lecture 22 19 May 2016 OpenGL shaders We discussed forms of local illumination in the ray tracing lectures. We also saw that
More informationCS559 Computer Graphics Fall 2015
CS559 Computer Graphics Fall 2015 Practice Midterm Exam Time: 2 hrs 1. [XX Y Y % = ZZ%] MULTIPLE CHOICE SECTION. Circle or underline the correct answer (or answers). You do not need to provide a justification
More informationTutorial 4: Depth and Transparency
Tutorial 4: Depth and Transparency Summary In this tutorial, you are going to learn about how OpenGL determines which objects are in front of others in a scene - it s not as easy at it seems! Alpha blending
More informationAdaptive Point Cloud Rendering
1 Adaptive Point Cloud Rendering Project Plan Final Group: May13-11 Christopher Jeffers Eric Jensen Joel Rausch Client: Siemens PLM Software Client Contact: Michael Carter Adviser: Simanta Mitra 4/29/13
More informationTutorial 7: Scene Management
Tutorial 7: Scene Management Summary Using a scene graph gets you well on your way to the high-performance rendering of lots of objects. However, we still need to sort out the issue of of transparent objects
More informationPixels and Buffers. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science
Pixels and Buffers CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science 1 Objectives Introduce additional OpenGL buffers Learn to read from / write to buffers Introduce
More informationDeferred Rendering Due: Wednesday November 15 at 10pm
CMSC 23700 Autumn 2017 Introduction to Computer Graphics Project 4 November 2, 2017 Deferred Rendering Due: Wednesday November 15 at 10pm 1 Summary This assignment uses the same application architecture
More informationCOMP371 COMPUTER GRAPHICS
COMP371 COMPUTER GRAPHICS SESSION 12 PROGRAMMABLE SHADERS Announcement Programming Assignment #2 deadline next week: Session #7 Review of project proposals 2 Lecture Overview GPU programming 3 GPU Pipeline
More informationCS452/552; EE465/505. Texture Mapping in WebGL
CS452/552; EE465/505 Texture Mapping in WebGL 2-26 15 Outline! Texture Mapping in WebGL Read: Angel, Chapter 7, 7.3-7.5 LearningWebGL lesson 5: http://learningwebgl.com/blog/?p=507 Lab3 due: Monday, 3/2
More informationBlis: Better Language for Image Stuff Project Proposal Programming Languages and Translators, Spring 2017
Blis: Better Language for Image Stuff Project Proposal Programming Languages and Translators, Spring 2017 Abbott, Connor (cwa2112) Pan, Wendy (wp2213) Qinami, Klint (kq2129) Vaccaro, Jason (jhv2111) [System
More informationToday. Rendering - III. Outline. Texturing: The 10,000m View. Texture Coordinates. Specifying Texture Coordinates in GL
Today Rendering - III CS148, Summer 2010 Graphics Pipeline and Programmable Shaders Artist Workflow Siddhartha Chaudhuri 1 2 Outline Texturing: The 10,000m View Intro to textures The fixed-function graphics
More informationDiscrete Techniques. 11 th Week, Define a buffer by its spatial resolution (n m) and its depth (or precision) k, the number of
Discrete Techniques 11 th Week, 2010 Buffer Define a buffer by its spatial resolution (n m) and its depth (or precision) k, the number of bits/pixel Pixel OpenGL Frame Buffer OpenGL Buffers Color buffers
More informationGLSL v1.20. Scott MacHaffie Schrödinger, Inc.
1 GLSL v1.20 Scott MacHaffie Schrödinger, Inc. http://www.schrodinger.com Table of Contents Introduction...2 Example 01: Trivial shader...2 Syntax...3 Types of variables...3 Example 02: Materials vertex
More informationUnderstanding M3G 2.0 and its Effect on Producing Exceptional 3D Java-Based Graphics. Sean Ellis Consultant Graphics Engineer ARM, Maidenhead
Understanding M3G 2.0 and its Effect on Producing Exceptional 3D Java-Based Graphics Sean Ellis Consultant Graphics Engineer ARM, Maidenhead Introduction M3G 1.x Recap ARM M3G Integration M3G 2.0 Update
More informationTechnical Game Development II. Reference: Rost, OpenGL Shading Language, 2nd Ed., AW, 2006 The Orange Book IMGD 4000 (D 10) 1
Shader Programming Technical Game Development II Professor Charles Rich Computer Science Department rich@wpi.edu Reference: Rost, OpenGL Shading Language, 2nd Ed., AW, 2006 The Orange Book IMGD 4000 (D
More informationOUTLINE. Implementing Texturing What Can Go Wrong and How to Fix It Mipmapping Filtering Perspective Correction
TEXTURE MAPPING 1 OUTLINE Implementing Texturing What Can Go Wrong and How to Fix It Mipmapping Filtering Perspective Correction 2 BASIC STRAGEGY Three steps to applying a texture 1. specify the texture
More informationCSE 167: Lecture #8: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012
CSE 167: Introduction to Computer Graphics Lecture #8: GLSL Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012 Announcements Homework project #4 due Friday, November 2 nd Introduction:
More informationExercise 1 Introduction to OpenGL
Exercise 1 Introduction to OpenGL What we are going to do OpenGL Glut Small Example using OpenGl and Glut Alexandra Junghans 2 What is OpenGL? OpenGL Two Parts most widely used and supported graphics API
More informationTSBK03 Screen-Space Ambient Occlusion
TSBK03 Screen-Space Ambient Occlusion Joakim Gebart, Jimmy Liikala December 15, 2013 Contents 1 Abstract 1 2 History 2 2.1 Crysis method..................................... 2 3 Chosen method 2 3.1 Algorithm
More informationComp 410/510 Computer Graphics Spring Programming with OpenGL Part 3: Shaders
Comp 410/510 Computer Graphics Spring 2018 Programming with OpenGL Part 3: Shaders Objectives Basic shaders - Vertex shader - Fragment shader Programming shaders with GLSL Finish first program void init(void)
More informationComputer Graphics Coursework 1
Computer Graphics Coursework 1 Deadline Deadline: 4pm, 24/10/2016 4pm 23/10/2015 Outline The aim of the coursework is to modify the vertex and fragment shaders in the provided OpenGL framework to implement
More informationThe Graphics Pipeline
The Graphics Pipeline Lecture 2 Robb T. Koether Hampden-Sydney College Fri, Aug 28, 2015 Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Fri, Aug 28, 2015 1 / 19 Outline 1 Vertices 2 The
More informationComputergraphics Exercise 15/ Shading & Texturing
Computergraphics Exercise 15/16 3. Shading & Texturing Jakob Wagner for internal use only Shaders Vertex Specification define vertex format & data in model space Vertex Processing transform to clip space
More informationProgramming with OpenGL Shaders I. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico
Programming with OpenGL Shaders I Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico Objectives Shader Programming Basics Simple Shaders Vertex shader Fragment shaders
More informationOpenGL ES 2.0 Performance Guidelines for the Tegra Series
OpenGL ES 2.0 Performance Guidelines for the Tegra Series Version 0.2 December 2012-1 - Contents INTRODUCTION... 3 BASIC PERFORMANCE NOTES... 3 MAXIMIZING THE GPU AND CPU/GPU PARALLELISM... 4 Avoid Redundant
More informationProgrammable Graphics Hardware
Programmable Graphics Hardware Outline 2/ 49 A brief Introduction into Programmable Graphics Hardware Hardware Graphics Pipeline Shading Languages Tools GPGPU Resources Hardware Graphics Pipeline 3/ 49
More informationObjectives Shading in OpenGL. Front and Back Faces. OpenGL shading. Introduce the OpenGL shading methods. Discuss polygonal shading
Objectives Shading in OpenGL Introduce the OpenGL shading methods - per vertex shading vs per fragment shading - Where to carry out Discuss polygonal shading - Flat - Smooth - Gouraud CITS3003 Graphics
More informationShaders CSCI 4239/5239 Advanced Computer Graphics Spring 2014
Shaders CSCI 4239/5239 Advanced Computer Graphics Spring 2014 What is a Shader? Wikipedia: A shader is a computer program used in 3D computer graphics to determine the final surface properties of an object
More informationChapter 3. Texture mapping. Learning Goals: Assignment Lab 3: Implement a single program, which fulfills the requirements:
Chapter 3 Texture mapping Learning Goals: 1. To understand texture mapping mechanisms in VRT 2. To import external textures and to create new textures 3. To manipulate and interact with textures 4. To
More informationShading System Immediate-Mode API v2.2
Shading System Immediate-Mode API v2.2 William R. Mark and C. Philipp Schloter August 29, 2001 1 Introduction This document describes modifications to the OpenGL API to support the immediate-mode use of
More informationComputer Graphics. Lecture 02 Graphics Pipeline. Edirlei Soares de Lima.
Computer Graphics Lecture 02 Graphics Pipeline Edirlei Soares de Lima What is the graphics pipeline? The Graphics Pipeline is a special software/hardware subsystem
More informationCSE 167: Introduction to Computer Graphics Lecture #13: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015
CSE 167: Introduction to Computer Graphics Lecture #13: GLSL Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015 Announcements Project 6 due Friday Next Thursday: Midterm #2
More informationCSE 167: Introduction to Computer Graphics Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015
CSE 167: Introduction to Computer Graphics Lecture #5: Rasterization Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015 Announcements Project 2 due tomorrow at 2pm Grading window
More informationCS4621/5621 Fall Basics of OpenGL/GLSL Textures Basics
CS4621/5621 Fall 2015 Basics of OpenGL/GLSL Textures Basics Professor: Kavita Bala Instructor: Nicolas Savva with slides from Balazs Kovacs, Eston Schweickart, Daniel Schroeder, Jiang Huang and Pramook
More informationCS 380 Introduction to Computer Graphics. LAB (1) : OpenGL Tutorial Reference : Foundations of 3D Computer Graphics, Steven J.
CS 380 Introduction to Computer Graphics LAB (1) : OpenGL Tutorial 2018. 03. 05 Reference : Foundations of 3D Computer Graphics, Steven J. Gortler Goals Understand OpenGL pipeline Practice basic OpenGL
More informationThe Graphics Pipeline
The Graphics Pipeline Lecture 2 Robb T. Koether Hampden-Sydney College Wed, Aug 23, 2017 Robb T. Koether (Hampden-Sydney College) The Graphics Pipeline Wed, Aug 23, 2017 1 / 19 Outline 1 Vertices 2 The
More informationCS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside
CS230 : Computer Graphics Lecture 4 Tamar Shinar Computer Science & Engineering UC Riverside Shadows Shadows for each pixel do compute viewing ray if ( ray hits an object with t in [0, inf] ) then compute
More informationComputer Graphics. Shadows
Computer Graphics Lecture 10 Shadows Taku Komura Today Shadows Overview Projective shadows Shadow texture Shadow volume Shadow map Soft shadows Why Shadows? Shadows tell us about the relative locations
More informationMobile Application Programing: Android. OpenGL Operation
Mobile Application Programing: Android OpenGL Operation Activities Apps are composed of activities Activities are self-contained tasks made up of one screen-full of information Activities start one another
More informationLecture 09: Shaders (Part 1)
Lecture 09: Shaders (Part 1) CSE 40166 Computer Graphics Peter Bui University of Notre Dame, IN, USA November 9, 2010 OpenGL Rendering Pipeline OpenGL Rendering Pipeline (Pseudo-Code) 1 f o r gl_vertex
More informationCS 432 Interactive Computer Graphics
CS 432 Interactive Computer Graphics Lecture 2 Part 2 Introduction to Shaders Matt Burlick - Drexel University - CS 432 1 Shaders To understand shaders, let s look at the graphics pipeline again The job
More informationIntroduction to Computer Graphics with WebGL
1 Introduction to Computer Graphics with WebGL Ed Angel Lighting in WebGL WebGL lighting Application must specify - Normals - Material properties - Lights State-based shading functions have been deprecated
More informationDave Shreiner, ARM March 2009
4 th Annual Dave Shreiner, ARM March 2009 Copyright Khronos Group, 2009 - Page 1 Motivation - What s OpenGL ES, and what can it do for me? Overview - Lingo decoder - Overview of the OpenGL ES Pipeline
More informationSome advantages come from the limited environment! No classes. Stranight ans simple code. Remarkably. Avoids most of the bad things with C/C++.
GLSL OpenGL Shading Language Language with syntax similar to C Syntax somewhere between C och C++ No classes. Stranight ans simple code. Remarkably understandable and obvious! Avoids most of the bad things
More informationProgramming shaders & GPUs Christian Miller CS Fall 2011
Programming shaders & GPUs Christian Miller CS 354 - Fall 2011 Fixed-function vs. programmable Up until 2001, graphics cards implemented the whole pipeline for you Fixed functionality but configurable
More informationOpenGL pipeline Evolution and OpenGL Shading Language (GLSL) Part 2/3 Vertex and Fragment Shaders
OpenGL pipeline Evolution and OpenGL Shading Language (GLSL) Part 2/3 Vertex and Fragment Shaders Prateek Shrivastava CS12S008 shrvstv@cse.iitm.ac.in 1 GLSL Data types Scalar types: float, int, bool Vector
More informationReal-time Graphics 6. Reflections, Refractions
6. Reflections, Refractions Blending Simulating transparent materials Alpha value, RGBA model Using alpha test fragment alpha value is tested against given constant Using blending of colors fragment color
More information