Generating normal maps with Panda.

The script contained in the attached .zip file presents a method of generating normal maps at game runtime, using only Panda. The script borrows some portions from PIL and the script for PIL (licensing information for both of these sources is presented at the bottom of the script). The script will generate a set of color textures, then use one of them to create and save a normal map. The script can be configured to save the RGB components of the normal map, if you want to see what it’s doing.

This is a slightly modified (read “refined”) version of a script I posted to a thread in Scripting Issues. I present it here in Code Snippets to make it more obviously available as potentially useful Panda3D code. (4.62 KB)

The attached image shows what the script does.

Note that the functional portion of this script is directly derived from height2bump (, and all I have done here is work out how to implement this in Panda, without involving PIL.

Also note that the process used here should (hypothetically) be able to be used with other PIL filters, such as can be found here: I haven’t tried that yet, however. If you try it, let us know. :laughing: