Book Image

Mastering Android Game Development

By : Raul Portales
Book Image

Mastering Android Game Development

By: Raul Portales

Overview of this book

Table of Contents (18 chapters)
Mastering Android Game Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
API Levels for Android Versions
Index

Occlusion culling


Occlusion culling is a technique that is broadly used in games, especially 3D ones. Since drawing is very expensive and has to be done many times, every optimization counts. The obvious optimization is to not draw the parts that are not going to be seen (for example hidden by something else). If we can draw each pixel on the screen only once, we are saving a lot of processing time.

The fact of drawing each pixel more than once is called overdraw. Having a high overdraw is one of the factors that impact performance the most.

In the case of 3D, drawing is especially expensive, and occlusion culling is something that most engines do automatically to a certain extent.

Note

Occlusion culling optimizes the drawing time by not drawing what is not shown.

In our case, we may be drawing some pixels twice, but since we are only doing 2D, the cost of drawing is not that high and it is something we don't need to do.

There is one special case, however: drawing sprites that are outside the...