2

I want to use Normal map of image to Lighting and Shadowing. I have following image,

enter image description here

and I want Normal map of above image like, enter image description here

Same thing I want to do programmatically in OpenGL. Give some suggestion to achieve it. Or Let me know from to where to start from scratch to achieve this.

genpfault
  • 51,148
  • 11
  • 85
  • 139
Umang Kothari
  • 3,674
  • 27
  • 36
  • Please do not use normal maps on such complex and curved surfaces like flower, unless it's a flat oil painting where you want to show some regions have a thick color applied. – Fennekin Dec 04 '21 at 06:06

1 Answers1

1

This isn't really possible. If you had a heightmap, you can create a normal map easily by taking the derivative. Using a Sobel filter gives a nice smooth result.

See this: Generating a normal map from a height map?

However you have a photo, which gives you the light reflected from objects in the scene. To get a normal map you need information about the geometry. There are image processing techniques that can guess this information, making assumptions about lighting conditions and shapes in the image, but the results are never perfect.

You can simply assume the colour is height and generate a normal-looking map which might give some pretty looking specular detail on your model but it won't be correct and will look odd if you look too close.

Community
  • 1
  • 1
jozxyqk
  • 16,424
  • 12
  • 91
  • 180