get bumpmap/heightmap from a photo

Hi blender community !

Does anybody know wether it’s possible to extract height information ( for building bumpmaps ) from a ( desaturated ) photo lighting ?
I’ve been searching for this fror now 3 days, and can’t find anything. I think this can be mathematically achievable, and i found some similar info on websites and videos talking about cnc machining.
This video —> http://www.youtube.com/watch?v=fLkzYVA0q-o
show you more.
It’s exactly what i’d like to do.
Have a photo, create a heightmap and use it as a bump in blender.

Here’s for example a photo i’d like to convert to bump:

I tried gimp ‘emboss’ filter, but it just simply don’t work. The result is useless
as a bump. I also tried do desaturate and use the picture as a heightmap, but of
course it don’t give the needed results as dark/light zones are slopes and convert
in bump respectively as lower/higher zones.
I think what i need is some kind of ‘derivative function’ of the picture, that calculates
values ( heights ) from variations ( dark/light zones ) but i’m now stuck here :frowning:

Please help !

Thanks for your answers !

From one photo - no its almost impossible since the photo contains no depth information. The best you could do is to manually paint/estimate one in photoshop using different grey levels for areas you believe to be higher/lower.

did you look at the video ? those guys are doing ‘almost impossible’ things, tho photos have no depth info.

of course it’s possible. in my picture, slopes are shown as light/dark zones. as slopes come to evidence, you can derivate them for
getting relative height ( this is the way your brain reconstruct relief from this picture ). As long i can’t interface my brain to my PC, i’ll need a tool that does it for me. I’d really be sad to have to write it myself ( i have no time for this :frowning: ) and i think some ppl asked this question beforme i did… so there might be an answer to my question.

yes i use to do ‘handjob’ till now… manually building heightmaps is pretty boring and uninterresting, and could be
hard to do with pictures like the one i posted.

Any advice ppl ?

thanks in advance

ok. sorry for double post but my last one hasn’t been approved yet…

THIS ---->http://adamglazier.blogspot.fr/2009/07/convert-photos-to-3d-bump-map.html
is EXACTLY what i want !!!

Too bad it don’t work anymore.

Any help on this please ?

there are several programs that do an approximation. you can use the normal map plugin for photoshop/GIMP, that can also make bumpmaps from photos. another great free tool is njob. commercial programs include crazybump and nDo2. if you want to edit your bumpmap visually just take it as a displacement map in blender and sculpt it as you like it, then bake the bumpmap again in blender.

How they did it your first video I don’t understand too. They kept it as their secret. But in your last link, they used 5-15 images from different side to combine into a depth map.

If you have a set of images you can try this http://www.123dapp.com/catch

With single image you can only try HiPass . . .
http://mond.own.cz/blender/Displace-JPG/Ornament-Ph-Hipass.jpg

http://mond.own.cz/blender/Displace-JPG/Ornament-Ph-Hipass-S.jpg

. . . or convert to normal map (this is done by nDo script for Photoshop)
http://mond.own.cz/blender/Displace-JPG/Ornament-Ph-nDo.jpg

http://mond.own.cz/blender/Displace-JPG/Ornament-Ph-nDo-S.jpg

But for result seen from your first link - I will stay in touch, this I would like to know too. Because first image with flower ornament had less information than others, can’t imagine how can be be this computed without data - if it’s not a fake or manual work.

xNormals, Shadermap Pro, Photosculpt, GIMP Normal Map plugin, Photoshop normal map plugin…

There’s a gazillion tools to guesstimate normal/bumpmaps from a single diffuse image.

@ arexma: All these applications produce depth map from single image? Wow :slight_smile:
Or you missed a point of his question? Thanks

you could make an image texture of this image, and insert a cube with face dimensions matching the image, apply many subsurf modifiers, then a displace modifier. Position the camera square to the displacement, and, using the correct lighting and render passes you can make a bump map which you can then apply to anything.

Yes, that’s what I said, and that’s what the OP asked for.

xNormals’ free and even nicer, it does not only offer guesstimation, it also allows to create precise heightmaps from up to 4 images being lit from 4 different sides, and Photosculpt allows the complete re-creation of a 3d model AND height, normal, spec and occlusion maps with 2 images ~20° apart.

If you are only after normal mapping, then those apps, plus crazybump is a good free one. It offers bump mapping too, but only creates from the diffuse colours, not actual Z, as I think the others would too.

That’s not really what he asked for. He wanted to get accurate results and just guesstimating doesn’t give you that. Also having multiple images doesn’t help if you only have one so he can’t use xNormal or Photosculpt for that either.

I don’t really think it’s possible to get accurate results with a single image but I’d be glad to be proven wrong though.

Ah yeh. I flew over the paragraph after his image too fast.

In that case I am wrong and there’s no easy “one-button-solution”, but it’s possible by hand.
I’d not use any pixel based image operations at all, also with filters you’ll never get a decent result.
The bump-map-painting method already mentioned is not that bad, but not too accurate either.

I’d fire up inkscape and either recreate it there over the bitmap, or trace the bitmap to a vector image and start cleaning up :slight_smile:

It never did work…with just one photo :wink:

“This site turns sets of 2D images into 3D bump maps. To do this, you will need five to fifteen photos of your object that overlap at least 80 to 90 percent.”

To get real depth information from any images - you need at least two taken from different angles. The more images you have - the better the estimate of depth can be, but there is no way to accurately reproduce depth from a single image unless it is lit or coloured in a very specific (and known) way so that a computer program can be programmed to interpret the depth information from the colours/shadows.