|  | 
 
   In the first tutorial you got a handle on how to create skyboxes. In this tutorial you will learn how to generate and export height maps in Terragen in addition to a method on how to export the texture and properly display it in BB3D. If you still have the original Terragen project open that you used for the first tutorial then we can start there. If you discarded it then please regenerate another Terrain and place your camera in the center as per Tracer's instructions in his skybox tutorial. Tracer's latest tutorial should be available on blitzcoder.com but an older version may also be found at http://www.darkeffect.com/tracer/tutorials/. 
 
   I don't plan to get into the specifics on generating the landscape, that is covered in numerous sites on the Internet and in Tracers skybox tutorial. If you want more information or tips on creating better landscapes just go to About.com and type in Terragen and you will have lots of material to read. 
   Go ahead and generate your landscape. Once you're done generating your landscape map click on Export and send it off as an 8bit raw file. We will play with the other settings later. First we need to work with our heightmap in PSP or any image editing program of choice so that our final render texture will be a bit more accurate. In your image editing application of choice (PSP in these examples) 
   When you import the raw 8 bit height map you need to use the settings as shown above. For whatever reason Terragen saves the raw heightmap as a 257x257 image rather then 256x256. Kind of strange but these are the dimensions you need to get the correct output. Also noticed that the flipped box is checked. Terragen feeds you the information from the bottom up so you will want to rotate the image 180 degrees unless you have a nifty option to flip it as you import it. 
   And viola we have our heightmap image. Once I have the height map I like to make a few changes to it to allow for a better rendering environment when we import the image back into Terragen. If you look closely there is a black box around the edges. I did this in an attempt to create a better quality image to render. You will see later that the images don't come up square when its time to render, creating a small bit of distortion. The shape is deformed based on the heights of the border pixels. By making the heightmap more uniform around the edges you stand a better chance of getting a squarer image. Suffice to say if you produce a squarer render it will help make your texture map be bit more accurate. Clip the edges a bit with a solid black, or solid white box till you get a rough approximation of what you see above. Then just take it, resize it to your chosen perspective. I usually go with 64x64 or 128x128. Those with larger worlds will probably want a 256x256. Save the raw image so you can import it back into Terragen (Make sure to flip it back upside down before you do. Whatever your chosen size, make sure you do a resize because BB3D only likes square values. 64x64, 128x128, 256x256, 512x512 etc… Once you have your image you can export it at as a bitmap for use in BB3D. So you should have one .bmp heightmap file and one modified raw image. Go back to Terragen, its time to render your texture. 
 Now that were back in Terragen its time to import the modified raw heightmap, set all of our Landscape, Water, Atmosphere, Light settings and last of all render the complete image to capture the worlds texture. First things first go into your Landscape screen and Import your Raw 8 bit data that you modified. 
   
 I have completely skipped the water screen as I do not edit the default settings. I find that you will probably have more luck rendering without water for surface textures since all water will appear textured as an ocean floor bed. Now that's good if your going to add artificial water to your world, but since doing that is beyond the scope of this tutorial I have kind of cheated and created a world without water to avoid that situation altogether. Below you will find some snap shots that I used for my Atmosphere and Light settings. It's up to you if you want to copy my settings or create your own. 
   Again, here is a quick snap shot of my atmosphere settings that I used. A quick way to make things look good is to just click on the open button and select a pre-set scheme. You can tweak it a bit when you get a better understanding how everything in Terragen works. 
 
   Here is the lighting screen. Once again you can copy my settings if you want roughly the same results. The same tip for atmospheric effects applies for lighting. Just use the open button and select one of the pre-set formats if you want something that looks better then the default options with very little effort. 
 To get the texture (or a rough approximation of it) we just want to hover far above our world and render the image looking straight down. Then we will save that image, edit it in our photo editing software saving it as a texture map and were done. Let us begin the rendering configuration. There are no easy set rules as to what the proper settings will be, I can only offer some general guidelines. Your goal is to snap as square of a picture of your terrain from above as you can with the least amount of black space while keeping as much of the terrain detail as possible. The first thing you can do to make your life easier is select a zoom aperture of 1 as you did in the previous skybox tutorial. I recommend also using Terrain Units rather then Meters as they are in my opinion easier to work with for this exercise. Set your camera position to 128X and 128Y. Set your Target Position at 128X and 128Y. For your target altitude (Z) pick a fixed height above the surface. Any small positive, 0- or negative number should do fine. For the camera orientation make sure your head is 0 pitch is -90 and bank is set to 0. You will have to experiment a bit with the Camera Position Z. Start around 200 and make adjustments. Set your Width and Height for the rendering well above your target texture (since you will be cropping some of the rendering). Below you can see what I ended up with as my final preview. 
   This picture contains most of the image, so its time to click on render image. Once the render is complete, save the image as a bitmap file. The rendered image will look like a much larger version of the small square preview. Open the saved image up in PSP or any other image editing program. You need to crop the image trying to get as much of the image as possible without getting any of the black area. Then resize the image to 512x512 or 256x256 if you're short on video ram. It's ok if your image is distorted a small amount when you resize it. This is what my image looks like after I cropped it to a square. 
   Save the modified image. This will be your texture-map. And now you're ready for BB3D. You should have two images, your height map and your texture-map (some call it a color map) that you just created. Once inside BB3D do the following: Since this is not a BB3D tutorial on terrains I will not get into the specifics of the code. However you will need to do the following: 
 
 When you are finished you will have your height map and a very detailed texture map. Combine this with what you learned in the previous Terragen skybox tutorial to make some really spectacular results. To make the scene below I followed Tracer's example to create a skybox with a blank landscape with no height landscape. After saving all the skybox photos I generated my landscape and processed it per my methods. If you look at the output generated below you will notice that the clouds are casting a shadow. This is another option available in Terragen and it works nicely with the skybox that I generated. 
   Hope you learned what you needed to know. If I can be of any assistance feel free to e-mail me at joe@y-media.com. I am always happy to help. 
 For a printable copy of this article, please click HERE. 
 This site is Copyright© 2000-2004, BlitzCoder. All rights reserved.   |