Heightmap Exporter for Blender 2.5

Hi guys,

I was attempting terrain for a game I’m working on currently, and wanted to use a heightmap due to the collision optimization they receive compared to using a static mesh.

Problem was only way to generate heightmaps was expensive programs or using things like Terragen etc, I like to have lots of control over terrain, and also I want to be able to place objects (tree’s, bushes, fences, etc) on the terrain easilly.

I love blender, and with the new addition of Sculpting I thought, hey, I could make a nifty terrain in blender using sculpting, and so I did, and when I exported it, it took like 2 whole minutes (a realistic, non exaggerated two minutes), and so I immedietly though the collision optimization and export time I would save by using a heightmap would be worth it.

I found a tutorial on the Blender Noob to Pro guide that explains setting up a top-view orthographic camera and this long complicated process which I did try (and almost got to work, however I never actually did, I gave up)

An even longer story shortened a few minutes: I wrote an export script to do it for me.

It takes the vertices and lines them up in an array, the same way pixel data is, and then uses a small scale to determine the 0-255 color that is needed for that pixel based off the highest-lowest vertice point.

It works really well, and requires no external libraries (since I manually included a pure-python png module, which is actually really really fast)

You can download it here:

Blender 2.5 Heightfield Export Script (r2), by powerpup118

EDIT: Somehow the correct version never got saved, I have fixed the import problems however I lost a tiny bit of the code, I am fixing it at-the-moment and it should be good in a little while

EDIT2: Re-coded those parts, it all works now, huzzah! Updated the zip file with the new one, also added small test blend and result

Hope you all enjoy it, might make a video on how to use it with procedural blender content on the map and loading it in panda, I think it’s pretty trivial though, so if you would like me to, please do let me know if you want me to make a video on how to use it with panda

Best of luck,
~powerpup118

Uploaded revision 2

Fixes all (hopefully) floating point issues, every heightmap export should now work without errors, if you encounter any problems let me know.

Pictures:

From this:

To this:

A perfect heightmap image usable with the panda3d Geomipmap terrain

does it work with blender 2.6?

Hi,

There are some better tutorials online if you search google, for exporting height maps from blender.

Also, there are still issues with the script I later found that cause some clipping issues / make it useless sometimes.

Due to personal time constraints and moving to other projects, I’d advise that you follow a different tutorial instead of using this script.

If you still want to use it though, yes it’s for blender 2.6x series, and will probably not work with any earlier versions of blender.

Hope this helps,
~powerpup118

I tried to blender 2.62 , I don’t why I got error. So I prefer to google search for tutorial/manual.