L3DT users' community
Large 3D terrain generator

Creating Higher Makes it Lower?

Got a problem or need advice?

Creating Higher Makes it Lower?

Postby Unio-Mentium » Mon Jun 08, 2015 11:35 pm

Note: Not sure if this is a bug or an actual function of the Program

I have been using the Free Version of L3DT for a year and a half now, and I have been noticing a particular function that continues to throw off my projects.
I notice this after I create a Heightmap. I will go in to edit it, say, add a peak or mountain, and after Refreshing the view, I realize, that after adding the high peak (usually higher than all the others within the Map), the rest of the map has gotten a shade Lighter, causing other peaks to become short and it messes up how it looks in the program I am using to show the Heightmap.

Is this a regular function that can be turned on or off, or is it a bug?

Thanks ~Fantasia
Unio-Mentium
Newbie
 
Posts: 1
Joined: Mon Jun 08, 2015 11:19 pm

Re: Creating Higher Makes it Lower?

Postby Aaron » Tue Jun 09, 2015 2:05 pm

Hi Fantasia,

Welcome to the forum, and thanks for the question.

This looks like the expected behaviour. The greyscale levels that are used to display the heightmap such that the highest point in the map is pure white (100%), and the lowest point is pure black (0%). The colour of every point in between depends on its height relative to the lowest and highest point. If you change either the highest or lowest point, you will therefore change the greyscale colour of every point in the map. The greyscale value is calculated like this:

Code: Select all
greyscale = (value at pixel - minimum height) / (maximum height - minimum height)


[Note the greyscale values from this equation are 0 to 1. In this discussion I'm using percentages, so the output value would therefore be multiplied by 100% to get the greyscale as a percentage. For display as an 8-bit greyscale image, the value is multiplied by 2^8-1, which is 255]

To show how this works when you change the maximum or minimum heights, consider the following example. Imagine that we have four height points: 50, 100, 140 and 150 metres:
  • 50m is the lowest, and will be black (0%).
  • 100m is halfway between the minimum (50) and the maximum (150), so it will be 50% brightness.
  • 140m is 90% of the distance from lowest to highest, so it will be 90% brightness too.
  • 150m is the highest, and will be white (100%).
Now, if we change the 150m point to be 250m*, then:
  • 50m is the lowest, and will still be black (0%).
  • 100m is now only 25% of the distance from the lowest (50) to the highest (250), so it will be 25% brightness.
  • 140m is now only 45% of the distance from lowest to highest, so it will be 45% brightness too.
  • 250m is now the highest, so it will be white (100%).
So, if we change the height range (the distance from the minimum to the maximum), the greyscale colour of all points in between are changed.

* Note it doesn't matter whether I change the point with the minimum or maximum values, or set another point to be higher than the previous maximum or lower than the previous minimum; whenever we change the difference between the lowest to the highest values in the map, we change the colours of the points in between.

Now, if we were to change this algorithm so that you always got the same colour for a given absolute height, regardless of changes to the minimum and maximum heights in the map (which I guess is what you want), you would then need to specify beforehand what the heights are that correspond to 0% and 100% (i.e. the minimum and maximum values in the equation above). The problem here is that if you modify your heightmap such that you raise some points to be higher than the height you specified for 100%, then they will clip to 100% regardless of their actual height. Indeed, you could raise all of your heightmap above the height you set for 100%, in which case all of your map would appear white. Similarly, anything lowered below the value you set for 0% will be clipped to 0% brightness. In effect, you have clamped your allowed height range.

The advantage of the way I presently calculate greyscale heights is that it never clips; different heights always get different colours [NB: within the quantisation limits of the greyscale colour palette that can be displayed in current operating systems and hardware]. This means you are always free to change the height of any point to any value, and you will always get a colour map where the highest point is white and the lowest is black and all other points map to a greyscale colour in between, with no clipping, and you don't have to nominate a height range beforehand.

Now, all that said, what I can do is make a special converter or exporter for you where you can manually set the output scaling. Which file format would you like?

Best regards,
Aaron.
User avatar
Aaron
Site Admin
 
Posts: 3696
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia


Return to Help and support

Who is online

Users browsing this forum: No registered users and 5 guests

cron