5
$\begingroup$

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: enter image description here

And here is the one created by blender: enter image description here

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?

$\endgroup$
13
  • 1
    $\begingroup$ 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. $\endgroup$ Commented Jun 25, 2015 at 21:28
  • 1
    $\begingroup$ @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). $\endgroup$
    – Joehot200
    Commented Jun 25, 2015 at 21:36
  • $\begingroup$ Yes, but did you try changing the color space? Your description sounds like a disp map that was getting interpreted with the wrong gamma. $\endgroup$
    – JtheNinja
    Commented Jun 28, 2015 at 5:52
  • $\begingroup$ @JtheNinja How do I change the color space? $\endgroup$
    – Joehot200
    Commented Jun 28, 2015 at 9:32
  • 2
    $\begingroup$ @Joehot200 in the textures panel simply change the colorspace from sRGB (default) to linear. $\endgroup$
    – J Sargent
    Commented Jun 28, 2015 at 20:31

2 Answers 2

3
$\begingroup$

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.

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

$\endgroup$
1
  • $\begingroup$ 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? $\endgroup$
    – Joehot200
    Commented Jul 9, 2015 at 9:18
2
$\begingroup$

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.

enter image description here

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):

enter image description here

$\endgroup$
7
  • $\begingroup$ 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? $\endgroup$
    – Joehot200
    Commented Jul 2, 2015 at 9:58
  • $\begingroup$ That is unexpected. What sort of height map are you using? $\endgroup$
    – J Sargent
    Commented Jul 2, 2015 at 15:24
  • $\begingroup$ I'm not sure what you mean by "what sort". You can download the heightmap.bmp from endcraft.net/Blender $\endgroup$
    – Joehot200
    Commented Jul 2, 2015 at 16:19
  • $\begingroup$ 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. $\endgroup$
    – J Sargent
    Commented Jul 2, 2015 at 16:41
  • $\begingroup$ 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. $\endgroup$
    – Joehot200
    Commented Jul 2, 2015 at 17:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .