Clustered Shading Android* Sample

Published: 07/30/2014, Last Updated: 07/30/2014

This Android sample implements and compares several techniques for shading a scene with many lights. The full sample source code is available on GitHub. It can also be downloaded using this direct link. The most efficient method implemented in the sample is clustered shading, which is described in this paper. This sample is Android port of the more advanced windows-only version which is available here.

The sample implements the following methods:

  • Forward rendering. In this mode, the scene is rendered as usual and the fragment shader goes through the list of all lights, applying appropriate ones to every fragment being shaded.
  • Deferred shading. In this method, the scene is first rendered to G-buffer, and lighting is computed as post-processing effect. The fragment shader goes though the entire list of lights, for every fragment.
  • Quad. This is also deferred shading technique, but in contrast to previous mode, in this method every light is rendered on the screen as quad, and lighting contribution is accumulated in the back buffer.
  • Clustered. In this mode, all the lights are first clustered into the 3-dimensional grid. The scene is then rasterized. The fragment shader first finds which cell of the grid the current fragment falls into, and then goes through the list of lights assigned to that tile, accumulating contributions from every light.
  • CS tile. This technique combines deferred shading and light clustering. Lighting is computed by a compute shader, which applies contribution from every light. Note that this technique only works if OpenGLES 3.1 is available.

The following picture shows the image generated by the sample: 

The sample folder contains two visual studio solutions:

  • ClusteredShadingWindows.sln is Windows solution, which can be built as normal windows application
  • ClusteredShadingAndroid.sln is Android solution. To build it, you will need Visual GDB Visual Studio plugin. It can be downloaded from http://visualgdb.com

If you do not want to install visual GDB, you can follow the instructions in readme.txt file located in the sample folder to build it manually.

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804