HeightmapFromTexture

Author: Eric Haines (Eric5h5)

Description
Uses a texture in your project as a heightmap, which is applied to the active terrain. This way you don't have to import RAW files, but the vertical resolution will be limited to 8-bit. Requires Unity 2.6, although it will work with Unity 2.5 as long the texture is uncompressed.

Usage
You must place the script in a folder named Editor in your project's Assets folder for it to work properly.

To turn a texture into a heightmap, click on the texture in your project, then select the Heightmap From Texture item in the Terrain menu. The texture must be marked "Is Readable" to work. Textures with color are fine, since the colors are evaluated by their grayscale value. If the texture is a different size from the heightmap resolution, it will be resized to fit (internally--the actual texture is untouched). If the texture is resized, it will be scaled using simple nearest-neighbor scaling if the texture is set to have no filtering; otherwise it will be scaled using bilinear filtering.