Due to the wide range of devices this game will be available on I have written many different shaders which can be swapped in/out at run-time by changing the graphics settings in the options menu. The lighting used for the mobile version of the game is quite basic to keep the overhead low. It consists of three separate components:
- Ambient Lighting: Controlled by two variables [color/intensity] ambient lighting is applied equally to all polygons within the scene. This is the most basic form of shading, which attempts to simulate global illumination. In the real world objects are never completely black, they receive indirect light bounced from other nearby objects. Ambient lighting approximates this in a crude way by acting as the minimum light component received by all surfaces.
- Diffuse Lighting: This is where the real shading comes into play. For the mobile version of Skyway a directional light is used, which defines color, intensity, and direction. A directional light simulates a light source positioned at a great distance such as the Sun. Due to the relative distance between objects being so small in comparison to their distance from the light source the object position can be disregarded in the lighting equation when using directional light, meaning that the diffuse shading is based purely on the surface angle.
- Color Map: A two dimensional image is then mapped onto the object to define the texture of the surface. This is multiplied by the sum of the lighting equation to get the final image drawn to the screen.
In conclusion, the mobile shading algorithm uses a basic ambient light with no position or direction, to control the model's ambient component, as well as a directional light, which has no position, but only direction, to modulate the diffuse light of each surface.