SlideShare a Scribd company logo
MODERN & INTERACTIVE SCIENTIFIC VISUALIZATION
USING SHADER BASED RENDERING
Nicolas P. Rougier
Luke Campagola - Almar Klein - Cyrille Rossant - Eric Larson
X.Org Developer Conference 2014
Bordeaux, October 8–10
A Bit of Context
The Python Scientific Stack
→ Python, modern computing script language
→ IPython, an advanced Python shell
→ Numpy, powerful numerical arrays objects.
→ Scipy, high-level data processing routines.
→ Matplotlib, 2-D visualization plots
Python
Matplotlib
NumPy
SciPy
IPython
IP[y]:
SymPy
Σ ∫dx
[1
00
1]
SciKits
Versatile, beautiful but... slow !
Matplotlib is a python plotting library, primarily for 2-D plotting, but with some 3-D support,
which produces publication-quality figures in a variety of hardcopy formats and interactive
environments across platforms.
→ Antigrain geometry, High Fidelity 2D Graphics (www.antigrain.com)
→ Ten Simple Rules for Better Figures, Nicolas P. Rougier, Michael Droettboom, Philip E.
Bourne PLoS Computational Biology, Vol. 10, No. 9.
What about OpenGL ?
Powerful, fast but... ugly !
• No decent anti-aliasing
• Only two image filters
• No native text handling
• No markers, no arrows
• No paths, no curves
Proprietary solution
→ Mark Kilgard and Jeff Bolz, GPU-accelerated Path Rendering, ACM Transactions on
Graphics (Proceedings of SIGGRAPH Asia 2012), vol. 31, Num. 6, (2012).
→ OpenVG API, Standard for Vector Graphics Acceleration, Khronos group.
But this can also be fixed freely !
Python/OpenGL frameworks
Rendering framework
• Pyglet
www.pyglet.org
• PyOpenGL
pyopengl.sourceforge.net
• Nodebox for OpenGL
www.cityinabottle.org/nodebox
• PyProcessing
code.google.com/p/pyprocessing
Visualization framework
• mayavi 2 (Enthought)
github.com/enthought/mayavi
• VTK (Kitware)
www.vtk.org
• galry (Cyrille Rossant)
rossant.github.io/galry/
• visvis (Almar Klein)
code.google.com/p/visvis/
• glumpy (Nicolas Rougier)
code.google.com/p/glumpy/
• pyqtgraph (Luke Campagnola)
www.pyqtgraph.org
OpenGL history
ES 1.0 ES 1.1 ES 3.0ES 2.0
1992
1.0
1997
1.1
1998
1.2
2001
1.3
2002
1.4
2003
1.5
2004
2.0
2006
2.1
2008
3.0
2009
3.2
2010
4.1
2011
4.2
2012
4.3
1993
1994
1995
1996
1999
2000
2005
2007
3.1 4.0
3.3
Fixed pipeline
(no shaders)
Programmable pipeline
(vertex/fragment/geometry shaders)
Legacy OpenGL Core Profile
(deprecation model)
Doom (1993) Rage (2011)
OpenGL 4.2 pipeline overview
(could have been worse...)
Around 2000 constants and 1000 functions.
OpenGL ES 2.0 pipeline overview
(openglinsights.com)
Around 350 constants and 150 functions.
Pipeline overview
Data centered
CPU(python)
GPU(shaders)
Raw
Data
Baked
Data
Transformed
Data
Rendered
Data
Critical parts are the baking process and the transfer to GPU memory.
Baking process
Ideal case: no baking
Interpolation, colorization, leveling,
gridding, scaling, lighting, aliasing,
rendering entirely done on GPU.
Hard case: baking depends on transformation
Transparency implies lot of CPU
processing (sorting) or multi-pass
rendering.
Where do we start ?
Scalable Vector Graphics (SVG) 2
Text
Paths
Basic shapes
Painting: Filling, Stroking and Marker Symbols
Clipping, Masking and Compositing
Filter Effects
...
Text rendering
Different techniques
Bitmap, stroke, texture, sdf, vector...
→ Nicolas P. Rougier, Higher Quality 2D Text Rendering, Journal of Computer Graphics
Techniques (JCGT), vol. 2, no. 1, 50-64, 2013.
Higher quality text rendering
Vertical vs Horizontal hinting
No hinting Native hinting Auto hinting Vertical hinting
→ Maxim Shemarev, Texts Rasterization Exposures, An attempt to improve text
rasterization algorithms, 2007
Implementation (github.com/rougier/freetype-gl)
• Subpixel positioning & kerning
• Per pixel gamma correction
• Signed Distance Fields
Dashed stroked polyline
GL line width (fixed pipeline)
• Limited in thickness
• No control over joins and caps
• Deprecated & ugly
GL Stipple (fixed pipeline)
• Limited in pattern
• No control over dash caps
• Deprecated & ugly
Higher quality dashed stroked polyline
Shader based approach
A new method for rendering arbitrary dash patterns along any continuous polyline (smooth
or broken). The proposed method does not tessellate individual dash patterns and allows for
fast and accurate rendering of any user-defined dash pattern and caps
→ Nicolas P. Rougier, Shader-Based Antialiased, Dashed, Stroked Polylines, Journal of
Computer Graphics Techniques (JCGT), vol. 2, no. 2, 105–121, 2013.
Image interpolation & filters
OpenGL offers only nearest and linear filters while much more are needed for scientific
visualization (Hanning, Hamming, Hermite, Kaiser, Quadric, Bicubic, CatRom, Mitchell,
Spline16, Spline36, Gaussian, Bessel, Sinc, Lanczos, Blackman, etc.)
→ Kevin Bjorke, High-Quality Filtering in GPU gems 2 : programming techniques for
high-performance graphics and general-purpose computation / edited by Matt Pharr ;
Randima Fernando (2007).
Grids, markers and arrows
Point based approach
A new method for drawing grids, markers, and arrows using implicit functions such that it is
possible draw pixel-perfect antialiased objects with very good performances.
→ Nicolas P. Rougier, Shader Based Antialiased 2D Grids, Markers, and Arrows, Journal of
Computer Graphics Techniques (JCGT), to appear, 2014.
Still lot of problems ahead...
...but work is in progress
Shader composition
How to define a shader format that allow easy composition/templating ?
Level of details
How to set automatic level of details ?
Very big data
How to render data that doesn’t even fit into GPU memory ?
Complex data transformation
How to handle user-supplied exotic transformation ?
From DesktopGL to WebGL
How to render in browser from a python session ?
...
Conclusion
We do not have to (always) trade quality for speed
10,000 pts - 403 FPS 100,000 pts - 140 FPS 1,000,000 pts - 40 FPS 10,000,000 pts - 1.5 FPS
AntiGrain Geometry
(matplotlib agg backend)
OpenGL AntiGrain
(using dedicated shaders)
AntiGrain Geometry
(matplotlib agg backend)
OpenGL AntiGrain
(using dedicated shaders)
Informations & links
The code is spread in several projects but should be soon integrated in the master vispy
project.
Projects page
• vispy.org
• vispy.org/gallery.html
• glumpy.github.io
• glumpy.github.io/gallery.html
Code repositories
• github.com/vispy/vispy
• github.com/glumpy/glumpy
• github.com/rougier/gl-agg
• github.com/rougier/freetype-gl
Demo pages
• Markers: https://www.shadertoy.com/view/XsXXDX
• Arrows: https://www.shadertoy.com/view/ldlSWj
• Transverse Mercator grid: https://www.shadertoy.com/view/lsSXzm
• Cartesian grid: https://www.shadertoy.com/view/MdSXRm
• Polar grid: https://www.shadertoy.com/view/MsBSRm
Modern OpenGL scientific visualization

