Generate heightmap from a picture?

Hi,

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

Here is the picture of the leather material: http://www.mdstud.chalmers.se/~md8smaug/bumps.jpg

//Ninja

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

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.

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:
[ul][li] Dark Gray/Black: positive slope[] Normal Gray: 0 slope (flat terrain or top of hill)[] Light Gray/White: negative slope [/ul][/li]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

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.

Hi

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

Bye
ScottManDeath

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

Originally posted by Ninja:
[b]Here is the picture of the leather material: http://www.mdstud.chalmers.se/~md8smaug/bumps.jpg

//Ninja[/b]

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.

–chris

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

Ok, thanks!