Game Development Reference
In-Depth Information
Lighting
To finish up our 3D primer, let's take a quick look at how real-time lighting is
achieved. We won't dwell on the mathematics of it all, since Marmalade mostly takes
care of this for us, so instead we'll just explain the different types of lighting we can
take advantage of.
Each of the lighting types we are about to discuss can be enabled or disabled
whenever you want. Disabling different lighting types can yield faster render times.
Emissive lighting
The simplest type of lighting Marmalade provides is emissive lighting , which is
little more than the amount of color that a rendered polygon will naturally have.
The emissive lighting color is provided by the CIwMaterial instance that is set
when rendering the polygon.
Emissive lighting is useful if you want to draw polygons in a single flat color, but
normally we want a bit more flexibility than that, so we might set a color stream
instead, or use one of the other forms of lighting.
Ambient lighting
Ambient lighting provides the background level of light in our scene, such as the
light which might be provided by the Sun.
Without ambient lighting, any polygon that is not facing a light source directly
would have very little light applied to it and so would appear black. Normally this
is not very desirable, so we can use ambient lighting to provide a base level of color
and brightness to our polygons.
In Marmalade, we set a global ambient lighting term as an RGB color. The
CIwMaterial instance used when rendering also has an ambient light value that is
combined with the global ambient light. If the material ambient light is set to bright
white, the polygon will be rendered with the full amount of the global ambient light.
If the global ambient lighting is disabled, the material ambient color is used
directly to control the color of the rendered polygons. This provides an easy way of
brightening or darkening a model at rendering time.
 
Search WWH ::




Custom Search