SlideShare une entreprise Scribd logo
1  sur  63
Télécharger pour lire hors ligne
GLSL Shading with
OpenSceneGraph

               Mike Weiblen
               July 31, 2005
               Los Angeles




                       Rev B
                               1
Summary of this talk
   Overview of GLSL pipeline & syntax
   OSG support for GLSL
   Tips, Tricks, Gotchas, and Tools
   Demos

   What we’re not covering
          Our focus will be the OSG API, not OpenGL API
          Not lots of detail on the GLSL language itself




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005         2
Our dependencies
   OpenGL 2.0
   OpenGL Shading Language 1.10 rev 59
          Specs on opengl.org and CDROM
   OpenSceneGraph 0.9.9
          Note: GLSL support continues to evolve in CVS




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005        3
GLSL / OSG timeline
   Fall 2001: 3Dlabs “GL2.0” whitepapers,
   shading language is the centerpiece
   July 2003: ARB approves GL1.5, GLSL as
   ARB extension
   Fall 2003: osgGL2 Nodekit
   Sep 2004: ARB approves GL2.0, GLSL in
   the core.
   Spring 2005: 2nd generation GLSL support
   integrated into OSG core
          Supports both OpenGL 2.0 and 1.5 extensions


Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005      4
Overview of GLSL




                   5
The OpenGL 2.0 Pipeline




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   6
GLSL pipeline architecture
   GLSL exposes programmability at two
   points in the OpenGL 2.0 pipeline
          Vertex processor
          Fragment processor


   Compiled code to run on a particular
   processor is a glShader
   A linked executable unit to be activated on
   the pipeline is a glProgram



Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   7
GLSL compilation model
   Similar to familiar C build model
   glShader = “object file”
          Contains shader source code
          Compiled to become an “.obj file”
          Must be recompiled when source changes
   glProgram = “executable file”
          Contains a list of shaders
          Linked to become an “.exe file”
          Must be relinked when set of shaders changes

   As with C, a glShader “.obj” can be
   shared across multiple glPrograms “.exe”
Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005       8
Vertex Processor Overview
                                 Standard
                                  OpenGL                 Generic
                                 attributes             attributes
                                        gl_color        0, 1, 2, …
                                       gl_normal
                                          etc.




                                             Vertex                               User-defined uniforms:
                                                                                epsilon, myLightPos, surfColor, etc.

Texture Maps                           Processor                                      Built-in uniforms:
                                                                                gl_FogColor, gl_ModelViewMatrix, etc.




                  Standard                 Special User-defined
                  Varying                 Variables  Varying
                 gl_FrontColor             gl_Position              normal
                 gl_BackColor             gl_ClipVertex            refraction
                      etc.                gl_PointSize                etc.

  Copyright © 2005, 3Dlabs, Inc. Ltd               July 31, 2005                                                       9
Fragment Processor Overview
                 Standard                   Special User-defined
                 Varying                   Variables  Varying
                 gl_Color                 gl_FragCoord            normal
            gl_SecondaryColor             gl_FrontFacing         refraction
                    etc.                                            etc.




                                           Fragment                             User-defined uniforms:
                                                                              epsilon, myLightPos, surfColor, etc.

Texture Maps                            Processor                                   Built-in uniforms:
                                                                              gl_FogColor, gl_ModelViewMatrix, etc.




                                          Special
                                         Variables
                                         gl_FragColor
                                         gl_FragDepth
                                        gl_FragData[n]

   Copyright © 2005, 3Dlabs, Inc. Ltd            July 31, 2005                                                       10
GLSL language design
   Based on syntax of ANSI C
   Includes preprocessor
   Additions for graphics functionality
   Additions from C++
   Some refactoring for cleaner design
   Designed for parallelization on SIMD array




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   11
Language enhanced for graphics
   Added Vector and Matrix types
   Added Sampler type for textures
   Qualifiers: attribute, uniform, varying
   Built-in variables to access GL state
   Built-in functions
   Vector component notation (swizzling)
   discard keyword to cease fragment
   processing



Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   12
Additions from C++
   Function overloading
   Variables declared when needed
   struct definition performs typedef
   bool datatype




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   13
Differences from C/C++
   No automatic type conversion
   Constructor notation rather than type cast
          int x = int(5.0);
   Function parameters passed by value-
   return
   No pointers or strings




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   14
GLSL compiler
   The GLSL compiler is in the GL driver and
   part of the core OpenGL API
   No external compiler tools required.
   So the compiler is always available at
   runtime
          Compile shaders whenever convenient
   Tight integration allows every vendor to
   exploit their architecture for best possible
   performance



Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   15
Comparing architectures

                        Cg                             GLSL
                      Cg Code
                      Cg Code                          GLSL Code
                                                       GLSL Code


                    Cg Compiler
                    Cg Compiler


                 Intermediate Lang
                  Intermediate Lang          Too
                   (e.g. ARB vp/fp)
                    (e.g. ARB vp/fp)         far
                                            apart

                      IL Translator
                       IL Translator
                                                       Compiler
                                                       Compiler
                        Driver                                       Tightly
                        Driver                           Driver
                                                         Driver      coupled
                   Graphics HW
                   Graphics HW                         Graphics HW
                                                       Graphics HW




