Insights From The Blog

The Rise of WebGL with Unity

WebGL is one of those terms that people recognise but struggle to define. It is, quite simply, a JavaScript application programming interface (API) for rendering high-performance interactive 3D and 2D graphics within any compatible web browser without the need to use plug-ins. Fundamentally, WebGL is a cross-platform, royalty-free web standard for a low-level 3D graphics API based on OpenGL ES, exposed to ECMAScript via the HTML5 Canvas element. And that makes it pretty useful for a range of applications.

It used to be that web browsers used the system’s CPU to render content, but lately browsers have adopted support for hardware acceleration, which means web developers can now use a device’s GPU to allow for rendering of complex graphics, making it faster and more convenient than other solutions. WebGL has been declared the “future of the internet”, and on the face of it, it’s easy to understand why, since WebGL doesn’t need plug-ins. However, WebGL is not without its issues; WebGL can have latency problems which will sometimes deter customers who expect fast load times, even though it’s not actually that slow.

Unity has always made great use of WebGL, and is using the emscripten compiler toolchain to cross-compile the Unity runtime code. The Unity’s Documentation Manual has a well-written subheading showing you how to get the most out of using WebGL in your Unity projects, and offers advice on web support as well as technical advice. Here, you can find plenty of information on the best use of both graphics and audio with the WebGL API, and understand how best to optimise the API to use it in your games and apps.

It used to be the case that web designers and teachers created fairly complex Flash applications to use in their interactive learning tools, but while these were great for engaging students and teaching complex subjects in an engaging format, they are now dated, unscalable, and generally unsupported in modern browsers. WebGL has replaced Flash and is used to create intuitive learning tools that can cope with complex graphics and interactions. All in all, WebGL offers a much better solution to the delivery of 2D and 3D graphics.

WebGL has become the logical springboard into the exploration of additional 3D technologies such as WebVR and WebAR. Google, Mozilla, and Microsoft are both all helping define how VR and AR will be part of the future browsing experience, and how WebGL can be a part of that. A key aspect of bringing VR to the web is the level of accessibility that comes along with it. By allowing easy access of VR content through a URL, and therefore giving them the ability to create and distribute content without the need to go through an app store, WebGL hands all manner of users from creators and teachers through to commercial retailers a level of impact never quite felt before. This is still a new world, but it’s quickly gaining in popularity and demand.

While some cite disappointing aspects of WebGL, Unity will continue to use this API to create rich content for all applications.