Honeycomb Renderscript Detailed [The Balls]

February 9, 2011

Views: 598

The following is a nutshelled rundown of what Renderscript is, and what it does. Renderscript is a brand new feature that was introduced, but not fully explained during the official Android 3.0 Honeycomb event. What Renderscript is involved in is graphics. Renderscript is a new API that'll deal with high-performance 3D rendering as well as compute operations. What Renderscript aims to do is to bring a higher performance, lower level API to developers who, in a blaze of glory, want to max out the performance of their applications. These developers must be comfortable working "close to the metal" if they're going to use this new API, but in doing so, they'll receive three tools: a developer friendly compute API similar to CUDA, a simple API for rendering 3D on top of hardware acceleration, and a familiar language for use in C99.

How Renderscript has already been used is in things as simple as the live wallpapers shipped with Honeycomb and as complicated as the YouTube and Book apps which are, as I'm sure you've seen or will see soon, lovely to look at. The greatness inherent in Renderscript is the same greatness that makes Google say "close to the metal" as to attain the performance gain you'll be gaining, you'll be executing native code on the device. The great thing about this whole situation is though, unlike NDK that exist now, the final product works cross-platform.

The development language for Renderscript is compiled to an every-device intermediate format while you're developing before it is placed into the application package - this language is C99 with extensions. Unlike other situations that are cross platform and are weakened by this plus, when your new app is run, the scripts will be compiled to a machine code and are made to be optimized for whichever device they're running on.

With Renderscript, simple scripts will be able to run on a GPU as a compute workload when capable hardware is available for use. When more complex scripts come through, they'll be able to run on the CPU. In addition to this, note that the CPU will serve as a fallback incase a suitable GPU or other accelerator is not available - these scripts will still be able to run on the CPU. Basically, simple scripts will be able to run in many more places in the future than they do now, but for now, CPU resources are leveraged and the work is moved to as many CPUs are in the device and able to be used.

[youtube uQ5NumRfHN4]

Above you'll see a demonstration video created by Android Developers to show the power of Renderscript. In the video, caught from some Android tablet running Android 3.0 Honeycomb (we'll take a wild guess and say it's the Motorola XOOM), 900 individual particles are simulated and rendered. This is a brute force physics simulation activated by the pushing of one of the balls, then continued by the activation of gravity from the right side of the video frame. This show is put on so gracefully because the compute script takes advantage of both cores in the device automatically, running each frame with great smoothness.

Renderscript's origins go all the way back to live wallpapers and the 3D application launcher included with Eclair. Renderscript provides a new runtime for continuously rendering scenes which sits right on top of hardware acceleration and uses the developers scripts to give custom functionality to the controlling Dalvik code. These controlling codes will be sending commands at a course level, commands like "move the list" and "turn the page," these commands determined by the scripts provided by the developer so that the process can be fully customizable.

In the creation of Android 3.0 Honeycomb, Android Developers have moved from GL ES 1.1 over to 2.0 as the renderer for Renderscript. With this update, elements have been added such as 3D model loading, programmable shader support, and more efficient allocation management. This new compiler is based on LLVM and is beating down efficiency shown in Android versions 2.1 through 2.3 - and what's the very best thing about this whole situation?

Renderscript API and tools are now public.

Soon the developers at Android will be providing us with more technical information and some sweet sample code. Until then, enjoy these weirdly human-proportioned Androids made by the developers, shown here running on one of their internal test apps. As the application implements a single scene-graph, this graph demonstrates recursive script-to-script calling. Both Androids are loaded straight from an A3D file (an on-device file format for storing Renderscript objects) made in Maya and translated from a Collada file. Fun!

[via Android Developers]

Tags: , , , , ,