When used to render a terrain, this can cause a "stair step" effect as the terrain goes from one discrete elevation to the next instead of making a smooth transition. No matter how precise your vertices may be in the mesh that you model, no matter how smooth you may have it looking, each point will get rounded off to an integer value between 0 and 255. Since you only have 256 shades of gray, you only have 256 possible elevations. Unfortunately, as you may have already noticed, there is a limitation of using heightmaps. This makes heightmaps relatively flexible. When the terrain is rendered, black pixels will represent 1000, white pixels will represent 5000, and a pixel that is exactly in between black and white (128) will represent 3000 feet (half of the sum of min and max). For example, suppose you decide the minimum is 1000 feet, and the maximum is 5000 feet. When importing a heightmap, you can specify the minimum and maximum altitudes for the map, and the whole thing gets scaled. That is, your heightmap does not represent a landscape with altitudes ranging from 0 to 256. Note that these values do not represent the absolute height of any given pixel, but rather the height relative to the rest of the map. For example, if your heightmap is 256x256 and your terrain is 1024x1024, your heightmap will determine the elevation of every fourth vertex, and the three in between will be interpolated. In most cases, if the resolution of the heightmap is smaller than the resolution of the terrain, the engine will interpolate the vertices in between those set by the heightmap. The more intense the pixel color (the closer it is to white), the higher the elevation of that vertex. The way it does this is it creates a grid of vertices (like we are going to do in Blender in just a moment), and uses the heightmap to determine the elevation of each point on the grid. Many 3D graphics engines already have functions to read in a heightmap and generate terrain from it. Black represents the lowest elevation on the map, while white represents the highest. Since the images are 8-bit (with the exception of some RAW formats that are 16-bit), you have 256 different shades of gray, ranging from pure black (0) to pure white (255). If you are familiar with heightmaps, you can skip ahead to the next section.Ī heightmap is a grayscale image that uses various shades of gray to represent different elevations across a map. I will briefly cover what a heightmap is and how it's useful for those who may not know. I'm simply including it here with the other landscaping tutorials I've written for convenience.Ī Word About Heightmaps This is how I learned to do this trick, and most of what I will cover came from this tutorial. This structure is called an oct tree and is a highly optimized way to render large meshes such as terrains.īefore I begin, I must give credit to the Creating a Heightmap from a Plane tutorial on the Blender wiki. The benefit to doing this as opposed to just exporting your mesh is that many engines have a special process for dealing with terrains as opposed to regular meshes where it divides the terrain up into different sections so that it can subdivide regions closer to the camera more for greater detail, and also cull (not render) regions outside the camera's field of view, saving precious processing time. In this tutorial, I will show you how to export your beautiful terrain to a heightmap that can be used in most 3D graphics engines. "Landscape Modeling II: Texture Stenciling"
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |