A WebGL primer



WebGL enables rendering of interactive 3D graphics within any compatible web browser without the use of plug-ins. However, the level of the expected performance varies between different browser types/brands and their versions. WebGL was developed as a cross-platform web standard for a low-level 3D graphics API based on OpenGL ES. Published WebGL code is a combination of JavaScript and HTML5 and is dependent on browsers to open and play. It cannot be compiled from WebGL to a stand-alone application. Display of WebGL animation is executed on a computer's graphics processing unit (GPU) and therefore the experience will vary from device to device. We therefore recommend to address targeted devices in the tech specs before we start building so we can maximize the graphics quality to the chosen systems. The PlayCanvas Editor is the most advanced WebGL authoring environment available and we recommend that as the development platform for WebGL projects. WebGL that you want to be accessible on mobile devices will have some restrictions due to processing power and therefore do not enable us to use the full suite of effects, materials and shaders available in PlayCanvas.

Conversion of existing 3D animation to WebGL

Hi-res 3D animation built using Unity and C# programing language which are one of the industry standard tools for 3D animation. Unity's does allow for conversion. WebGL build option allows Unity to convert the .NET/C# game code to C++ which again is converted to JavaScript / HTML5 technologies that can be published as WebGL. But, there are a couple of reasons why we do not recommend going this route even if it would be a quicker path to published WebGL from existing work.

One reason is that a Unity to WebGL conversion does not produce clean optimized code. Another reason we do not recommend this route is that Unity WebGL content is not currently supported on mobile devices. It may still work, especially on high-end devices, but many current devices are not powerful enough and don’t have enough memory to support Unity WebGL content in a satisfactory manner. Also consider that when the hi-res versions were created the size of the scenes might not have mattered that much for an application running on a top-specked gaming machine but online through a browser it would take ages to load.

Versions: There are WebGL 1.0 and 2.0. We recommend version 1.0 since 2.0 has limited support on mobile devices.