More Related Content

PPTX
3D Graphics & Rendering in Computer Graphics
PPT
Devices that output Hardcopy
PPTX
Graphics Output Hardware Devices
PPTX
PDF
COLOR CRT MONITORS IN COMPUTER GRAPHICS
PPTX
A complete course in Program Design using Pseudocode
PPT
Graphics software
PPT
Input devices in computer graphics
3D Graphics & Rendering in Computer Graphics
Devices that output Hardcopy
Graphics Output Hardware Devices
COLOR CRT MONITORS IN COMPUTER GRAPHICS
A complete course in Program Design using Pseudocode
Graphics software
Input devices in computer graphics

What's hot (20)

PPTX
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
PPTX
Naive bayesian classification
PPTX
BRESENHAM’S LINE DRAWING ALGORITHM
PPTX
Character generation techniques
PPTX
Computer animation Computer Graphics
PPTX
Concept of basic illumination model
PPTX
Spline representations
PPTX
Cocomo model
PPT
Parallel computing with Gpu
PPT
Computer graphics mini project on bellman-ford algorithm
PDF
Graphics a buffer
PDF
Introduction to systems programming
PDF
Collision Detection an Overview
PDF
Computer graphics curves and surfaces (1)
PPT
Line clipping
PDF
Java Guessing Game Number Tutorial
PPT
Multimedia color in image and video
PPTX
TUTORIAL ON PHOTOSHOP
PPTX
Human computer interaction -Input output channel
PPTX
Overview of Computer Graphics
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
Naive bayesian classification
BRESENHAM’S LINE DRAWING ALGORITHM
Character generation techniques
Computer animation Computer Graphics
Concept of basic illumination model
Spline representations
Cocomo model
Parallel computing with Gpu
Computer graphics mini project on bellman-ford algorithm
Graphics a buffer
Introduction to systems programming
Collision Detection an Overview
Computer graphics curves and surfaces (1)
Line clipping
Java Guessing Game Number Tutorial
Multimedia color in image and video
TUTORIAL ON PHOTOSHOP
Human computer interaction -Input output channel
Overview of Computer Graphics
Ad

