2

I'm trying to get a real-world heightmap data for my game. I'm grabbing an image in GeoTIFF format from here and then converting it to png and cleaning up some errors. This is an example of a fjord heightmap after cleanup:fojrd height map You can see that it's mostly white and I would like to use the full range form black to white. I tried normalizing it in GIMP with Strech Contrast with Non-linear Components checked (it gave the best result), but it creates this ramping effect, which is very visible when used as terrain height data in Unity: fjord normalized I tried using a blur filter on it, but I have to blur it a lot for the "steps" to disappear. Is there any better way to normalize an image without creating ramping?

2 Answers 2

4

In your initial image you have 38 values. All the color adjustments are going to stretch this range between 256 values. But all the pixels with a given value are going to be mapped to the same new value, so you have 38 values spread in the 0..255 range, which means that assuming a strictly linear stretch, pixels with near values are now separated by 7 values, which is a lot more visible, especially in the dark tones. You can also see this in the histogram, which looks like a hair comb.

One possible cure is to use "spread noise". This sort of randomly move pixels, and the nice linear ramp (which translates into a flight of steps when you stretch the values) is a bit less smooth on entry, so the flight of steps on output is a lot more irregular and less visible.

However in your case you have to use a rather large radius for the spread noise and that makes the output rather grainy, but you can apply some blur to mitigate this (and much less blur that what you would need to remove the steps):

7px of spread+2px of blur:

Imgur

v.s. 7px of blur:

Imgur

2
  • Thanks for help! The spread noise is a little bit too much, but the blur you used is working better than the one I used. Can you tell me how it's called and where to find it? I ca't find any blur effect that takes pixels as input. Feb 8, 2019 at 15:10
  • Plain Gaussian blur. I used Gimp 2.8. Gaussian blur in 2.10 is similar, and although I don't know the units it uses, its ability to update the whole picture as you move the sliders makes that knowledge much less necessary.
    – xenoid
    Feb 8, 2019 at 15:22
1

When compared to blurring you get a lot more possiblities with the Detail Equalizer of G'MIC effect collection. It can generate the missing intermediate levels for you with some control on how big details are affected. My screenshots are from Krita.

Before:

enter image description here

After:

enter image description here

The effect dialog: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.