SlideShare a Scribd company logo
Automated Combination Of Real-Time Shader Programs Matthias Trapp :: Jürgen Döllner + =
Outline 1. Motivation 2. Concept 3. Tagging Shader Source Code 4. Preprocessing Step 5. Shader Combination 6. Conclusions
1. Motivation Problem: Fixed-function pipeline is obsolete Functionality is provided by shader programs Combine functionality    combine programs Goals: Minimize shader permutations Dynamic configuration of combined programs Keep functionality of individual shaders Enable nesting of shader programs Applications Shader-driven rendering engines Emulate orthogonal fixed function pipeline features Dynamic material systems
1. Motivation Example Scenegraph
2. Concept - Overview Modular principle for each shader type: Basically: Dynamic uber-shader construction  Exploits static branching to control execution paths Main phases: Decomposition shader into shader handler (next) Preprocessing of shader handler to intermediate shader source Combination of intermediate shaders to a single uber-shader = +
2. Concept - Decomposition Shader functionality is split into handler with  predefined semantics
2. Concept - Combination
2. Concept – Decompostion Details Shader: set of shader handler ( SH ) Prototype ( P ) Represents an atomic functionality Assigned to a shader handler:  P = prototype(SH) Prototype List ( PL ) Defines explicit order upon prototypes Important for handler combination P & PL Defined by developer in advance Differs for each shader type (vertex, fragment, …)
3. Tagging Shader Source Code Extend shading language grammar (here GLSL) Shader Handler Example: handler  [ local | global | optional | explicite | ignore ]  hName  ( interface  iName ) handler local   onLighting ( interface   context ) { vec3  fragNormal =  normalize ( context.us_Frag Normal ); vec3  fragView  =  normalize ( context.us_Frag View ); vec3  fragLight  =  normalize ( context.us_Frag Light ); vec3  reflection =  normalize (reflect(-phongLight, phongNormal)); float  NdotL =  max (0.0,  dot (fragNormal, fragLight)); float  VdotR =  dot (fragView, reflection); float  VdotRExp =  pow ( max (0.0, VdotR),  context.us _FrontMaterial.shininess ); context.us_FragColor  =   context.us _FrontMaterial.ambient   * ( gl_LightSource[0].ambient   +   gl_LightModel.ambient ) +   NdotL * gl_LightSource[0].diffuse  *   context.us _FrontMaterial.diffuse  +   VdotRExp *   context.us _FrontMaterial.specular  * gl_LightSource[0].specular ;   return ; }
4. Preprocessing Step Transforms tagged source into: Intermediate source code (language specific)  Mapping: Shader Handler    Prototype Basically via token substitution: Insert specific interface source code Result is ready for API shading language front-end compiler
5. Shader Combination During Pre-traversal by Shader Management System (SMS) Create priority program list ( PPL ) Create controller for each shader type: Generated controller configured by an invoker table Array of Boolean variables represents activity-state of handler Passed to the controller as uniform shader state During evaluation of a shader program: Activate/deactivate shader handler by modify invoker tables With respect to the handler execution modes foreach  prototype P    PL   do   foreach   shader program SP    PPL   do   foreach   shader handler SH    SP   do   if  ( prototype(SH) = P )  do   appendIfStatement(SH)
6. Conclusion Summary Combination of shader programs Generic uber-shader construction Parameters to control execution logic Drawbacks No automatic shader decomposition Future Work Resource management for shader state Enable the usage of LoD shader handler Integration into FX formats (CG, Collada,…)
Thank You. [email_address] [email_address] :: www.vrs3d.org :: www.hpi.uni-potsdam.de ::
Thank You. [email_address] [email_address] :: www.vrs3d.org :: www.hpi.uni-potsdam.de ::
2. Concept – Interfaces Properties Shared state between shader handler Depend on shader type Must be defined in advance  Deposited as source code in specific shading language GLSL Examples struct  us_VertContext { vec4   us_Position; vec3   us_Normal; float  us_PointSize; vec4   us_ClipVertex; } vertContext; Vertex Handler Interface struct  us_FragContext { vec4   us_FragColor; vec3   us_FragNormal; vec3   us_FragView; vec3   us_FragLight; gl_MaterialParameters  us_FrontMaterial; float   us_FragDepth; } fragContext; Fragment Handler Interface
2. Concept – Execution Modes Control shader handler execution Propagate active state of program      Activate handler according to execution modes Can be configured at runtime for each handler Handler execution modes: Local : handler is invoked only if the program object is active Global : handler will always be invoked Optional : invoke handler if no handler of resp. prototype is active Explicit:  all   other handler of this prototype will be disabled Ignore : handler will never be invoked
2. Concept – Execution Modes Example Scenegraph