Copyright © 2005, 3Dlabs, Inc. Ltd     July 31, 2005                           16
GLSL datatypes
   Scalars: float, int, bool
   Vectors: float, int, bool
   Matrices: float
   Samplers
   Arrays
   Structs

   Note
          int and bool types are semantic, not expected to
          be supported natively
          int at least as 16 bits plus sign bit
Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005           17
GLSL datatype qualifiers
   uniform
          Relatively constant data from app or OpenGL
          Input to both vertex and fragment shaders
   attribute
          Per-vertex data from app or OpenGL
          Input to vertex shader only
   varying
          Perspective-correct interpolated value
          Output from vertex, input to fragment
   const
   in, out, inout                             (for function parameters)

Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005                        18
OpenGL state tracking
   Common OpenGL state is available to
   GLSL via built-in variables
          Built-in variables do not need declaration
          All begin with reserved prefix “gl_”
          Includes uniforms, attributes, and varyings
          Makes it easier to interface w/ legacy app code


   However, recommend just defining your
   own variables for semantic clarity; resist
   temptation to overload built-ins
          FYI OpenGL/ES will have no or few built-ins

Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005          19
uniform variables
   Input to vertex and fragment shaders
   Values from OpenGL or app
          e.g.: gl_ModelViewProjectionMatrix
   Changes relatively infrequently
          Typically constant over several primitives
   Queriable limit on number of floats
   App sets values with glUniform*() API




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005     20
attribute variables
   Input to vertex shader only
   Values from OpenGL or app
          e.g.: gl_Color, gl_Normal
   Can change per-vertex
          But doesn’t have to
   Queriable limit on the # of vec4 slots
          Scalars/vectors take a slot
          Matrices take a slot per column
   Apps sends with per-vertex API or vertex
   arrays

Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   21
varying variables
   Output from vertex, input to fragment
   Name & type must match across shaders
   Values from vertex stage are perspective-
   corrected, interpolated, sent to fragment
   stage
   Queriable limit on number of floats
   Usually defined by GLSL code
          although GLSL defines some built-ins; e.g.:
          gl_FrontColor (necessary when combining GLSL
          with fixed-functionality)


Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005       22
Defining variables in GLSL
   Uniform, varying, attribute must be global
   to a glShader
   Over-declaring variables in GLSL code
   doesn’t cost
   Only those variables actually used in the
   code (the “active” variables) consume
   resources
   After linking, the app queries uniforms
   and attributes from glProgram
   Runtime introspection; useful e.g. for
   building a GUI on the fly
Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   23
Texture access
   GLSL supports texture access in both
   vertex and fragment stages
   However, some hardware may not yet
   support texture access in vertex
          Vertex texturing is available when
          GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS > 0
   Mipmap LOD is handled differently
   between Vertex and Fragment stages




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   24
Shader Configurations
   May have more than 1 glShader per stage
   attached to a glProgram
   But there must be exactly one main() per
   stage

   Useful for a library of shared GLSL code
   to be reused across several glPrograms




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   25
Program Configurations
   GLSL permits mixing a fixed-functionality
   stage with a programmable stage
          Prog Vertex + Prog Fragment
          Prog Vertex + FF Fragment
          FF Vertex + Prog Fragment


   GLSL Built-in varyings are key when
   mixing programmable stages w/ FF




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   26
GLSL Versioning & Extensions
   #version min_version_number
          Default is “#version 110”
          Good idea to always declare expected version
   #extension name : behavior
          Default is “#extension all : disable”


   Extension names/capabilies defined in
   usual GL extensions specifications
   Special name “all” indicates all
   extensions supported by a compiler
   Details in GLSL 1.10 spec pp11-12
Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005       27
Using GLSL extensions
   Recommended approach


      #ifdef ARB_texture_rectangle
      #extension ARB_texture_rectangle : require
      #endif

      uniform sampler2DRect mysampler;




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   28
GLSL Future
   Expect GLSL to evolve
   Possible new language features
          More built-in functions, datatypes
          Interfaces
          Shader trees
   Possible new programmable stages in
   pipeline
          Geometry
          Blending


   Use #version and #extension
Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   29
OSG support for
    GLSL




                  30
OSG GLSL design goals
   Continue OSG’s straightforward mapping
   of classes to the underlying GL concepts
   Leverage OSG’s state stack to apply GLSL
   state with proper scoping
          App specifies where/what GLSL will do.
          OSG determines when/how to apply, restoring to
          previous state afterwards.
   Let OSG deal with the tedious GL stuff
          Management of contexts, constructors, indices,
          compile/link, etc.



Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005         31
Mapping GL API to OSG API

   glShader object -> osg::Shader
   glProgram object -> osg::Program
   glUniform*() -> osg::Uniform




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   32
OSG GLSL benefits over GL
   Decouples shaders from GL contexts
   Handles multiple instancing when multiple
   GL contexts
   osg::Uniform values correctly applied via
   OSG’s state update mechanism at the
   appropriate time
   Compilation and linking automatically
   handled when osg::Shader/osg::Program
   are dirtied by modification



Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   33
osg::Shader
   Derived from osg::Object
   Stores the shader’s source code text and
   manages its compilation
   Attach osg::Shader to osg::Program
   osg::Shader be attached to more than one
   osg::Program
   More than one osg::Shader may be
   attached to an osg::Program
   Encapsulates per-context glShaders



Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   34
osg::Shader API subset
   Shader Type
          VERTEX or FRAGMENT
   Sourcecode text management
          setShaderSource() / getShaderSource()
          loadShaderSourceFromFile()
          readShaderFile()
   Queries
          getType()
          getGlShaderInfoLog()




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   35
osg::Program
   Derived from osg::StateAttribute
   Defines a set of osg::Shaders, manages
   their linkage, and activates for rendering
   osg::Programs may be attached anywhere
   in the scenegraph
   An “empty” osg::Program (i.e.: no
   attached osg::Shaders) indicates fixed-
   functionality
   Automatically performs relink if attached
   osg::Shaders are modified
   Encapsulates per-context glPrograms
Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   36
osg::Program API subset
   Shader management
          addShader()
          removeShader()
          getNumShaders()
          getShader()
   Attribute binding management
          addBindAttribLocation()
          removeBindAttribLocation()
          getAttribBindingList()
   Queries
          getActiveUniforms()
          getActiveAttribs()
          getGlProgramInfoLog()
Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   37
osg::Uniform
   Derived from osg::Object
   Attaches to osg::StateSet
   May be attached anywhere in the
   scenegraph, not just near osg::Program
          e.g.: set default values at root of scenegraph
   Their effect inherits/overrides through the
   scenegraph, like osg::StateAttributes
   OSG handles the uniform index
   management automatically



Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005         38
osg::Uniform API subset
   Uniform Types
          All defined GLSL types (float, vec, mat, etc)
   Value management
          Many convenient constructors
          Many get()/set() methods
   Callback support
          setUpdateCallback() / getUpdateCallback()
          setEventCallback() / getEventCallback()




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005        39
Simple source example
     Putting it all together…

osg::Program* pgm = new osg::Program;
pgm->setName( "simple" );
pgm->addShader(new osg::Shader( osg::Shader::VERTEX, vsrc ));
pgm->addShader(new osg::Shader( osg::Shader::FRAGMENT, fsrc ));

osg::StateSet* ss = getOrCreateStateSet();
ss->setAttributeAndModes( pgm, osg::StateAttribute::ON );
ss->addUniform( new osg::Uniform( "color", osg::Vec3(1.0f, 0.0f, 0.0f) ));
ss->addUniform( new osg::Uniform( "val1", 0.0f ));




  Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005                     40
