Advanced Visualisation & Implementation Techniques with Java 1.6, OpenGL & GLSL for Biological Data Visualisation & Analysis Thanasis Theocharidis BSc in Mathematics MSc in Interactive Multimedia MSc in Artificial Intelligence 28th April 2009 (Web site: www.biolayout.org) -1- • Background in Mathematics & Software Engineering, previous roles included producing high-end AI & graphics engines in Java 1.6 & C Games company co-founder (www.dotredgames.com) • Joined Tom’s group in January 2008 back in DPM • Role consisted of taking over the R&D of BioLayout Express 3D • Framework originally started by Anton Enright’s group, Tom and others in Sanger/Human Genome Campus • Work of more than 5 years (non-continuous), originally a 2D-only application • Innovative way of visualisation & data analysis of biological data in both 2D/3D, proof-of-concept fully working • BioLayout framework at that time (version RC1) : • Used obsolete & slow Java 1.4 JVM & syntax • Old-fashioned slow Data Structures • No use of Generics/Templates, hard-to-read code • Slow execution because of all the above • Many-many bugs throughout the framework • Source at 600kb -2- Ongoing Development Stages / Roadmap from January 2008 until now: • Migration from old-fashioned syntax of Java 1.4 to current Java 1.6 standards • Full use of Generics and advanced Data Structures, easier-to-read code, big speed upgrade • Framework Object Oriented (OO) updates, many general libraries added • Graphml generics XML parser for pathway modeling with yEd • Implementation of very fast OpenGL 2D renderer, substituting the old Java2D slow renderer • Full update of both 2D & 3D renderers using hierarchical modeling in display lists (30k+ graphs) • Fixed many problems throughout the framework along with countless feature GUI additions & optimisations, source now at 1.7Mb from original 600Kb • Design & implementation of the BioLayout web site (www.biolayout.org) and officially releasing version 3.0 last year with frequent updates. Online datasets also available through the WebStart technology • Now at Update 6 celebrating 1 year after first release! -3- OpenGL: What the heck is it all about ?!? • Industry-leading Application Programming Interface (API) in C, pioneered by Silicon Graphics, Silicon Valley, in beginning of 1990’s • Hollywood movies graphical effects use it (Pixar, Dreamworks, etc) • Huge usage & push from the games industry (ID Software/Quake 1-2-3/HalfLife, etc) • All major CAD applications for rendering (AutoDesk’s 3D Studio Max, AutoCAD, etc) • Industry standard nowadays, centrally controlled by the Khronos Group • THE standard for OS-independent, graphics hardware acceleration (Windows, Linux, MacOS, Sony Playstation 3, PlayStation Portable, iPhone) -4- OpenGL: What’s under the hood • Usage of mathematical Euclidean 3D Vector Spaces, Matrix Theory & Linear Algebra for 3D graphics (see whiteboard for details, no scary mathematical formulas shown here!) • Usage of homogeneous 4D coordinates for 3D spaces in 4x4 matrices • VERY processor-intensive calculations • Hardware implemented on ASIC (specific tasks) chips for 10x-100x speed increase! • Nowadays graphic chips evolved to generic parallelised CPUs, called GPUs, very complex even compared to recent QuadCore Intel/AMD chips • High-end NVidia graphics cards on team’s Dell Vostros, Geforce Generation 8, have 512Mb Video RAM (VRAM) onboard & 112 parallel microcores. New NVidia Geforce Generation X has 2Gb VRAM & 480 microcores! These cards are termed the ‘current $499 super computers’ -5- OpenGL: A C-based API from the 90’s • C-based, no Object Oriented-ness (OO), old-fashioned C-style coding • Sun finally introduced it to the Java platform at the end of 2005 through their Game Team Group: Java OpenGL (JOGL) • Merges high-end OO Java code with fast industry-standard hardware acceleration in C BioLayout Express 3D uses this API for very impressive results: • The OpenGL 2D renderer achieved a 10x-20x speed increase when replacing Java2D • Both OpenGL 2D/3D renderers highly interactive giving very impressive visual results • Can load HUGE maps compared to Java graphics (currently at 30k+ range) -6- OpenGL: Implementation tricks • 3 main transformations: translate, rotate, scale. See board for simple 2D examples • Matrix Theory fully used underneath (singular, inversed & transposed matrices) • Caveat: Order DOES matter, matrices non-commutative! • M = RTM NOT EQUALS TO: M = TRM • glTranslate() then glRotate() different with: • glRotate() then glTranslate() • Full usage of double Display Lists using Hierarchical Modeling as an extra optimisation technique BioLayout Express 3D uses all the above for user-navigation with the mouse for both 2D/3D renderers -7- BioLayout Express 3D: Presenting & navigating the application (please follow interactive demo) -8- BioLayout Express 3D: Presenting & navigating through the web site (www.biolayout.org) -9- Current & future plans (Roadmap) • OpenGL fast 2D renderer for the plot in the Class Viewer, sample-to-sample graphs (scheduled for Update 7) • Parallelism (grid computing) experiments through custom code (multi-core renderers in Update 6) & GL Shader Language (GLSL) utilising the extreme microparallelism on current graphics cards (watch on-screen demo for a proof-of-concept). Upcoming updates will be fully using the standard • Parallelism becomes THE norm in summer 2009: the Khronos Group new standard, OpenCL, for future generic parallel programming executed on CPU/GPU hardware • January 2010: Sun’s (now Oracle’s) Java 1.7 hits the road. Parallelism again a major milestone for the Java world through hardware-independent implementations -10- Innovative Navigation: Who said Data Analysis with BioLayout Express 3D is not fun ? • Usage of cheap of-the-shelf commercial navigation tools: Nintendo Wii remote controller with BioLayout Express 3D! (please follow interactive demo) -11- Many Thanks: The rest of the BioLayout Express 3D team: Dr. Tom Freeman Dr. Anton Enright Dr. Stjin Van Dongen PhD students for their beta testing time & user insights: Sobia Raza Neil McDerment GLSL implementation insights Michael Kargas Thanks for your time & patience! -12-