The previous part of this tutorial is OpenSim Terrain Tutorial via Blender – Part 1. The previous part is about getting terrain from Second Life and OpenSim into Blender. This part is about exporting the terrain from Blender 2.59 as a height map image.
Terrain
By the time you start this tutorial you should have a completed terrain or at least have a test terrain to try.
Also, you should have a backup of your region. Loading the tutorial can mess up your region. So, a backup is a good idea. In OpenSim I make OAR file backups. (save oar [filename.oar] – save to OpenSim’s working folder. You can specify a path.)
Now is a good time to back up your Blender file too. It is a great idea to work in a copy of the file.
UV/Image
You sort of need a UV Map. It isn’t completely necessary. But it can come in handy later. Open a UV/Image Editor window. Create a new image the size of the height map you plan to export. Name it something. I suggest leaving the window open.
The Height Map Export
If you have a camera and light in your Blender scene, delete them.
Camera
Switch to a top view and add a camera. There is some mathematical relationship between the terrain and the camera location. The Wicked Witch of the East wrote the equations. So, I’m going to work around them and simply avoid dealing with the math. If someone knows how to make sense of the math, please leave me a comment.
Since I scaled my plane up to a 256×256 unit plane, I moved my camera up the Z-axis to +256. It is not really important for what I’m showing you. Just put the camera somewhere above the terrain and have it facing straight down the Z-axis.
With the camera selected, look in properties and select the Movie Camera Icon, see image (sorry clipped the top off. But, you can see the movie camera icon just below the thumbtack.) The tool tip says it is Object Data. Then set the camera to Orthographic. Next, set the orthographic scale to the size of the height map image you want to export.
For a single region for OpenSim that would be 256.
In the Display section of the Camera properties enable Limits. If you enable this you will be able to see the clipping limits of the camera. You may need to change the clipping limits. I set mine at 0.001 and 300. The value just needs to extend past your terrain. Whether you leave Limits on or off is up to you. It does not affect the process.
Position the camera over the terrain you want to export. Do not tilt or rotate the camera. It must face straight down. Height above the terrain does not matter. It will affect some numbers we will use but I’ll work around that.
Render
Next select the Still Camera icon or the Render Properties. (Another picture). The resolution should be X:256, Y:256, and 100%. The aspect ratios should both be 1.00.
Scroll down to the BAKE section. Set the Bake Mode to Textures.
Node Magic
Now we come to the part that makes it work. It is possible to make this work different ways. If I could figure out the Material Mapping Inputs this could be done by assigning a material. Not having figured that out I am using Nodes, which are pretty neat.
Node Window
Split your screen. You’ll notice I have mine in quadrants; one for the 3D model, one for UV/Image Editor, one for the camera view, and one for the Node Editor. I suggest you create the same windows. At the least you need the Node Editor window. See the Node Editor image.
In the Node Editor select Compositing in the bottom menu. When selected this should place two default nodes in the editor. One will be an Input -> Render Layers (A). This item tells the process what information to start with. The other is an Output -> Viewport (F), which just shows the output. Since there is no light both will be black. I’ve left this viewport in but it is not needed. All the items that are not required are marked with the letter ‘F’.
Look below buttons for link to page 2
If you are looking for a full range heightmap, I would suggest replacing the Map Value node with a Normalize node. This way you won’t need to mess around with offset and size, which inevitably will give you a lower quality height map. Hope this helps!
Best Regards,
Ben
Thx. I’ll try it.