Viewers also liked (10)

PPT
Advanced scientific visualization
PDF
GPU-accelerated Path Rendering
PDF
簡単!OpenGL ES 2.0フラグメントシェーダー
PDF
FiltersでGLSLを楽しく学んじゃおう!
PPTX
LINE 2016 エンジニアインターン 03
PPTX
LINE 2016 エンジニアインターン 02
PPTX
LINE 2016 エンジニアインターン 01
PDF
Intern2015 01
PPTX
Introduction to scientific visualization
PPTX
10 Tips for Better Visualization of Scientific Data
Advanced scientific visualization
GPU-accelerated Path Rendering
簡単!OpenGL ES 2.0フラグメントシェーダー
FiltersでGLSLを楽しく学んじゃおう!
LINE 2016 エンジニアインターン 03
LINE 2016 エンジニアインターン 02
LINE 2016 エンジニアインターン 01
Intern2015 01
Introduction to scientific visualization
10 Tips for Better Visualization of Scientific Data
Ad

Similar to Modern OpenGL scientific visualization (20)

PDF
Portfolio
PDF
Dataset creation for Deep Learning-based Geometric Computer Vision problems
PPT
GTC 2012: GPU-Accelerated Path Rendering
PPTX
Artificial Intelligence in practice - Gerbert Kaandorp - Codemotion Amsterdam...
PDF
Hardware Accelerated Machine Learning Solution for Detecting Fraud and Money ...
PPTX
Graphics pipelining
PDF
Python's slippy path and Tao of thick Pandas: give my data, Rrrrr...
PPTX
cityscapes Semantic Segmentation using FCN, U Net and U Net++.pptx
PDF
Introduction to Software Defined Visualization (SDVis)
PDF
Scratch to Supercomputers: Bottoms-up Build of Large-scale Computational Lens...
PPTX
Presentation NBMP and PCC
PPT
Topic 1 Introduction to Computer Graphics.ppt
PDF
ScaleGraph - A High-Performance Library for Billion-Scale Graph Analytics
PDF
Resume-Aditya Parkhi NCSU_MSCS
ODP
Vips 4mar09e
PPT
Marek Suplata Projects
PPTX
pydataPointCloud.pptx
PPTX
Data-Centric Parallel Programming
PDF
IRJET- 3D Object Recognition of Car Image Detection
PDF
Machine Learning with JavaScript
Portfolio
Dataset creation for Deep Learning-based Geometric Computer Vision problems
GTC 2012: GPU-Accelerated Path Rendering
Artificial Intelligence in practice - Gerbert Kaandorp - Codemotion Amsterdam...
Hardware Accelerated Machine Learning Solution for Detecting Fraud and Money ...
Graphics pipelining
Python's slippy path and Tao of thick Pandas: give my data, Rrrrr...
cityscapes Semantic Segmentation using FCN, U Net and U Net++.pptx
Introduction to Software Defined Visualization (SDVis)
Scratch to Supercomputers: Bottoms-up Build of Large-scale Computational Lens...
Presentation NBMP and PCC
Topic 1 Introduction to Computer Graphics.ppt
ScaleGraph - A High-Performance Library for Billion-Scale Graph Analytics
Resume-Aditya Parkhi NCSU_MSCS
Vips 4mar09e
Marek Suplata Projects
pydataPointCloud.pptx
Data-Centric Parallel Programming
IRJET- 3D Object Recognition of Car Image Detection
Machine Learning with JavaScript

