GDC 2015 The latest version of the Unity cross-platform game development toolkit is helping to bring advanced 3D graphics and gaming to the web, albeit in baby steps.
Unity 5, released to coincide with the Game Developers Conference taking place in San Francisco this week, includes a preview version of an exporter for WebGL, an evolving standard for browser-based 3D graphics.
"The result is native-like performance in desktop browsers without the need for plugins," Mozilla said in a blog post.
Mozilla has shown off native-like 3D games running in its Firefox browser before, but past demos were the result of lots of custom coding. With Unity's new export feature, game devs can repurpose the same lightweight graphics and code they use for their mobile games to run inside the browser.
The exporter takes advantage of a pair of cross-compilation tools, including Mozilla-developed Emscripten and Unity's own IL2CPP.
First, IL2CPP takes all of a game's scripts and converts them from .Net assemblies (Unity's internal code format) to C++ code. Emscripten then takes that output and cross-compiles the C++ code to asm.js.
"Teleporter," a demo of Unity-based 3D graphics displayed via the forthcoming WebGL 2
Forward to WebGL 2
While the demos run impressively well today, however, WebGL remains a work in progress. WebGL 2, the second generation of the tech, is still under development by the Khronos Group and was unveiled for the first time at GDC on Tuesday.
Where WebGL 1.0 was based on version 2.0 of OpenGL ES – the subset of OpenGL that's tailored to run on embedded systems – the second version of the spec is based on OpenGL ES 3.0 and includes a number of rendering improvements.
"For example, while WebGL 1 only required support for being able to render using 8 textures at a time, WebGL 2 raises this minimum limit to 32," Mozilla explained in a blog post. "WebGL 2 also includes requirements for higher precision in fragment shaders, adds support for features such as occlusion queries and geometry instancing, and introduces developer-controlled access to antialiasing, multiple render targets, and more."
For now, though, Unity 5 – including the preview WebGL exporter that outputs WebGL 1 code – is available for download globally as of Tuesday. The Professional version can be had for a subscription fee of $75 per month or $1,500 for a perpetual license, while the more limited Personal edition is available free of charge. ®
An earlier version of this story said Unity 5's WebGL export tool outputs WebGL 2, which isn't right. Although Mozilla is working with Unity on WebGL 2 support – which is what you see in the "Teleporter" demo video, above – Unity 5 currently outputs WebGL 1, and that's what the playable demos are based on.
"We have captioned the video to reiterate the point we made in the post, that Teleporter showcases WebGL 2. Developers can try out AAA for Awesome and Dead Trigger 2 as examples of what they can do with Unity and WebGL 1 right now," Martin Best, Mozilla's director of platform management, told El Reg.