1 of 14

WebGL and Why You Should Target It

Khronos Developer Day, GDC 2018

2 of 14

THREE.js Demos

3 of 14

WebGL Fundamentals

  • Built-in 3D graphics API in browsers
  • Based on industry-standard OpenGL ES APIs
  • Implement on one device, runs everywhere
  • No installation step – completely frictionless
    • Get lots of eyeballs on your games
  • Many options for deployment
    • Web pages
    • PWAs
    • Electron/Cordova
    • Native apps using WebView

4 of 14

WebGL Fundamentals (continued)

  • High API quality
    • Conformance suite: 2.0.0 contains 340,000 test cases
    • Workarounds for numerous driver bugs
  • WebGL 1.0 implements OpenGL ES 2.0 APIs
    • Supported on Firefox, Chrome, Edge, Safari
    • Support rate: 98% [*]
  • WebGL 2.0 implements OpenGL ES 3.0 APIs
    • Currently supported on Firefox, Chrome
    • Edge and Safari intend to implement it
    • Support rate: 41% [*] and increasing

[*] Data from https://webglstats.com/

5 of 14

WebGL 2.0 Features

3D textures Compressed textures Texture storage Seamless cubemaps

NPOT textures Float textures Integer textures sRGB textures

Instanced rendering Transform feedback Multiple render targets

Query objects Sync objects Sampler objects

Uniform blocks Vertex array objects Integer vertex attributes

GLSL ES 3.0 shaders

6 of 14

WebGL + glTF

  • glTF: a royalty-free specification for the efficient transmission and loading of 3D scenes and models by applications
    • https://www.khronos.org/gltf/
  • WebGL + glTF: streamlines authoring workflows and enables interoperable use of content across the industry
  • Two of the major WebGL libs, Three.js and Babylon.js (among others) support glTF 2.0

7 of 14

WebGL + WebAssembly + Emscripten

  1. WebAssembly (wasm): a new portable, size- and load-time-efficient format suitable for compilation to the web
  2. WebGL + WebAssembly: almost native graphics apps on the web
  3. Emscripten: source-to-source compiler that produces a subset of JavaScript (asm.js) or WebAssembly
    • Easily brings existing (C++) code bases to the web

8 of 14

A Small Engine That Can Be Compiled with WASM

9 of 14

Unity and Unreal Engine Support WASM Export

10 of 14

PlayCanvas: Another Game Engine for the Web

11 of 14

Transform Feedback / Particle System Demos

12 of 14

Visualization and Authoring

13 of 14

Advanced Rendering

14 of 14

Useful Links