Attributes & osg::Program
   GL supports both explicit and automatic
   attribute binding
          GLSL will dynamically assign attribute indices if
          not otherwise specified
   However, OSG currently supports only
   explicit binding, so app must assign
   indices
          Automatic binding makes display lists dependent
          on osg::Program, and has impact on DL sharing
   GLSL specifies much freedom in selecting
   attribute indices, but some current drivers
   impose restrictions
Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005            41
Using textures
   In the OSG app code
          Construct an osg::Texture
          Load image data, set filtering, wrap modes
          Attach Texture to StateSet on any texunit
          Create an int osg::Uniform with the texunit ID,
          attach to StateSet
   In GLSL code
          Declare a uniform sampler*D foo;
          Access the texture with texture*D( foo,
          coord );



Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005          42
OSG preset uniforms
   “Always available” values, like OpenGL
   built-in uniforms
   In osgUtil::SceneView
          int osg_FrameNumber;
          float osg_FrameTime;
          float osg_DeltaFrameTime;
          mat4 osg_ViewMatrix;
          mat4 osg_InverseViewMatrix;
   Automatically updated once per frame by
   SceneView
   Bitmask to disable updating if desired
Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   43
OSG file formats & GLSL
   .osg & .ive formats have full read/write
   support for GLSL objects
   OSG formats can serve as a GLSL effect
   file.
   Today’s demos consist simply of a .osg
   file
          no runtime app other than osgviewer required




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005       44
Tips, Tricks,
Gotchas, and Tools
Gotchas,




                     45
Tips for Shader Debugging
   Name your osg::Shaders/osg::Programs
   Review the infologs displayed at notify
   osg::INFO level.
   Assign internal vecs to color
   Use discard like assert
   Verify your code for conformance
   Try glsl_dataflag.osg to see values inside
   your scene
   New in CVS: glValidateProgram() support


Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   46
GLSL performance tips
   Put algorithm in the right stage
          Don’t compute in fragment if could be passed
          from vertex stage or app
   Don’t interpolate more than necessary
          If your texture coord is a vec2, don’t pass as vec4
   Try passing data as attributes rather than
   uniforms
          Changing uniforms sometimes have a setup cost
   Use built-in functions and types
   Review the infologs
          Driver may give hints on non-optimal code

Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005              47
GLSL language gotchas
   Comparing float values
          Use an epsilon
   Varyings are interpolated
          Interpolating from A to A may not exactly == A
   int is semantic (usually float internally)




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005         48
GLSL implementation gotchas
   Drivers are new, there’s room for improvement
   Don’t learn GLSL empirically on your driver
   Example portability issues
          “Any extended behavior must first be enabled.” (p11)
          “There are no implicit conversions between types.” (p16)
          Writes to read-only variables
          Additional resource constraints (attribute slots, texture units)
          Loops forced to constant number of iterations
   Review your driver’s release notes, take heed
   Note the driver’s GLSL version string
   Depend on the GL and GLSL specs
   Be vigilant now for compatibility later

Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005                           49
On the CDROM
   Documentation
          OpenGL 2.0, GLSL 1.10 specifications
          GLSL Overview whitepaper & Quick Reference
          OpenGL manpages (HTML & VS.net help)
   Open-source tools from 3Dlabs website
          GLSL Demo
          GLSL Parser Test
          GLSL Validate
          ShaderGen
          GLSL Compiler Front-end



Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005     50
GLSL Validate
   Open source, including commercial use
   Uses the 3Dlabs GLSL compiler front-end
   to check the validity of a shader
   Contains both command line and GUI
   interface
   Does NOT require a GLSL-capable driver




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   51
GLSL Parse Test
   Open source, including commercial use
   Suite of over 140 GLSL shader tests
   Includes both known-good and known-
   bad test cases
   Compiles each shader, compares to
   expected results
   Results are summarized, written to HTML
   Info logs can be examined
   It tests a driver’s GLSL compiler, so a
   GLSL-capable driver required (duh)

Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   52
GLSL Compiler Front-End
              Front-End
   Open source, including commercial use
   Part of 3Dlabs’ production compiler
   Compiles on Windows and Linux
   Performs:
          Preprocessing
          Lexical analysis
          Syntactic analysis
          Semantic analysis
          Constructs a high-level parse tree.




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   53
osgToy::GlslLint
osgToy::GlslLint
   Proof-of-concept GLSLvalidate-like
   functionality integrated with OSG
   Uses the 3Dlabs GLSL compiler front-end
   No GLSL driver or hardware necessary
   Currently part of the osgToy collection
          http://sourceforge.net/projects/osgtoy/


   Accessible from C++ as a NodeVisitor:
          osgToy::GlslLintVisitor
   Or from cmdline as a pseudoloader:
          osgviewer myScene.osg.glsllint
Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   54
Demos!




         55
osgshaders example
   The original OSG/GLSL example in C++
   Demonstrates multiple osg::Programs,
   time-varying uniforms, multi-texture




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   56
glsl_simple.osg
glsl_simple.osg
   The first GLSL scene in a .osg file
   Block colors are uniforms distributed
   around the scenegraph




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   57
glsl_confetti.osg
glsl_confetti.osg
   Demonstrates generic vertex attributes
   and particle animation in a vertex shader




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   58
compactdisc.osg
compactdisc.osg
   A vertex-only shader using generic vertex
   attributes




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   59
glsl_dataflag.osg
glsl_dataflag.osg
   Displays GLSL-internal values as ASCII
   strings
   Drawn in one pass; no render-to-texture




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   60
3dataflags
   Multiple dataflag instances can show
   different data




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   61
For more info

   http://openscenegraph.org/
   http://developer.3Dlabs.com/
   http://mew.cx/osg/
   http://sourceforge.net/projects/osgtoy/




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   62
Thank you!




Copyright © 2005, 3Dlabs, Inc. Ltd   July 31, 2005   63

Contenu connexe

Tendances

Installing and Running Postfix within a Docker Container
Installing and Running Postfix within a Docker ContainerInstalling and Running Postfix within a Docker Container
Installing and Running Postfix within a Docker ContainerDocker, Inc.
 
Ceph RBD Update - June 2021
Ceph RBD Update - June 2021Ceph RBD Update - June 2021
Ceph RBD Update - June 2021Ceph Community
 
Parallel Futures of a Game Engine
Parallel Futures of a Game EngineParallel Futures of a Game Engine
Parallel Futures of a Game EngineJohan Andersson
 
OpenGL Introduction.
OpenGL Introduction.OpenGL Introduction.
OpenGL Introduction.Girish Ghate
 
Optimizing the Graphics Pipeline with Compute, GDC 2016
Optimizing the Graphics Pipeline with Compute, GDC 2016Optimizing the Graphics Pipeline with Compute, GDC 2016
Optimizing the Graphics Pipeline with Compute, GDC 2016Graham Wihlidal
 
Lecture 6 introduction to open gl and glut
Lecture 6   introduction to open gl and glutLecture 6   introduction to open gl and glut
Lecture 6 introduction to open gl and glutsimpleok
 
XPDDS17: Shared Virtual Memory Virtualization Implementation on Xen - Yi Liu,...
XPDDS17: Shared Virtual Memory Virtualization Implementation on Xen - Yi Liu,...XPDDS17: Shared Virtual Memory Virtualization Implementation on Xen - Yi Liu,...
XPDDS17: Shared Virtual Memory Virtualization Implementation on Xen - Yi Liu,...The Linux Foundation
 
Docker introduction for the beginners
Docker introduction for the beginnersDocker introduction for the beginners
Docker introduction for the beginnersJuneyoung Oh
 
Image to image translation with Pix2Pix GAN
Image to image translation with Pix2Pix GANImage to image translation with Pix2Pix GAN
Image to image translation with Pix2Pix GANS.Shayan Daneshvar
 
Approaching zero driver overhead
Approaching zero driver overheadApproaching zero driver overhead
Approaching zero driver overheadCass Everitt
 
Survey of Attention mechanism & Use in Computer Vision
Survey of Attention mechanism & Use in Computer VisionSurvey of Attention mechanism & Use in Computer Vision
Survey of Attention mechanism & Use in Computer VisionSwatiNarkhede1
 
Glibc内存管理ptmalloc源代码分析4
Glibc内存管理ptmalloc源代码分析4Glibc内存管理ptmalloc源代码分析4
Glibc内存管理ptmalloc源代码分析4hans511002
 
Advanced Namespaces and cgroups
Advanced Namespaces and cgroupsAdvanced Namespaces and cgroups
Advanced Namespaces and cgroupsKernel TLV
 
Literature Review on Single Image Super Resolution
Literature Review on Single Image Super ResolutionLiterature Review on Single Image Super Resolution
Literature Review on Single Image Super Resolutionijtsrd
 

Tendances (20)

Installing and Running Postfix within a Docker Container
Installing and Running Postfix within a Docker ContainerInstalling and Running Postfix within a Docker Container
Installing and Running Postfix within a Docker Container
 
OpenGL basics
OpenGL basicsOpenGL basics
OpenGL basics
 
Stereo vision
Stereo visionStereo vision
Stereo vision
 
Ceph RBD Update - June 2021
Ceph RBD Update - June 2021Ceph RBD Update - June 2021
Ceph RBD Update - June 2021
 
Parallel Futures of a Game Engine
Parallel Futures of a Game EngineParallel Futures of a Game Engine
Parallel Futures of a Game Engine
 
Logging kernel oops and panic
Logging kernel oops and panicLogging kernel oops and panic
Logging kernel oops and panic
 
OpenGL Introduction.
OpenGL Introduction.OpenGL Introduction.
OpenGL Introduction.
 
Optimizing the Graphics Pipeline with Compute, GDC 2016
Optimizing the Graphics Pipeline with Compute, GDC 2016Optimizing the Graphics Pipeline with Compute, GDC 2016
Optimizing the Graphics Pipeline with Compute, GDC 2016
 
OpenGL Texture Mapping
OpenGL Texture MappingOpenGL Texture Mapping
OpenGL Texture Mapping
 
Git & GitHub WorkShop
Git & GitHub WorkShopGit & GitHub WorkShop
Git & GitHub WorkShop
 
Lecture 6 introduction to open gl and glut
Lecture 6   introduction to open gl and glutLecture 6   introduction to open gl and glut
Lecture 6 introduction to open gl and glut
 
XPDDS17: Shared Virtual Memory Virtualization Implementation on Xen - Yi Liu,...
XPDDS17: Shared Virtual Memory Virtualization Implementation on Xen - Yi Liu,...XPDDS17: Shared Virtual Memory Virtualization Implementation on Xen - Yi Liu,...
XPDDS17: Shared Virtual Memory Virtualization Implementation on Xen - Yi Liu,...
 
Docker introduction for the beginners
Docker introduction for the beginnersDocker introduction for the beginners
Docker introduction for the beginners
 
Image to image translation with Pix2Pix GAN
Image to image translation with Pix2Pix GANImage to image translation with Pix2Pix GAN
Image to image translation with Pix2Pix GAN
 
Approaching zero driver overhead
Approaching zero driver overheadApproaching zero driver overhead
Approaching zero driver overhead
 
Survey of Attention mechanism & Use in Computer Vision
Survey of Attention mechanism & Use in Computer VisionSurvey of Attention mechanism & Use in Computer Vision
Survey of Attention mechanism & Use in Computer Vision
 
Glibc内存管理ptmalloc源代码分析4
Glibc内存管理ptmalloc源代码分析4Glibc内存管理ptmalloc源代码分析4
Glibc内存管理ptmalloc源代码分析4
 
Advanced Namespaces and cgroups
Advanced Namespaces and cgroupsAdvanced Namespaces and cgroups
Advanced Namespaces and cgroups
 
Literature Review on Single Image Super Resolution
Literature Review on Single Image Super ResolutionLiterature Review on Single Image Super Resolution
Literature Review on Single Image Super Resolution
 
OpenGL Basics
OpenGL BasicsOpenGL Basics
OpenGL Basics
 

En vedette

Special Photo Effects
Special Photo EffectsSpecial Photo Effects
Special Photo EffectsMarco Belzoni
 
Human Action Recognition Based on Spacio-temporal features
Human Action Recognition Based on Spacio-temporal featuresHuman Action Recognition Based on Spacio-temporal features
Human Action Recognition Based on Spacio-temporal featuresnikhilus85
 
Interactive Graphic Storytelling: “How the Internet Impacts the Graphic Novel”
Interactive Graphic Storytelling: “How the Internet Impacts the Graphic Novel” Interactive Graphic Storytelling: “How the Internet Impacts the Graphic Novel”
Interactive Graphic Storytelling: “How the Internet Impacts the Graphic Novel” Shane Tilton
 
Pelican Mapping - FOSS4G 2011
Pelican Mapping - FOSS4G 2011Pelican Mapping - FOSS4G 2011
Pelican Mapping - FOSS4G 2011Glenn Waldron
 
Shtanchaev_SPEKTR
Shtanchaev_SPEKTRShtanchaev_SPEKTR
Shtanchaev_SPEKTRshtanchaev
 
Radiosity algorithm
Radiosity algorithmRadiosity algorithm
Radiosity algorithmHung Sun
 
UP200 dental 3d scanner with dental CAD
UP200 dental 3d scanner with dental CADUP200 dental 3d scanner with dental CAD
UP200 dental 3d scanner with dental CADDragon Cai
 
Steel monkeys: Unity3D глазами программиста графики
Steel monkeys: Unity3D глазами программиста графикиSteel monkeys: Unity3D глазами программиста графики
Steel monkeys: Unity3D глазами программиста графикиDevGAMM Conference
 
Woden 2: Developing a modern 3D graphics engine in Smalltalk
Woden 2: Developing a modern 3D graphics engine in SmalltalkWoden 2: Developing a modern 3D graphics engine in Smalltalk
Woden 2: Developing a modern 3D graphics engine in SmalltalkESUG
 
Typography on the Web
Typography on the WebTypography on the Web
Typography on the WebSara Cannon
 
Quadtree In Game
Quadtree In GameQuadtree In Game
Quadtree In GameDương Nyl
 
What is 3 d modeling unit 66
What is 3 d modeling   unit 66What is 3 d modeling   unit 66
What is 3 d modeling unit 66Richard Marshall
 
Orthographic projection
Orthographic projectionOrthographic projection
Orthographic projectionlaura_gerold
 
Building a DIY 3D Scanner
Building a DIY 3D ScannerBuilding a DIY 3D Scanner
Building a DIY 3D ScannerMatthewShotton
 
Chapter 11 biotechnology by mohanbio
Chapter 11 biotechnology by mohanbioChapter 11 biotechnology by mohanbio
Chapter 11 biotechnology by mohanbiomohan bio
 
The Image-based data glove presentation
The Image-based data glove presentationThe Image-based data glove presentation
The Image-based data glove presentationVitor Pamplona
 

En vedette (20)

Special Photo Effects
Special Photo EffectsSpecial Photo Effects
Special Photo Effects
 
Human Action Recognition Based on Spacio-temporal features
Human Action Recognition Based on Spacio-temporal featuresHuman Action Recognition Based on Spacio-temporal features
Human Action Recognition Based on Spacio-temporal features
 
Interactive Graphic Storytelling: “How the Internet Impacts the Graphic Novel”
Interactive Graphic Storytelling: “How the Internet Impacts the Graphic Novel” Interactive Graphic Storytelling: “How the Internet Impacts the Graphic Novel”
Interactive Graphic Storytelling: “How the Internet Impacts the Graphic Novel”
 
Pelican Mapping - FOSS4G 2011
Pelican Mapping - FOSS4G 2011Pelican Mapping - FOSS4G 2011
Pelican Mapping - FOSS4G 2011
 
Shtanchaev_SPEKTR
Shtanchaev_SPEKTRShtanchaev_SPEKTR
Shtanchaev_SPEKTR
 
Radiosity algorithm
Radiosity algorithmRadiosity algorithm
Radiosity algorithm
 
UP200 dental 3d scanner with dental CAD
UP200 dental 3d scanner with dental CADUP200 dental 3d scanner with dental CAD
UP200 dental 3d scanner with dental CAD
 
Steel monkeys: Unity3D глазами программиста графики
Steel monkeys: Unity3D глазами программиста графикиSteel monkeys: Unity3D глазами программиста графики
Steel monkeys: Unity3D глазами программиста графики
 
Woden 2: Developing a modern 3D graphics engine in Smalltalk
Woden 2: Developing a modern 3D graphics engine in SmalltalkWoden 2: Developing a modern 3D graphics engine in Smalltalk
Woden 2: Developing a modern 3D graphics engine in Smalltalk
 
Shells
ShellsShells
Shells
 
Typography on the Web
Typography on the WebTypography on the Web
Typography on the Web
 
Quadtree In Game
Quadtree In GameQuadtree In Game
Quadtree In Game
 
What is 3 d modeling unit 66
What is 3 d modeling   unit 66What is 3 d modeling   unit 66
What is 3 d modeling unit 66
 
Orthographic projection
Orthographic projectionOrthographic projection
Orthographic projection
 
Building a DIY 3D Scanner
Building a DIY 3D ScannerBuilding a DIY 3D Scanner
Building a DIY 3D Scanner
 
Chapter 11 biotechnology by mohanbio
Chapter 11 biotechnology by mohanbioChapter 11 biotechnology by mohanbio
Chapter 11 biotechnology by mohanbio
 
3D scanner using kinect
3D scanner using kinect3D scanner using kinect
3D scanner using kinect
 
3D internet
3D  internet3D  internet
3D internet
 
3D Laser Scanning
3D Laser Scanning 3D Laser Scanning
3D Laser Scanning
 
The Image-based data glove presentation
The Image-based data glove presentationThe Image-based data glove presentation
The Image-based data glove presentation
 

Similaire à GLSL Shading with OpenSceneGraph

Gdc 14 bringing unreal engine 4 to open_gl
Gdc 14 bringing unreal engine 4 to open_glGdc 14 bringing unreal engine 4 to open_gl
Gdc 14 bringing unreal engine 4 to open_glchangehee lee
 
Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011Prabindh Sundareson
 
13th kandroid OpenGL and EGL
13th kandroid OpenGL and EGL13th kandroid OpenGL and EGL
13th kandroid OpenGL and EGLJungsoo Nam
 
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...ICS
 
Shader Programming With Unity
Shader Programming With UnityShader Programming With Unity
Shader Programming With UnityMindstorm Studios
 
OpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI PlatformsOpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI PlatformsPrabindh Sundareson
 
OpenGL 3.2 and More
OpenGL 3.2 and MoreOpenGL 3.2 and More
OpenGL 3.2 and MoreMark Kilgard
 
Seminar presentation on OpenGL
Seminar presentation on OpenGLSeminar presentation on OpenGL
Seminar presentation on OpenGLMegha V
 
Porting the Source Engine to Linux: Valve's Lessons Learned
Porting the Source Engine to Linux: Valve's Lessons LearnedPorting the Source Engine to Linux: Valve's Lessons Learned
Porting the Source Engine to Linux: Valve's Lessons Learnedbasisspace
 
OpenGL Shading Language
OpenGL Shading LanguageOpenGL Shading Language
OpenGL Shading LanguageJungsoo Nam
 
GFX Part 1 - Introduction to GPU HW and OpenGL ES specifications
GFX Part 1 - Introduction to GPU HW and OpenGL ES specificationsGFX Part 1 - Introduction to GPU HW and OpenGL ES specifications
GFX Part 1 - Introduction to GPU HW and OpenGL ES specificationsPrabindh Sundareson
 
CS 354 Programmable Shading
CS 354 Programmable ShadingCS 354 Programmable Shading
CS 354 Programmable ShadingMark Kilgard
 
