A custom implementation to get a normal map from an image.
(Note: in the actual code, I also use the "corner pixels" to the top left, top right, bottom right, and bottom left of the current pixel.)
Heightmap (source):
Normal map produced:
Running a simple Lambertian Diffuse: