View Full Version : Generate heightmap from a picture?

01-10-2003, 05:21 AM

I have a picture of a leather material. The material is not perfectly flat, but has some creases (right word?) which makes the material go smoothly up and down almost like a terrain.

Is it possible to generate an height map of this terrain with this picture as input? The heightmap dont have to be exactly correct but pretty near the original. What I am looking for is some sort of image-algorithm that can analys the picuture and generate the heightmap from this.

It doesn't feel like an impossible task, because we know that the leather is heightlighted where the normals point to the light. But then where are some self-shadowing effects in the material which doesn't correspont to any normals.

I hope you understand the problem..

//Regards, Ninja

01-10-2003, 05:41 AM
Here is the picture of the leather material: http://www.mdstud.chalmers.se/~md8smaug/bumps.jpg


01-10-2003, 05:53 AM
It's very hard to do with that unique picture, especially because of specular highlights. If you could have a stereographic image you would certainly get better approximations.

01-10-2003, 05:53 AM
Hey, I'm about to start work on a project almost the same as this. The only problem you have is you cannot use a function of the greyscale pixel value for your height (well you could I suppose),because the brightest pixels in this image are those with the most specular (the white pixels), not neccessarily the hightest points.

Your heightfield will not correspond

01-10-2003, 06:31 AM
I'm not too experienced at texture mapping or anything, but I was wondering if you could maybe use that specular highlights to your advantage? I mean can you use it to maybe determine the slop of the line? Just for example lets say:
Dark Gray/Black: positive slope Normal Gray: 0 slope (flat terrain or top of hill) Light Gray/White: negative slope
I realize that this would be an approximation, but could you use the slope and the shade of the higlights and all that to maybe render a terrain? Since it is in black and white, the rgb values should be the same. So you could maybe use those to determine the change in slope?

- Halcyon

01-10-2003, 06:38 AM
If you knew the position of the light source, then of course this is possible. Hight specular would mean a more perpendicular-to-the-light source angle for that part of the surface.

01-10-2003, 06:39 AM

perhaps you can use edge detection to get the contours from the image. This should ease further processing


01-10-2003, 07:09 AM
Robbo: The lighter the texel is the closer the normal is to the light vector I guess. But it is impossible to know in which direction the normals are, just how close they are to the light direction?

//Regards, Ninja

01-10-2003, 07:53 AM
Originally posted by Ninja:
Here is the picture of the leather material: http://www.mdstud.chalmers.se/~md8smaug/bumps.jpg


if you're not too worried about it being absolutely correct, you could calculate the gradient vector at each pixel to determine the "normal" at a given pixel. i believe that is what this app does: http://www.ati.com/developer/sdk/RadeonSDK/Html/Tools/NormalMapGenerator.zip

please note that this app assumes a 24 or 32bit tga file. convert your image to the correct format and then this app should spit out a normal map for dot3 bump mapping. it won't be perfect but it's worth a try.


01-10-2003, 09:42 AM
related info http://www.hpl.hp.com/ptm/

IIRC nvidia have a photoshop plugin that will let u create bumpmaps there are various methods of choosing the height data eg red channel, maximum

01-11-2003, 04:10 AM
Ok, thanks!