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