encapsulated height map generation code