Convert Heightmaps to Normal Maps with blender

(sdfgeoff) #1

Just select your image from the red box, and set the resolution in the blue box:

Then use typical F12 to render and F3 to save the image.

Works only with square textures.

Blend file:
heighttonormal.blend (536 KB)

(Nick Manchul) #2

I apologize, but looking at your example I saw some shortcomings:

  • the normal map is obtained with transparency - for the normal map it’s a little not correct
  • when converting a picture from a soft heightmap to a normalmap, the map is obtained with sharp edges
  • and generally the color palette (normal map) is not very high-quality
    Here’s an example of a fairly professional conversion solution - using GIMP and the plug-in “normalmap”:
    Here is an example of textures, drawn in the GIMP:

The last texture (the fourth) is made in your example, the normal level in the GIMP can certainly be done more.
As you can see, there is a big difference, and no square restrictions ;).

Here are the sources of GIMP: (141 KB)
Here is the source file blend:
heightmaps_to_normalmap_TEST.blend (615 KB)

In the GIMP file in the layers (name) there is a description.

Thank you for attention.

p.s. of course, this files is a free extended help on BGE and GIMP

(Daedalus_MDW) #3

whats the benefit of using normal maps over bump maps if the data is the same?

(Nick Manchul) #4
  • Well, if you pass the question of conversion - the main theme of the Thread … the data is not the same.
    Even for example, for a height map, you need more resolution, and like the calculation algorithm is heavier for it (I heard it somewhere, I do not know whether it’s a myth or not). If the use of normal maps would not be relevant, they would have outlived their. Also for GLSL filter from Goran (parallax) two textures are used - a heights map and a nomials map. The first gives the parallax effect (qualitatively), the second - the bump effect.That is - it all happens at the level of the hardware.
    Like so…

(Daedalus_MDW) #5

when i say “data” i mean relative. bumpmap is an offset of the Z, but normal maps can offset X,Y, and Z. if a baked normal map offsets only Z, is it better? or do you just save a texture and share the bump map?

(Nick Manchul) #6
  • better or not, I do not know." I know that in all modern games there is a normal map - it means that there is a sense in it. In addition to a normal map, there is often a height map.

or do you just save a texture and share the bump map?

  • I did not share anything. In this topic I saw flaws and showed the experience of creating normal maps - like a professional method. Although it is better to bake a normalmap from a physical texture (model) object.

(<== Lost? Click Me) #7

Bump offsets location / height per map pixel, normal offsets rotation of a surface per map pixel to modulate the intensity of reflected light.

(alf0) #8

man this is sooo cooool

(sdfgeoff) #9

Why does it bake alpha? So that you can do parralax mapping without an extra texture sample (and it ensures all data from the original image is retained). In a PNG image, the color data in the transparent areas is also saved, so there is no reason not to use all four color channels.

Why are normals better than heightmaps? What are these mythical normals anyway? They are the direction that the face, uh, faces. And the direction often has more impact on lighting than the position. So a heightmap is often converted into a normal map on the GPU every frame. To do this, the heightmap is sampled three times and the values compared. Inside a normal map it reads the values from a single pixel. Because sampling textures is one of the more expensive operations on the GPU, reducing the number of samples can make a huge difference - particularly on integrated GPU’s.