More Related Content

What's hot (17)

PDF
Function in C++
Prof Ansari
 
PDF
OpenMP Tutorial for Beginners
Dhanashree Prasad
 
PPTX
Advance topics of C language
Mehwish Mehmood
 
PPT
ParaSail
AdaCore
 
PPT
Lap trinh C co ban va nang cao
VietJackTeam
 
PDF
Open mp intro_01
Oleg Nazarevych
 
PDF
Towards an Integration of the Actor Model in an FRP Language for Small-Scale ...
Takuo Watanabe
 
ODP
openmp
Neel Bhad
 
ODP
OpenMp
Neel Bhad
 
KEY
Ruby golightly
Eleanor McHugh
 
PPTX
POLITEKNIK MALAYSIA
Aiman Hud
 
KEY
OpenMP
Eric Cheng
 
PPT
Nug2004 yhe
Yassine Rafrafi
 
PPT
Bsc cs 1 pic u-5 pointer, structure ,union and intro to file handling
Rai University
 
PDF
A Language Support for Exhaustive Fault-Injection in Message-Passing System M...
Takuo Watanabe
 
PPTX
Double pointer (pointer to pointer)
sangrampatil81
 
PPTX
Pointers,virtual functions and polymorphism cpp
rajshreemuthiah
 
Function in C++
Prof Ansari
 
OpenMP Tutorial for Beginners
Dhanashree Prasad
 
Advance topics of C language
Mehwish Mehmood
 
ParaSail
AdaCore
 
Lap trinh C co ban va nang cao
VietJackTeam
 
Open mp intro_01
Oleg Nazarevych
 
Towards an Integration of the Actor Model in an FRP Language for Small-Scale ...
Takuo Watanabe
 
openmp
Neel Bhad
 
OpenMp
Neel Bhad
 
Ruby golightly
Eleanor McHugh
 
POLITEKNIK MALAYSIA
Aiman Hud
 
OpenMP
Eric Cheng
 
Nug2004 yhe
Yassine Rafrafi
 
Bsc cs 1 pic u-5 pointer, structure ,union and intro to file handling
Rai University
 
A Language Support for Exhaustive Fault-Injection in Message-Passing System M...
Takuo Watanabe
 
Double pointer (pointer to pointer)
sangrampatil81
 
Pointers,virtual functions and polymorphism cpp
rajshreemuthiah
 

Similar to Automated Combination of Real Time Shader Programs (EG 2007) (20)

PDF
Hpg2011 papers kazakov
mistercteam
 
PDF
Shaders in Unity
Matias Lavik
 
PPTX
Cg shaders with Unity3D
Michael Ivanov
 
PDF
【Unite 2017 Tokyo】シェーダープログラミング入門!カスタムシェーダー、作るで!
Unity Technologies Japan K.K.
 
PPT
Programmable Piplelines
Syed Zaid Irshad
 
PPTX
GFX Part 6 - Introduction to Vertex and Fragment Shaders in OpenGL ES
Prabindh Sundareson
 
PPT
Hardware Shaders
gueste52f1b
 
PDF
Minko stage3d workshop_20130525
Minko3D
 
PPTX
Working with Shader with Unity
Minh Nghiem
 
PDF
Inspecting Block Closures To Generate Shaders for GPU Execution
ESUG
 
PDF
iOS Visual F/X Using GLSL
Douglass Turner
 
PDF
SPU Shaders
Slide_N
 
PPTX
Getting started with open gl es 2
matthewgalaviz
 
PPT
CS 354 Programmable Shading
Mark Kilgard
 
PDF
tybsc cs game programming Introduction-to-GPUs.pdf
poonamsurve5
 
PPTX
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
JinTaek Seo
 
PDF
Shaders - Claudia Doppioslash - Unity With the Best
BeMyApp
 
PDF
OpenGL Introduction
Yi-Lung Tsai
 
PDF
Clean architecture for shaders unite2019
Abhilash Majumder
 
Hpg2011 papers kazakov
mistercteam
 
Shaders in Unity
Matias Lavik
 
Cg shaders with Unity3D
Michael Ivanov
 
【Unite 2017 Tokyo】シェーダープログラミング入門!カスタムシェーダー、作るで!
Unity Technologies Japan K.K.
 
Programmable Piplelines
Syed Zaid Irshad
 
GFX Part 6 - Introduction to Vertex and Fragment Shaders in OpenGL ES
Prabindh Sundareson
 
Hardware Shaders
gueste52f1b
 
Minko stage3d workshop_20130525
Minko3D
 
Working with Shader with Unity
Minh Nghiem
 
Inspecting Block Closures To Generate Shaders for GPU Execution
ESUG
 
iOS Visual F/X Using GLSL
Douglass Turner
 
SPU Shaders
Slide_N
 
Getting started with open gl es 2
matthewgalaviz
 
CS 354 Programmable Shading
Mark Kilgard
 
tybsc cs game programming Introduction-to-GPUs.pdf
poonamsurve5
 
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
JinTaek Seo
 
Shaders - Claudia Doppioslash - Unity With the Best
BeMyApp
 
OpenGL Introduction
Yi-Lung Tsai
 
Clean architecture for shaders unite2019
Abhilash Majumder
 
Ad

More from Matthias Trapp (20)

PDF
Interactive Control over Temporal Consistency while Stylizing Video Streams
Matthias Trapp
 
PDF
A Framework for Art-directed Augmentation of Human Motion in Videos on Mobile...
Matthias Trapp
 
PDF
A Framework for Interactive 3D Photo Stylization Techniques on Mobile Devices
Matthias Trapp
 
PDF
ALIVE-Adaptive Chromaticity for Interactive Low-light Image and Video Enhance...
Matthias Trapp
 
PDF
A Service-based Preset Recommendation System for Image Stylization Applications
Matthias Trapp
 
PDF
Design Space of Geometry-based Image Abstraction Techniques with Vectorizatio...
Matthias Trapp
 
PDF
A Benchmark for the Use of Topic Models for Text Visualization Tasks - Online...
Matthias Trapp
 
PDF
Efficient GitHub Crawling using the GraphQL API
Matthias Trapp
 
PDF
CodeCV - Mining Expertise of GitHub Users from Coding Activities - Online.pdf
Matthias Trapp
 
PDF
Non-Photorealistic Rendering of 3D Point Clouds for Cartographic Visualization
Matthias Trapp
 
PDF
TWIN4ROAD - Erfassung Analyse und Auswertung mobiler Multi Sensorik im Strass...
Matthias Trapp
 
PDF
Interactive Close-Up Rendering for Detail+Overview Visualization of 3D Digita...
Matthias Trapp
 
PDF
Web-based and Mobile Provisioning of Virtual 3D Reconstructions
Matthias Trapp
 
PDF
Visualization of Knowledge Distribution across Development Teams using 2.5D S...
Matthias Trapp
 
PDF
Real-time Screen-space Geometry Draping for 3D Digital Terrain Models
Matthias Trapp
 
PDF
FERMIUM - A Framework for Real-time Procedural Point Cloud Animation & Morphing
Matthias Trapp
 
PDF
Interactive Editing of Signed Distance Fields
Matthias Trapp
 
PDF
Integration of Image Processing Techniques into the Unity Game Engine
Matthias Trapp
 
PDF
Interactive GPU-based Image Deformation for Mobile Devices
Matthias Trapp
 
PDF
Interactive Photo Editing on Smartphones via Intrinsic Decomposition
Matthias Trapp
 
Interactive Control over Temporal Consistency while Stylizing Video Streams
Matthias Trapp
 
A Framework for Art-directed Augmentation of Human Motion in Videos on Mobile...
Matthias Trapp
 
A Framework for Interactive 3D Photo Stylization Techniques on Mobile Devices
Matthias Trapp
 
ALIVE-Adaptive Chromaticity for Interactive Low-light Image and Video Enhance...
Matthias Trapp
 
A Service-based Preset Recommendation System for Image Stylization Applications
Matthias Trapp
 
Design Space of Geometry-based Image Abstraction Techniques with Vectorizatio...
Matthias Trapp
 
A Benchmark for the Use of Topic Models for Text Visualization Tasks - Online...
Matthias Trapp
 
Efficient GitHub Crawling using the GraphQL API
Matthias Trapp
 
CodeCV - Mining Expertise of GitHub Users from Coding Activities - Online.pdf
Matthias Trapp
 
Non-Photorealistic Rendering of 3D Point Clouds for Cartographic Visualization
Matthias Trapp
 
TWIN4ROAD - Erfassung Analyse und Auswertung mobiler Multi Sensorik im Strass...
Matthias Trapp
 
Interactive Close-Up Rendering for Detail+Overview Visualization of 3D Digita...
Matthias Trapp
 
Web-based and Mobile Provisioning of Virtual 3D Reconstructions
Matthias Trapp
 
Visualization of Knowledge Distribution across Development Teams using 2.5D S...
Matthias Trapp
 
Real-time Screen-space Geometry Draping for 3D Digital Terrain Models
Matthias Trapp
 
FERMIUM - A Framework for Real-time Procedural Point Cloud Animation & Morphing
Matthias Trapp
 
Interactive Editing of Signed Distance Fields
Matthias Trapp
 
Integration of Image Processing Techniques into the Unity Game Engine
Matthias Trapp
 
Interactive GPU-based Image Deformation for Mobile Devices
Matthias Trapp
 
Interactive Photo Editing on Smartphones via Intrinsic Decomposition
Matthias Trapp
 
Ad

Recently uploaded (20)

PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PDF
Advancing WebDriver BiDi support in WebKit
Igalia
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
July Patch Tuesday
Ivanti
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Advancing WebDriver BiDi support in WebKit
Igalia
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
July Patch Tuesday
Ivanti
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Biography of Daniel Podor.pdf
Daniel Podor
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 

