Im trying to create a little Java program that will generate a normal map from any given texture and I have made some headway - It just seems like there is something missing as my textures arent as "pronounced" as the dot3 ones i have seen of the same texture
Here is what I do (and please correct me where I'm wrong):
- Take the original image and use a Sobel edge detection algorithm on both X and Y axis.
- Make the X-axis the red pixel value of the new image and the Y-axis the green.
- Calculate the Z-axis through the x and y values through: 0.5 * Squareroot(1 - x^2 - y^2) + 0.5
- Make the final picture
My algorithm successfully finds any edges and cracks in a texture but it doesnt make it “deep” / “pronounced” enough… here is where i got the calculation informations: http://en.wikipedia.org/wiki/Sobel_operator
(since i cant find any place that properly describes how to make this without shaders)
In case im not describing it right this is what im trying to make:
Hope someone can help