# Why does image texture used in displace modifier not give the correct height?

I have got a custom heightmap-loader in Java, which converts each pixel of a Heightmap into a coordinate between 0 and 255, obviously with 255 being white and 0 being black.

The problem is, blender doesn't quite convert it the same.

Here's my rendering the heightmap with my own loader:

And here is the one created by blender:

Is it generally the same, White = up, black = down - But there are quite a lot of subtle differences. Certain places are higher, certain places are lower. And it generally is an incorrect mess.

To create the heightmap, I am following this tutorial. To sum it up, I create an image via a plane and use the Displace tool.

I just want an obj model which is 512 coordinates in size (ranging from 0 to 512) and has the same height as my custom generator, which simply sets the height directly to the amount of red on the heightmap at a certain coordinate.

And yes, the heightmap is black-and-white. So it doesn't matter if I get the red, green, or blue on the Heightmap, it'll be the same.

Why is it incorrect? What can I do to make it look exactly the same?

• Did you see this tutorial on importing hightmaps into Blender? youtube.com/watch?v=cZxyN7esQkY I think what you might have to do is change the color space on the texture to linear, but I'm not 100% sure. – TARDIS Maker Jun 25 '15 at 21:28
• @TARDISMaker He just does exactly what I'm doing already. Unfortunately, he does it too generally for it to help me with my specific needs (of setting the height to be the colour between 0 and 255). – Joehot200 Jun 25 '15 at 21:36
• Yes, but did you try changing the color space? Your description sounds like a disp map that was getting interpreted with the wrong gamma. – JtheNinja Jun 28 '15 at 5:52
• @JtheNinja How do I change the color space? – Joehot200 Jun 28 '15 at 9:32
• @Joehot200 in the textures panel simply change the colorspace from sRGB (default) to linear. – VRM Jun 28 '15 at 20:31

First of all make sure that the displace modifier's texture is mapped to the correct coordinates for your object (usually UV coordinates).

Now on to the settings on the display modifier.

The displace modifier will deform the the object based on the light/dark values of the image indeed. Using the default values, it will raise up the white parts (255) of the texture to 0.5 units and sink the dark values (0) to -0.5 and keep the mid-grey values at 0 in the Z axis. To alter the scale, change the Strength value to meet your needs. To make the dark values fall at 0 on the Z axis put the midlevel at 0.

• Unfortunately, this never worked. The blender heightmap still does not match my generated one, and I cannot understand why. My generated one simply works by, if the pixel at (1, 1) has got a red value of 255, set the height to 255. Does blender not work in the same way? – Joehot200 Jul 9 '15 at 9:18

What you want to do is change the texture's Color Space to Linear. To do that, go to the Properties region, and find the Textures tab.

Make sure that you are editing the texture for the right thing (displace) by checking the area highlighted in blue.

Then look under Image and change the Color Space value (highlighted in red).

Linear is the lowest value on the list, and show up like this (use the one I highlighted):

• When I changed the value, it didn't appear to change anything to the Heightmap in blender. Is that expected, or am I not doing something? – Joehot200 Jul 2 '15 at 9:58
• That is unexpected. What sort of height map are you using? – VRM Jul 2 '15 at 15:24
• I'm not sure what you mean by "what sort". You can download the heightmap.bmp from endcraft.net/Blender – Joehot200 Jul 2 '15 at 16:19
• Interesting. Did you try using http://terrain.party/? You can select any area on the planet and export heightmaps that can be easily used like this. – VRM Jul 2 '15 at 16:41
• I haven't ever used it before, though I'm not 100% sure why it's relevant right now. I'll try using it later and seeing if it's heightmaps have any difference in terms of incorrect height, but I'm not sure they would. – Joehot200 Jul 2 '15 at 17:27