4

How does one go about taking a single photograph, like a picture of a rock wall, and getting a decent normal map out of it?

If you can, I'd like to learn about the mechanics behind it, and not a piece of software like CrazyBump that does it for me.

Daniel Kareh
  • 577
  • 3
  • 11
  • Any reason you're limiting yourself to a single texture? I've seen it done with multiple textures in shipping apps. (Not to say it can't be done with a single texture, but my guess is that it's easier with more than 1 texture.) – user1118321 Jun 15 '17 at 01:44
  • It's easier to get a single texture. And, I'm curious :) – Daniel Kareh Jun 15 '17 at 02:34
  • @DanielKareh: "But how does one go about taking a single texture and getting a decent normal map out of it?" What makes you think that there's a way to convert an image into a normal map? What is the image of, exactly? – Nicol Bolas Jun 15 '17 at 02:42
  • try reading this: https://fenix.tecnico.ulisboa.pt/downloadFile/845043405449073/Tangent%20Space%20Calculation.pdf – Charlie Jun 15 '17 at 05:47
  • @NicolBolas: Well, software like CrazyBump seems capable of generating normal maps of many, many surfaces from a single texture. – Daniel Kareh Jun 15 '17 at 13:05
  • @trichoplax: Sorry if my question was confusing. I'm looking for a way to generate a decent normal map from a single texture, if that's possible. – Daniel Kareh Jun 15 '17 at 13:06
  • @Charlie: I already know how to use a normal map and apply it to a surface. I'm trying to learn how to get the normal map in the first place. – Daniel Kareh Jun 15 '17 at 13:08
  • There are several different ways to do this, easiest being converting a bump map into a normal map. – joojaa Jun 15 '17 at 13:46
  • @joojaa: Alright. Any ideas on how to get a bump map from an image? – Daniel Kareh Jun 15 '17 at 14:16
  • If the image is a bump map then the normal map is just the derivate of the bump. – joojaa Jun 15 '17 at 14:39
  • @DanielKareh aha, I just use mudbox myself. You generate a normal map from a bump map. – Charlie Jun 15 '17 at 14:43
  • But, how do I get the bump map from the image. Like, if I have an image texture of say, a rock wall, how can I get a decent bump map from it, which I can then convert into a normal map. – Daniel Kareh Jun 15 '17 at 15:00
  • @trichoplax: Yes, that is correct. I'll edit the question. – Daniel Kareh Jun 15 '17 at 17:29
  • Hopefully someone can give an overview explanation as an answer here, but as a starting point there is a free open source tool called AwesomeBump if you (or anyone looking to write an answer) wants to see example code. – trichoplax is on Codidact now Jun 15 '17 at 17:29
  • Thank you! Do you happen to know which file the generator is in, or will I have to look around? – Daniel Kareh Jun 15 '17 at 18:00
  • I'm afraid I'm not familiar with the software, just stumbled upon it while searching. – trichoplax is on Codidact now Jun 17 '17 at 09:06
  • That's okay. I'll make sure to do some searching through the files. – Daniel Kareh Jun 17 '17 at 16:11

1 Answers1

5

"decent" is quite subjective and if you are restricting the capture to certain types of surfaces and controlled lighting conditions. For example normals and other SVBRDF parameters for shiny metallic surfaces are very difficult to capture compared to non-metallic, matte and bright surfaces without texture.

There are tools proposed in comments (CrazyBump, AwesomeBump) that try to do what you ask for and may generate normal maps sufficient to your requirements, but you could argue how "decent" the results are and how robust these tools are in capturing different types of surfaces. I don't know about the algorithms these tools use, but I believe they use more of an "artistic" than robust/accurate methods in generating the results.

There is some recent work to estimate normal map and other SVBRDF parameters using two images or from a single image (using neural networks), which is probably your best bet. However these algorithms assume a level of repeating pattern in the input images, but this might be ok for you since you mention rock wall as an example. There are likely other constraints as well such as requiring the captured surface to be dielectric hard surface material.

For more robust SVBRDF capturing you can check paper on frequency domain capture, but this is more complex capturing setup and far from a single image capture. enter image description here

To my knowledge there's no known generic algorithm to accurately extract SVBRDF parameters from a single image of a non-repeating surface because of the fundamental issue that a single image can't unambiguously represent SVBRDF parameters. E.g. two different normal & albedo combinations of a Lambertian surface may result in same pixel color in a single image.

JarkkoL
  • 3,636
  • 13
  • 14
  • I'll make sure to check out the mentioned neural network approach. I guess I'll have to go back to messing around with custom image filters, considering you mentioned that those applications use artistic approaches rather than super accurate models of light transfer. – Daniel Kareh Jun 17 '17 at 16:09