Hello Blender gurus,
for a hobby game project I’m working on, I’ve been trying to export a linear grayscale heightmap according to a Z-deformed* plane mesh, referring mainly to the now obsolete wiki article http://wiki.blender.org/index.php/Doc:2.4/Tutorials/Textures/Maps/Creating_a_Heightmap_from_a_Plane and a YouTube Blender 2.6 tut (http://www.youtube.com/watch?v=EnrrsVzkqnc), but with undesired results. What my game engine expects from these heightmaps is only the following:
- lowest point of the (heavily subdivided) plane mesh corresponds to a pixel with value 0 (black), and the highest point to 255, with absolutely linear mapping for everything in between (eg. 0.5*(Z[SUB]max[/SUB] + Z[SUB]min[/SUB]) -> “127.5”).
What I’m doing now is this:
- create plane, scale by 8, apply that scale, subdivide a healthy number of times, and manually deform plane as desired
- add material and enable Shadeless. Add texture, select Blend as type, enable Ramp (linear, RGBA(0,0,0,1) to RGBA(1,1,1,1)), mapping Z,Z,Z. Mapping = Generated, Projection = Flat.
- move camera on top, pointing downwards, orthographic, scale 16.000
- select appropriate output image dimensions, format, bit depth and all that stuff
- render, save to image
However, just by looking at a height map generated using this method in the UV/Image editor view there are no exactly zero or white pixels to be found, which is not what I was aiming for. Also, I’m not entirely convinced of the actual linearity of this mapping, based on my tests on the game engine and the fact that the gradient texture preview looks rather obviously not linear (see picture below)
I’ve successfully done this the other way around, ie. deformed a subdivided plane mesh according to a height map generated with GIMP, but wasn’t quite proficient enough to create natural looking landscapes that way. :o
So now, what am I missing? Is there a way to generate a perfectly linear, (Z[SUB]min [/SUB]-> 0; Z[SUB]max[/SUB] -> 255) heightmap directly from Blender? Thanks.
- by Z-deformed I mean only Z-displacement is ever applied; the top-orthographic projection of my meshes is always square.