MODIGEN: MODEL-DRIVEN GENERATION OF GRAPHICAL EDITORS IN ECLIPSE
MODIGEN: MODEL-DRIVEN GENERATION OF GRAPHICAL EDITORS IN ECLIPSEMODIGEN: MODEL-DRIVEN GENERATION OF GRAPHICAL EDITORS IN ECLIPSE
MODIGEN: MODEL-DRIVEN GENERATION OF GRAPHICAL EDITORS IN ECLIPSEijcsit
 

Similaire à GLSL Shading with OpenSceneGraph (20)

Gdc 14 bringing unreal engine 4 to open_gl
Gdc 14 bringing unreal engine 4 to open_glGdc 14 bringing unreal engine 4 to open_gl
Gdc 14 bringing unreal engine 4 to open_gl
 
Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011Advanced Graphics Workshop - GFX2011
Advanced Graphics Workshop - GFX2011
 
Introduction to 2D/3D Graphics
Introduction to 2D/3D GraphicsIntroduction to 2D/3D Graphics
Introduction to 2D/3D Graphics
 
13th kandroid OpenGL and EGL
13th kandroid OpenGL and EGL13th kandroid OpenGL and EGL
13th kandroid OpenGL and EGL
 
Pixel shaders
Pixel shadersPixel shaders
Pixel shaders
 
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
 
OpenGL Introduction
OpenGL IntroductionOpenGL Introduction
OpenGL Introduction
 
Shader Programming With Unity
Shader Programming With UnityShader Programming With Unity
Shader Programming With Unity
 
Realizing OpenGL
Realizing OpenGLRealizing OpenGL
Realizing OpenGL
 
Opengl basics
Opengl basicsOpengl basics
Opengl basics
 
OpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI PlatformsOpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI Platforms
 
OpenGL 3.2 and More
OpenGL 3.2 and MoreOpenGL 3.2 and More
OpenGL 3.2 and More
 
Seminar presentation on OpenGL
Seminar presentation on OpenGLSeminar presentation on OpenGL
Seminar presentation on OpenGL
 
How to Use OpenGL/ES on Native Activity
How to Use OpenGL/ES on Native ActivityHow to Use OpenGL/ES on Native Activity
How to Use OpenGL/ES on Native Activity
 
Data structures graphics library in computer graphics.
Data structures  graphics library in computer graphics.Data structures  graphics library in computer graphics.
Data structures graphics library in computer graphics.
 
Porting the Source Engine to Linux: Valve's Lessons Learned
Porting the Source Engine to Linux: Valve's Lessons LearnedPorting the Source Engine to Linux: Valve's Lessons Learned
Porting the Source Engine to Linux: Valve's Lessons Learned
 
OpenGL Shading Language
OpenGL Shading LanguageOpenGL Shading Language
OpenGL Shading Language
 
GFX Part 1 - Introduction to GPU HW and OpenGL ES specifications
GFX Part 1 - Introduction to GPU HW and OpenGL ES specificationsGFX Part 1 - Introduction to GPU HW and OpenGL ES specifications
GFX Part 1 - Introduction to GPU HW and OpenGL ES specifications
 
CS 354 Programmable Shading
CS 354 Programmable ShadingCS 354 Programmable Shading
CS 354 Programmable Shading
 
MODIGEN: MODEL-DRIVEN GENERATION OF GRAPHICAL EDITORS IN ECLIPSE
MODIGEN: MODEL-DRIVEN GENERATION OF GRAPHICAL EDITORS IN ECLIPSEMODIGEN: MODEL-DRIVEN GENERATION OF GRAPHICAL EDITORS IN ECLIPSE
MODIGEN: MODEL-DRIVEN GENERATION OF GRAPHICAL EDITORS IN ECLIPSE
 

Dernier

DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 

Dernier (20)

DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 

GLSL Shading with OpenSceneGraph

  • 1. GLSL Shading with OpenSceneGraph Mike Weiblen July 31, 2005 Los Angeles Rev B 1
  • 2. Summary of this talk Overview of GLSL pipeline & syntax OSG support for GLSL Tips, Tricks, Gotchas, and Tools Demos What we’re not covering Our focus will be the OSG API, not OpenGL API Not lots of detail on the GLSL language itself Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 2
  • 3. Our dependencies OpenGL 2.0 OpenGL Shading Language 1.10 rev 59 Specs on opengl.org and CDROM OpenSceneGraph 0.9.9 Note: GLSL support continues to evolve in CVS Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 3
  • 4. GLSL / OSG timeline Fall 2001: 3Dlabs “GL2.0” whitepapers, shading language is the centerpiece July 2003: ARB approves GL1.5, GLSL as ARB extension Fall 2003: osgGL2 Nodekit Sep 2004: ARB approves GL2.0, GLSL in the core. Spring 2005: 2nd generation GLSL support integrated into OSG core Supports both OpenGL 2.0 and 1.5 extensions Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 4
  • 6. The OpenGL 2.0 Pipeline Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 6
  • 7. GLSL pipeline architecture GLSL exposes programmability at two points in the OpenGL 2.0 pipeline Vertex processor Fragment processor Compiled code to run on a particular processor is a glShader A linked executable unit to be activated on the pipeline is a glProgram Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 7
  • 8. GLSL compilation model Similar to familiar C build model glShader = “object file” Contains shader source code Compiled to become an “.obj file” Must be recompiled when source changes glProgram = “executable file” Contains a list of shaders Linked to become an “.exe file” Must be relinked when set of shaders changes As with C, a glShader “.obj” can be shared across multiple glPrograms “.exe” Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 8
  • 9. Vertex Processor Overview Standard OpenGL Generic attributes attributes gl_color 0, 1, 2, … gl_normal etc. Vertex User-defined uniforms: epsilon, myLightPos, surfColor, etc. Texture Maps Processor Built-in uniforms: gl_FogColor, gl_ModelViewMatrix, etc. Standard Special User-defined Varying Variables Varying gl_FrontColor gl_Position normal gl_BackColor gl_ClipVertex refraction etc. gl_PointSize etc. Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 9
  • 10. Fragment Processor Overview Standard Special User-defined Varying Variables Varying gl_Color gl_FragCoord normal gl_SecondaryColor gl_FrontFacing refraction etc. etc. Fragment User-defined uniforms: epsilon, myLightPos, surfColor, etc. Texture Maps Processor Built-in uniforms: gl_FogColor, gl_ModelViewMatrix, etc. Special Variables gl_FragColor gl_FragDepth gl_FragData[n] Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 10
  • 11. GLSL language design Based on syntax of ANSI C Includes preprocessor Additions for graphics functionality Additions from C++ Some refactoring for cleaner design Designed for parallelization on SIMD array Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 11
  • 12. Language enhanced for graphics Added Vector and Matrix types Added Sampler type for textures Qualifiers: attribute, uniform, varying Built-in variables to access GL state Built-in functions Vector component notation (swizzling) discard keyword to cease fragment processing Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 12
  • 13. Additions from C++ Function overloading Variables declared when needed struct definition performs typedef bool datatype Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 13
  • 14. Differences from C/C++ No automatic type conversion Constructor notation rather than type cast int x = int(5.0); Function parameters passed by value- return No pointers or strings Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 14
  • 15. GLSL compiler The GLSL compiler is in the GL driver and part of the core OpenGL API No external compiler tools required. So the compiler is always available at runtime Compile shaders whenever convenient Tight integration allows every vendor to exploit their architecture for best possible performance Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 15
  • 16. Comparing architectures Cg GLSL Cg Code Cg Code GLSL Code GLSL Code Cg Compiler Cg Compiler Intermediate Lang Intermediate Lang Too (e.g. ARB vp/fp) (e.g. ARB vp/fp) far apart IL Translator IL Translator Compiler Compiler Driver Tightly Driver Driver Driver coupled Graphics HW Graphics HW Graphics HW Graphics HW Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 16
  • 17. GLSL datatypes Scalars: float, int, bool Vectors: float, int, bool Matrices: float Samplers Arrays Structs Note int and bool types are semantic, not expected to be supported natively int at least as 16 bits plus sign bit Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 17
  • 18. GLSL datatype qualifiers uniform Relatively constant data from app or OpenGL Input to both vertex and fragment shaders attribute Per-vertex data from app or OpenGL Input to vertex shader only varying Perspective-correct interpolated value Output from vertex, input to fragment const in, out, inout (for function parameters) Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 18
  • 19. OpenGL state tracking Common OpenGL state is available to GLSL via built-in variables Built-in variables do not need declaration All begin with reserved prefix “gl_” Includes uniforms, attributes, and varyings Makes it easier to interface w/ legacy app code However, recommend just defining your own variables for semantic clarity; resist temptation to overload built-ins FYI OpenGL/ES will have no or few built-ins Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 19
  • 20. uniform variables Input to vertex and fragment shaders Values from OpenGL or app e.g.: gl_ModelViewProjectionMatrix Changes relatively infrequently Typically constant over several primitives Queriable limit on number of floats App sets values with glUniform*() API Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 20
  • 21. attribute variables Input to vertex shader only Values from OpenGL or app e.g.: gl_Color, gl_Normal Can change per-vertex But doesn’t have to Queriable limit on the # of vec4 slots Scalars/vectors take a slot Matrices take a slot per column Apps sends with per-vertex API or vertex arrays Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 21
  • 22. varying variables Output from vertex, input to fragment Name & type must match across shaders Values from vertex stage are perspective- corrected, interpolated, sent to fragment stage Queriable limit on number of floats Usually defined by GLSL code although GLSL defines some built-ins; e.g.: gl_FrontColor (necessary when combining GLSL with fixed-functionality) Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 22
  • 23. Defining variables in GLSL Uniform, varying, attribute must be global to a glShader Over-declaring variables in GLSL code doesn’t cost Only those variables actually used in the code (the “active” variables) consume resources After linking, the app queries uniforms and attributes from glProgram Runtime introspection; useful e.g. for building a GUI on the fly Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 23
  • 24. Texture access GLSL supports texture access in both vertex and fragment stages However, some hardware may not yet support texture access in vertex Vertex texturing is available when GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS > 0 Mipmap LOD is handled differently between Vertex and Fragment stages Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 24
  • 25. Shader Configurations May have more than 1 glShader per stage attached to a glProgram But there must be exactly one main() per stage Useful for a library of shared GLSL code to be reused across several glPrograms Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 25
  • 26. Program Configurations GLSL permits mixing a fixed-functionality stage with a programmable stage Prog Vertex + Prog Fragment Prog Vertex + FF Fragment FF Vertex + Prog Fragment GLSL Built-in varyings are key when mixing programmable stages w/ FF Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 26
  • 27. GLSL Versioning & Extensions #version min_version_number Default is “#version 110” Good idea to always declare expected version #extension name : behavior Default is “#extension all : disable” Extension names/capabilies defined in usual GL extensions specifications Special name “all” indicates all extensions supported by a compiler Details in GLSL 1.10 spec pp11-12 Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 27
  • 28. Using GLSL extensions Recommended approach #ifdef ARB_texture_rectangle #extension ARB_texture_rectangle : require #endif uniform sampler2DRect mysampler; Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 28
  • 29. GLSL Future Expect GLSL to evolve Possible new language features More built-in functions, datatypes Interfaces Shader trees Possible new programmable stages in pipeline Geometry Blending Use #version and #extension Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 29
  • 30. OSG support for GLSL 30
  • 31. OSG GLSL design goals Continue OSG’s straightforward mapping of classes to the underlying GL concepts Leverage OSG’s state stack to apply GLSL state with proper scoping App specifies where/what GLSL will do. OSG determines when/how to apply, restoring to previous state afterwards. Let OSG deal with the tedious GL stuff Management of contexts, constructors, indices, compile/link, etc. Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 31
  • 32. Mapping GL API to OSG API glShader object -> osg::Shader glProgram object -> osg::Program glUniform*() -> osg::Uniform Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 32
  • 33. OSG GLSL benefits over GL Decouples shaders from GL contexts Handles multiple instancing when multiple GL contexts osg::Uniform values correctly applied via OSG’s state update mechanism at the appropriate time Compilation and linking automatically handled when osg::Shader/osg::Program are dirtied by modification Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 33
  • 34. osg::Shader Derived from osg::Object Stores the shader’s source code text and manages its compilation Attach osg::Shader to osg::Program osg::Shader be attached to more than one osg::Program More than one osg::Shader may be attached to an osg::Program Encapsulates per-context glShaders Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 34
  • 35. osg::Shader API subset Shader Type VERTEX or FRAGMENT Sourcecode text management setShaderSource() / getShaderSource() loadShaderSourceFromFile() readShaderFile() Queries getType() getGlShaderInfoLog() Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 35
  • 36. osg::Program Derived from osg::StateAttribute Defines a set of osg::Shaders, manages their linkage, and activates for rendering osg::Programs may be attached anywhere in the scenegraph An “empty” osg::Program (i.e.: no attached osg::Shaders) indicates fixed- functionality Automatically performs relink if attached osg::Shaders are modified Encapsulates per-context glPrograms Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 36
  • 37. osg::Program API subset Shader management addShader() removeShader() getNumShaders() getShader() Attribute binding management addBindAttribLocation() removeBindAttribLocation() getAttribBindingList() Queries getActiveUniforms() getActiveAttribs() getGlProgramInfoLog() Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 37
  • 38. osg::Uniform Derived from osg::Object Attaches to osg::StateSet May be attached anywhere in the scenegraph, not just near osg::Program e.g.: set default values at root of scenegraph Their effect inherits/overrides through the scenegraph, like osg::StateAttributes OSG handles the uniform index management automatically Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 38
  • 39. osg::Uniform API subset Uniform Types All defined GLSL types (float, vec, mat, etc) Value management Many convenient constructors Many get()/set() methods Callback support setUpdateCallback() / getUpdateCallback() setEventCallback() / getEventCallback() Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 39
  • 40. Simple source example Putting it all together… osg::Program* pgm = new osg::Program; pgm->setName( "simple" ); pgm->addShader(new osg::Shader( osg::Shader::VERTEX, vsrc )); pgm->addShader(new osg::Shader( osg::Shader::FRAGMENT, fsrc )); osg::StateSet* ss = getOrCreateStateSet(); ss->setAttributeAndModes( pgm, osg::StateAttribute::ON ); ss->addUniform( new osg::Uniform( "color", osg::Vec3(1.0f, 0.0f, 0.0f) )); ss->addUniform( new osg::Uniform( "val1", 0.0f )); Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 40
  • 41. Attributes & osg::Program GL supports both explicit and automatic attribute binding GLSL will dynamically assign attribute indices if not otherwise specified However, OSG currently supports only explicit binding, so app must assign indices Automatic binding makes display lists dependent on osg::Program, and has impact on DL sharing GLSL specifies much freedom in selecting attribute indices, but some current drivers impose restrictions Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 41
  • 42. Using textures In the OSG app code Construct an osg::Texture Load image data, set filtering, wrap modes Attach Texture to StateSet on any texunit Create an int osg::Uniform with the texunit ID, attach to StateSet In GLSL code Declare a uniform sampler*D foo; Access the texture with texture*D( foo, coord ); Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 42
  • 43. OSG preset uniforms “Always available” values, like OpenGL built-in uniforms In osgUtil::SceneView int osg_FrameNumber; float osg_FrameTime; float osg_DeltaFrameTime; mat4 osg_ViewMatrix; mat4 osg_InverseViewMatrix; Automatically updated once per frame by SceneView Bitmask to disable updating if desired Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 43
  • 44. OSG file formats & GLSL .osg & .ive formats have full read/write support for GLSL objects OSG formats can serve as a GLSL effect file. Today’s demos consist simply of a .osg file no runtime app other than osgviewer required Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 44
  • 45. Tips, Tricks, Gotchas, and Tools Gotchas, 45
  • 46. Tips for Shader Debugging Name your osg::Shaders/osg::Programs Review the infologs displayed at notify osg::INFO level. Assign internal vecs to color Use discard like assert Verify your code for conformance Try glsl_dataflag.osg to see values inside your scene New in CVS: glValidateProgram() support Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 46
  • 47. GLSL performance tips Put algorithm in the right stage Don’t compute in fragment if could be passed from vertex stage or app Don’t interpolate more than necessary If your texture coord is a vec2, don’t pass as vec4 Try passing data as attributes rather than uniforms Changing uniforms sometimes have a setup cost Use built-in functions and types Review the infologs Driver may give hints on non-optimal code Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 47
  • 48. GLSL language gotchas Comparing float values Use an epsilon Varyings are interpolated Interpolating from A to A may not exactly == A int is semantic (usually float internally) Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 48
  • 49. GLSL implementation gotchas Drivers are new, there’s room for improvement Don’t learn GLSL empirically on your driver Example portability issues “Any extended behavior must first be enabled.” (p11) “There are no implicit conversions between types.” (p16) Writes to read-only variables Additional resource constraints (attribute slots, texture units) Loops forced to constant number of iterations Review your driver’s release notes, take heed Note the driver’s GLSL version string Depend on the GL and GLSL specs Be vigilant now for compatibility later Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 49
  • 50. On the CDROM Documentation OpenGL 2.0, GLSL 1.10 specifications GLSL Overview whitepaper & Quick Reference OpenGL manpages (HTML & VS.net help) Open-source tools from 3Dlabs website GLSL Demo GLSL Parser Test GLSL Validate ShaderGen GLSL Compiler Front-end Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 50
  • 51. GLSL Validate Open source, including commercial use Uses the 3Dlabs GLSL compiler front-end to check the validity of a shader Contains both command line and GUI interface Does NOT require a GLSL-capable driver Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 51
  • 52. GLSL Parse Test Open source, including commercial use Suite of over 140 GLSL shader tests Includes both known-good and known- bad test cases Compiles each shader, compares to expected results Results are summarized, written to HTML Info logs can be examined It tests a driver’s GLSL compiler, so a GLSL-capable driver required (duh) Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 52
  • 53. GLSL Compiler Front-End Front-End Open source, including commercial use Part of 3Dlabs’ production compiler Compiles on Windows and Linux Performs: Preprocessing Lexical analysis Syntactic analysis Semantic analysis Constructs a high-level parse tree. Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 53
  • 54. osgToy::GlslLint osgToy::GlslLint Proof-of-concept GLSLvalidate-like functionality integrated with OSG Uses the 3Dlabs GLSL compiler front-end No GLSL driver or hardware necessary Currently part of the osgToy collection http://sourceforge.net/projects/osgtoy/ Accessible from C++ as a NodeVisitor: osgToy::GlslLintVisitor Or from cmdline as a pseudoloader: osgviewer myScene.osg.glsllint Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 54
  • 55. Demos! 55
  • 56. osgshaders example The original OSG/GLSL example in C++ Demonstrates multiple osg::Programs, time-varying uniforms, multi-texture Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 56
  • 57. glsl_simple.osg glsl_simple.osg The first GLSL scene in a .osg file Block colors are uniforms distributed around the scenegraph Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 57
  • 58. glsl_confetti.osg glsl_confetti.osg Demonstrates generic vertex attributes and particle animation in a vertex shader Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 58
  • 59. compactdisc.osg compactdisc.osg A vertex-only shader using generic vertex attributes Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 59
  • 60. glsl_dataflag.osg glsl_dataflag.osg Displays GLSL-internal values as ASCII strings Drawn in one pass; no render-to-texture Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 60
  • 61. 3dataflags Multiple dataflag instances can show different data Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 61
  • 62. For more info http://openscenegraph.org/ http://developer.3Dlabs.com/ http://mew.cx/osg/ http://sourceforge.net/projects/osgtoy/ Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 62
  • 63. Thank you! Copyright © 2005, 3Dlabs, Inc. Ltd July 31, 2005 63