More from Nicolas Rougier (11)

PDF
The Art of Braincrafting
PDF
Neural fields, a cognitive approach
PDF
SIGGRAPH 2018 - Digital typography
PDF
Machine learning
PDF
Open science
PDF
On ne voit que ce que l’on regarde (French)
PDF
Cybercriminalité (French)
PDF
Where is my mind?
PDF
Scientific visualization
PDF
ReScience
PDF
One critic, two actors, one decision
The Art of Braincrafting
Neural fields, a cognitive approach
SIGGRAPH 2018 - Digital typography
Machine learning
Open science
On ne voit que ce que l’on regarde (French)
Cybercriminalité (French)
Where is my mind?
Scientific visualization
ReScience
One critic, two actors, one decision

Recently uploaded (20)

PDF
IFIT3 RNA-binding activity primores influenza A viruz infection and translati...
PPTX
EPIDURAL ANESTHESIA ANATOMY AND PHYSIOLOGY.pptx
PPTX
cpcsea ppt.pptxssssssssssssssjjdjdndndddd
PPTX
Taita Taveta Laboratory Technician Workshop Presentation.pptx
DOCX
Q1_LE_Mathematics 8_Lesson 5_Week 5.docx
PPTX
ognitive-behavioral therapy, mindfulness-based approaches, coping skills trai...
PDF
. Radiology Case Scenariosssssssssssssss
PPTX
2. Earth - The Living Planet Module 2ELS
PDF
Unveiling a 36 billion solar mass black hole at the centre of the Cosmic Hors...
PPTX
SCIENCE10 Q1 5 WK8 Evidence Supporting Plate Movement.pptx
PPTX
famous lake in india and its disturibution and importance
PDF
Phytochemical Investigation of Miliusa longipes.pdf
PDF
Mastering Bioreactors and Media Sterilization: A Complete Guide to Sterile Fe...
PPT
protein biochemistry.ppt for university classes
PPTX
The KM-GBF monitoring framework – status & key messages.pptx
PDF
CAPERS-LRD-z9:AGas-enshroudedLittleRedDotHostingaBroad-lineActive GalacticNuc...
PDF
Formation of Supersonic Turbulence in the Primordial Star-forming Cloud
PPTX
Derivatives of integument scales, beaks, horns,.pptx
PPTX
DRUG THERAPY FOR SHOCK gjjjgfhhhhh.pptx.
PPTX
Vitamins & Minerals: Complete Guide to Functions, Food Sources, Deficiency Si...
IFIT3 RNA-binding activity primores influenza A viruz infection and translati...
EPIDURAL ANESTHESIA ANATOMY AND PHYSIOLOGY.pptx
cpcsea ppt.pptxssssssssssssssjjdjdndndddd
Taita Taveta Laboratory Technician Workshop Presentation.pptx
Q1_LE_Mathematics 8_Lesson 5_Week 5.docx
ognitive-behavioral therapy, mindfulness-based approaches, coping skills trai...
. Radiology Case Scenariosssssssssssssss
2. Earth - The Living Planet Module 2ELS
Unveiling a 36 billion solar mass black hole at the centre of the Cosmic Hors...
SCIENCE10 Q1 5 WK8 Evidence Supporting Plate Movement.pptx
famous lake in india and its disturibution and importance
Phytochemical Investigation of Miliusa longipes.pdf
Mastering Bioreactors and Media Sterilization: A Complete Guide to Sterile Fe...
protein biochemistry.ppt for university classes
The KM-GBF monitoring framework – status & key messages.pptx
CAPERS-LRD-z9:AGas-enshroudedLittleRedDotHostingaBroad-lineActive GalacticNuc...
Formation of Supersonic Turbulence in the Primordial Star-forming Cloud
Derivatives of integument scales, beaks, horns,.pptx
DRUG THERAPY FOR SHOCK gjjjgfhhhhh.pptx.
Vitamins & Minerals: Complete Guide to Functions, Food Sources, Deficiency Si...

Modern OpenGL scientific visualization

  • 1. MODERN & INTERACTIVE SCIENTIFIC VISUALIZATION USING SHADER BASED RENDERING Nicolas P. Rougier Luke Campagola - Almar Klein - Cyrille Rossant - Eric Larson X.Org Developer Conference 2014 Bordeaux, October 8–10
  • 2. A Bit of Context The Python Scientific Stack → Python, modern computing script language → IPython, an advanced Python shell → Numpy, powerful numerical arrays objects. → Scipy, high-level data processing routines. → Matplotlib, 2-D visualization plots Python Matplotlib NumPy SciPy IPython IP[y]: SymPy Σ ∫dx [1 00 1] SciKits Versatile, beautiful but... slow ! Matplotlib is a python plotting library, primarily for 2-D plotting, but with some 3-D support, which produces publication-quality figures in a variety of hardcopy formats and interactive environments across platforms. → Antigrain geometry, High Fidelity 2D Graphics (www.antigrain.com) → Ten Simple Rules for Better Figures, Nicolas P. Rougier, Michael Droettboom, Philip E. Bourne PLoS Computational Biology, Vol. 10, No. 9.
  • 3. What about OpenGL ? Powerful, fast but... ugly ! • No decent anti-aliasing • Only two image filters • No native text handling • No markers, no arrows • No paths, no curves Proprietary solution → Mark Kilgard and Jeff Bolz, GPU-accelerated Path Rendering, ACM Transactions on Graphics (Proceedings of SIGGRAPH Asia 2012), vol. 31, Num. 6, (2012). → OpenVG API, Standard for Vector Graphics Acceleration, Khronos group. But this can also be fixed freely !
  • 4. Python/OpenGL frameworks Rendering framework • Pyglet www.pyglet.org • PyOpenGL pyopengl.sourceforge.net • Nodebox for OpenGL www.cityinabottle.org/nodebox • PyProcessing code.google.com/p/pyprocessing Visualization framework • mayavi 2 (Enthought) github.com/enthought/mayavi • VTK (Kitware) www.vtk.org • galry (Cyrille Rossant) rossant.github.io/galry/ • visvis (Almar Klein) code.google.com/p/visvis/ • glumpy (Nicolas Rougier) code.google.com/p/glumpy/ • pyqtgraph (Luke Campagnola) www.pyqtgraph.org
  • 5. OpenGL history ES 1.0 ES 1.1 ES 3.0ES 2.0 1992 1.0 1997 1.1 1998 1.2 2001 1.3 2002 1.4 2003 1.5 2004 2.0 2006 2.1 2008 3.0 2009 3.2 2010 4.1 2011 4.2 2012 4.3 1993 1994 1995 1996 1999 2000 2005 2007 3.1 4.0 3.3 Fixed pipeline (no shaders) Programmable pipeline (vertex/fragment/geometry shaders) Legacy OpenGL Core Profile (deprecation model) Doom (1993) Rage (2011)
  • 6. OpenGL 4.2 pipeline overview (could have been worse...) Around 2000 constants and 1000 functions.
  • 7. OpenGL ES 2.0 pipeline overview (openglinsights.com) Around 350 constants and 150 functions.
  • 9. Baking process Ideal case: no baking Interpolation, colorization, leveling, gridding, scaling, lighting, aliasing, rendering entirely done on GPU. Hard case: baking depends on transformation Transparency implies lot of CPU processing (sorting) or multi-pass rendering.
  • 10. Where do we start ? Scalable Vector Graphics (SVG) 2 Text Paths Basic shapes Painting: Filling, Stroking and Marker Symbols Clipping, Masking and Compositing Filter Effects ...
  • 11. Text rendering Different techniques Bitmap, stroke, texture, sdf, vector... → Nicolas P. Rougier, Higher Quality 2D Text Rendering, Journal of Computer Graphics Techniques (JCGT), vol. 2, no. 1, 50-64, 2013.
  • 12. Higher quality text rendering Vertical vs Horizontal hinting No hinting Native hinting Auto hinting Vertical hinting → Maxim Shemarev, Texts Rasterization Exposures, An attempt to improve text rasterization algorithms, 2007 Implementation (github.com/rougier/freetype-gl) • Subpixel positioning & kerning • Per pixel gamma correction • Signed Distance Fields
  • 13. Dashed stroked polyline GL line width (fixed pipeline) • Limited in thickness • No control over joins and caps • Deprecated & ugly GL Stipple (fixed pipeline) • Limited in pattern • No control over dash caps • Deprecated & ugly
  • 14. Higher quality dashed stroked polyline Shader based approach A new method for rendering arbitrary dash patterns along any continuous polyline (smooth or broken). The proposed method does not tessellate individual dash patterns and allows for fast and accurate rendering of any user-defined dash pattern and caps → Nicolas P. Rougier, Shader-Based Antialiased, Dashed, Stroked Polylines, Journal of Computer Graphics Techniques (JCGT), vol. 2, no. 2, 105–121, 2013.
  • 15. Image interpolation & filters OpenGL offers only nearest and linear filters while much more are needed for scientific visualization (Hanning, Hamming, Hermite, Kaiser, Quadric, Bicubic, CatRom, Mitchell, Spline16, Spline36, Gaussian, Bessel, Sinc, Lanczos, Blackman, etc.) → Kevin Bjorke, High-Quality Filtering in GPU gems 2 : programming techniques for high-performance graphics and general-purpose computation / edited by Matt Pharr ; Randima Fernando (2007).
  • 16. Grids, markers and arrows Point based approach A new method for drawing grids, markers, and arrows using implicit functions such that it is possible draw pixel-perfect antialiased objects with very good performances. → Nicolas P. Rougier, Shader Based Antialiased 2D Grids, Markers, and Arrows, Journal of Computer Graphics Techniques (JCGT), to appear, 2014.
  • 17. Still lot of problems ahead... ...but work is in progress Shader composition How to define a shader format that allow easy composition/templating ? Level of details How to set automatic level of details ? Very big data How to render data that doesn’t even fit into GPU memory ? Complex data transformation How to handle user-supplied exotic transformation ? From DesktopGL to WebGL How to render in browser from a python session ? ...
  • 18. Conclusion We do not have to (always) trade quality for speed 10,000 pts - 403 FPS 100,000 pts - 140 FPS 1,000,000 pts - 40 FPS 10,000,000 pts - 1.5 FPS AntiGrain Geometry (matplotlib agg backend) OpenGL AntiGrain (using dedicated shaders) AntiGrain Geometry (matplotlib agg backend) OpenGL AntiGrain (using dedicated shaders)
  • 19. Informations & links The code is spread in several projects but should be soon integrated in the master vispy project. Projects page • vispy.org • vispy.org/gallery.html • glumpy.github.io • glumpy.github.io/gallery.html Code repositories • github.com/vispy/vispy • github.com/glumpy/glumpy • github.com/rougier/gl-agg • github.com/rougier/freetype-gl Demo pages • Markers: https://www.shadertoy.com/view/XsXXDX • Arrows: https://www.shadertoy.com/view/ldlSWj • Transverse Mercator grid: https://www.shadertoy.com/view/lsSXzm • Cartesian grid: https://www.shadertoy.com/view/MdSXRm • Polar grid: https://www.shadertoy.com/view/MsBSRm