Table Of ContentCRC Press
Taylor & Francis Group
6000 Broken Sound Parkway NW, Suite 300
Boca Raton, FL 33487-2742
© 2016 by Taylor & Francis Group, LLC
CRC Press is an imprint of Taylor & Francis Group, an Informa business
No claim to original U.S. Government works
Printed on acid-free paper
Version Date: 20150504
International Standard Book Number-13: 978-1-4987-1607-9 (Pack - Book and Ebook)
This book contains information obtained from authentic and highly regarded sources. Reasonable efforts have been made to publish reliable data and information, but
the author and publisher cannot assume responsibility for the validity of all materials or the consequences of their use. The authors and publishers have attempted to
trace the copyright holders of all material reproduced in this publication and apologize to copyright holders if permission to publish in this form has not been obtained.
If any copyright material has not been acknowledged please write and let us know so we may rectify in any future reprint.
Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or utilized in any form by any electronic, mechanical,
or other means, now known or hereafter invented, including photocopying, microfilming, and recording, or in any information storage or retrieval system, without
written permission from the publishers.
For permission to photocopy or use material electronically from this work, please access www.copyright.com (http://www.copyright.com/) or contact the Copyright
Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. CCC is a not-for-profit organization that provides licenses and registration for a
variety of users. For organizations that have been granted a photocopy license by the CCC, a separate system of payment has been arranged.
Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for identification and explanation without intent to
infringe.
Library of Congress Cataloging‑in‑Publication Data
WebGL insights / editor, Patrick Cozzi.
pages cm
Includes bibliographical references.
ISBN 978-1-4987-1607-9 (alk. paper)
1. Computer graphics--Computer programs. 2. WebGL (Computer program language) I. Cozzi, Patrick.
T386.W43W43 2016
006.6’633--dc23 2015011022
Visit the Taylor & Francis Web site at
http://www.taylorandfrancis.com
and the CRC Press Web site at
http://www.crcpress.com
For Liz, Petey, and the Captain
Contents
Foreword xi
Preface xiii
Acknowledgments xv
Website xvii
Tips xix
Section I WebGL Implementations
1 ANGLE: A Desktop Foundation for WebGL 3
Nicolas Capens and Shannon Woods
2 Mozilla’s Implementation of WebGL 17
Benoit Jacob, Jeff Gilbert, and Vladimir Vukicevic
3 Continuous Testing of Chrome’s WebGL Implementation 31
Kenneth Russell, Zhenyao Mo, and Brandon Jones
Section II Moving to WebGL
4 Getting Serious with JavaScript 49
Matthew Amato and Kevin Ring
vii
5 Emscripten and WebGL 71
Nick Desaulniers
6 Data Visualization with WebGL: From Python to JavaScript 89
Cyrille Rossant and Almar Klein
7 Teaching an Introductory Computer Graphics Course
with WebGL 107
Edward Angel and Dave Shreiner
Section III Mobile
8 Bug-Free and Fast Mobile WebGL 123
Olli Etuaho
Section IV Engine Design
9 WebGL Engine Design in Babylon.js 141
David Catuhe
10 Rendering Optimizations in the Turbulenz Engine 157
David Galeano
11 Performance and Rendering Algorithms in Blend4Web 173
Alexander Kovelenov, Evgeny Rodygin, and Ivan Lyubovnikov
12 Sketchfab Material Pipeline: From File Variations to Shader
Generation 193
Cedric Pinson and Paul Cheyrou-Lagrèze
13 glslify: A Module System for GLSL 209
Hugh Kennedy, Mikola Lysenko, Matt DesLauriers, and Chris Dickinson
14 Budgeting Frame Time 223
Philip Rideout
Section V Rendering
15 Deferred Shading in Luma 235
Nicholas Brancaccio
viii Contents
16 HDR Image-Based Lighting on the Web 253
Jeff Russell
17 Real-Time Volumetric Lighting for WebGL 261
Muhammad Mobeen Movania and Feng Lin
18 Terrain Geometry—LOD Adapting Concentric Rings 279
Florian Bösch
Section VI Visualization
19 Data Visualization Techniques with WebGL 297
Nicolas Belmonte
20 hare3d—Rendering Large Models in the Browser 317
Christian Stein, Max Limper, Maik Thöner, and Johannes Behr
21 The BrainBrowser Surface Viewer: WebGL-Based Neurological
Data Visualization 333
Tarek Sherif
Section VII Interaction
22 Usability of WebGL Applications 351
Jacek Jankowski
23 Designing Cameras for WebGL Applications 365
Diego Cantor-Rivera and Kamyar Abhari
About the Contributors 387
Contents ix