Ambient occlusion for terrain

After calculating the ambient occlusion, use terrain.colorMap() to get a reference to the computed lightmap, as a PNMImage. Note that if you want to use the ambient occlusion in your shader, you can also just read out vtx_color in the shader, as the AO map is baked into the vertex colours.