Monday, August 22, 2011

Making a Height map, part 2 – Height units


Some more investigation of what actually happens with the height map is needed before I proceed to my world map.
Gray scale in PS
To make a map the image needs to be 16-bit and grayscale. In PS you can change this under the tab Image -> Mode -> grayscale and 16-Bit. After the image is converted to grayscale, in the color tab you can chose the % grayscale. 100% is Black and 0% is White, so 50% gray has 50% black in it and so on. Whenever I talk about % gray, this is what I mean.
How I made my test height map images:

File -> New “2048 x 2048 pix, grayscale and 16-bit”. I have made the test “hill” using the gradient tool in PS. Use the bucket tool to make the background black (100%). With a circular selection tool I define the borders of the “hill”. You can have two colors selected in PS, I set the second to 55% gray. Now I can use the gradient tool (in the same place as the bucket), select circular in the settings, and drag from the middle in my selection in the image to the border.

Save as a RAW file, with the settings PC/IBM and header 0, it’s very important that the save settings are right or the TESAnnwyn can’t read it. If you want to open the raw file again in PS, use these settings: the right image size in pix, 16 bit, PC/IBM, 1 channel.
TESAnnwyn vs CS
After each conversion of the image to an .esp, the TESAnnwyn will tell you the min and max height of the map, in THU, GU and m. It will also tell you if there were over and underflows. I’m not entirely sure what over and underflows are.

Let’s take two examples, a 55% and a 80% grayscale hills (upper half of the image is the grayscale height map, the lower is the view from the CS Height map editor).

55%: min/max 0/29486 THU, min/max 0/235888 GU, min/max 0/3361m.
80%: min/max 0/9830 THU, min/max 0/78640 GU, min/max 0/1220m.
The TESAnnwyn reports a height of 3361m in the 55% gray hill, but when I open it in the CS Height map editor I see that it goes to ca 65 500 units in the z axel (height) and then flips to min height (no breaks in the mesh). The 80% gray hill on the other hand has a max height of 1220m (in TESAnnwyn), in the CS Height map editor I get ca 56 300 in z units. There is something here I don’t get, to me it looks like the TESAnnwyn reports a higher height than what the CS can handle, so the CS flips the height to min. Like in the case of 55% gray, the TESAnnwyn reported height of 3 361m is actually only ca 1 700 m, then flip to min and builds up to ca 1 700 m again.

I want to find a range of grayscale that will give me unbroken but high terrain.
From this a 75% gray test map looks almost good, still flips to min, but only at the very top. At my current settings of the TESAnnwyn 100% will be at 0m in game, this is just at/above sea level. I would like the map to go from under sea level and up to the highest mountain. This I can do with the –h (height alteration) function in TESAnnwyn, and depending on how low I want the sea I set different levels. -4096 (-58m) or -8192 (-116m) are good options.

With the -h -8192 setting in TESAnnwyn the 75% gray is the lightest I can use. According to the TESAnnwyn this gives me:
75% h -8192: min/max -1024/15358 THU, min/max -8192/122864 GU and min/max -116/1750 m.
Grayscale % vs. THU/GU and m in game?
When making the map it could be good to know what % gray gives what height with the setting of -h-8192. So I tested this and here the results:

/E

No comments:

Post a Comment