Automated Combination of Real Time Shader Programs (EG 2007)

  • 1. Automated Combination Of Real-Time Shader Programs Matthias Trapp :: Jürgen Döllner + =
  • 2. Outline 1. Motivation 2. Concept 3. Tagging Shader Source Code 4. Preprocessing Step 5. Shader Combination 6. Conclusions
  • 3. 1. Motivation Problem: Fixed-function pipeline is obsolete Functionality is provided by shader programs Combine functionality  combine programs Goals: Minimize shader permutations Dynamic configuration of combined programs Keep functionality of individual shaders Enable nesting of shader programs Applications Shader-driven rendering engines Emulate orthogonal fixed function pipeline features Dynamic material systems
  • 5. 2. Concept - Overview Modular principle for each shader type: Basically: Dynamic uber-shader construction Exploits static branching to control execution paths Main phases: Decomposition shader into shader handler (next) Preprocessing of shader handler to intermediate shader source Combination of intermediate shaders to a single uber-shader = +
  • 6. 2. Concept - Decomposition Shader functionality is split into handler with predefined semantics
  • 7. 2. Concept - Combination
  • 8. 2. Concept – Decompostion Details Shader: set of shader handler ( SH ) Prototype ( P ) Represents an atomic functionality Assigned to a shader handler: P = prototype(SH) Prototype List ( PL ) Defines explicit order upon prototypes Important for handler combination P & PL Defined by developer in advance Differs for each shader type (vertex, fragment, …)
  • 9. 3. Tagging Shader Source Code Extend shading language grammar (here GLSL) Shader Handler Example: handler [ local | global | optional | explicite | ignore ] hName ( interface iName ) handler local onLighting ( interface context ) { vec3 fragNormal = normalize ( context.us_Frag Normal ); vec3 fragView = normalize ( context.us_Frag View ); vec3 fragLight = normalize ( context.us_Frag Light ); vec3 reflection = normalize (reflect(-phongLight, phongNormal)); float NdotL = max (0.0, dot (fragNormal, fragLight)); float VdotR = dot (fragView, reflection); float VdotRExp = pow ( max (0.0, VdotR), context.us _FrontMaterial.shininess ); context.us_FragColor = context.us _FrontMaterial.ambient * ( gl_LightSource[0].ambient + gl_LightModel.ambient ) + NdotL * gl_LightSource[0].diffuse * context.us _FrontMaterial.diffuse + VdotRExp * context.us _FrontMaterial.specular * gl_LightSource[0].specular ; return ; }
  • 10. 4. Preprocessing Step Transforms tagged source into: Intermediate source code (language specific) Mapping: Shader Handler  Prototype Basically via token substitution: Insert specific interface source code Result is ready for API shading language front-end compiler
  • 11. 5. Shader Combination During Pre-traversal by Shader Management System (SMS) Create priority program list ( PPL ) Create controller for each shader type: Generated controller configured by an invoker table Array of Boolean variables represents activity-state of handler Passed to the controller as uniform shader state During evaluation of a shader program: Activate/deactivate shader handler by modify invoker tables With respect to the handler execution modes foreach prototype P  PL do foreach shader program SP  PPL do foreach shader handler SH  SP do if ( prototype(SH) = P ) do appendIfStatement(SH)
  • 12. 6. Conclusion Summary Combination of shader programs Generic uber-shader construction Parameters to control execution logic Drawbacks No automatic shader decomposition Future Work Resource management for shader state Enable the usage of LoD shader handler Integration into FX formats (CG, Collada,…)
  • 13. Thank You. [email_address] [email_address] :: www.vrs3d.org :: www.hpi.uni-potsdam.de ::
  • 14. Thank You. [email_address] [email_address] :: www.vrs3d.org :: www.hpi.uni-potsdam.de ::
  • 15. 2. Concept – Interfaces Properties Shared state between shader handler Depend on shader type Must be defined in advance Deposited as source code in specific shading language GLSL Examples struct us_VertContext { vec4 us_Position; vec3 us_Normal; float us_PointSize; vec4 us_ClipVertex; } vertContext; Vertex Handler Interface struct us_FragContext { vec4 us_FragColor; vec3 us_FragNormal; vec3 us_FragView; vec3 us_FragLight; gl_MaterialParameters us_FrontMaterial; float us_FragDepth; } fragContext; Fragment Handler Interface
  • 16. 2. Concept – Execution Modes Control shader handler execution Propagate active state of program  Activate handler according to execution modes Can be configured at runtime for each handler Handler execution modes: Local : handler is invoked only if the program object is active Global : handler will always be invoked Optional : invoke handler if no handler of resp. prototype is active Explicit: all other handler of this prototype will be disabled Ignore : handler will never be invoked
  • 17. 2. Concept – Execution Modes Example Scenegraph