Draw order: When a scene is rendered, objects are drawn into that scene one at a time. Depending on how an engine is set up, it may also draw certain types of objects before or after other objects. If the objects are drawn in the order they were added to the scene, it’s possible that you will see alpha draw order issues. This happens when an object with partial transparency is drawn sooner than objects that lie behind it. During drawing, if an object is partially occluded, that part is not drawn. The check for occlusion does not check the opacity of all of the occluding objects; it’s either occluded or not. To ensure that objects are drawn behind transparent objects, the semitransparent objects are drawn last. In some engines, the scene is parsed at start time in order to determine locations of semitransparent objects, so that it knows the order in which to draw them, thereby avoiding draw-order issues. The downside of this method is that draw order may be adversely affected when a semitransparent object is animated out of its starting position. In engines that draw objects into the scene in a predictable order, you can have fun with draw order, by creating an x-ray machine. In other engines, you may be able to use special shaders to achieve the same effect. Occlusion culling: Occlusion culling is another means of increasing frame rate by not rendering certain objects in a scene. With automatic occlusion culling, data is created with the scene objects, in order to be able to check large blocks of objects. In the example where towns or settlements are located in box canyons, you know that when you are in one canyon, the others by definition will be occluded. Rather than having to check objects one at a time to see if they are visible from a particular vantage point, the entire contents of the town can be skipped. Good game design can make occlusion culling possible and help to increase frame rate. Manual occlusion culling can easily be done by organizing objects in groups or marking tags. When the player crosses in or out of zones, all objects that will not be seen can be turned off or on. Lighting: In 3D, basic, non-GI (global illumination) is performed on a per-vertex basis. Each vertex has what is called a vertex normal, a vector that determines how the face or triangle will be lit (Figure 1-13). A ray is traced from the light to the vertex, and the angle between the two, the angle of incidence, is used to calculate the percentage of that light received by that vertex. The light received by each vertex is averaged between each. The smaller the angle, the more light the vertex receives.