Book Image

Panda3D 1.7 Game Developer's Cookbook

Book Image

Panda3D 1.7 Game Developer's Cookbook

Overview of this book

Table of Contents (20 chapters)
Panda3D 1.7 Game Developer's Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Loading terrain


If you plan to create a game set in a non-flat outdoor environment, you will need a way to create a natural looking terrain consisting of mountains, hills, and slopes. Luckily, Panda3D comes with the GeoMipTerrain class that allows you to generate such an environment from a simple grayscale image called a height map.

Getting ready

Create a new project as described in Setting up the game structure and add a directory called textures on the same level as the models, nbproject, sounds, and src directories. Also copy the height map and terrain texture you are going to use for rendering the landscape to the textures directory.

Height maps can be created with specialized tools like Terragen or by rendering the height information of a mesh created by hand to a texture using a modeling package like Maya. A very quick solution is to generate a random landscape using a difference cloud filter found in many professional image editing programs.

The size of your height map should be 2n...