Convert height map to normal map without HeightToNormalSmooth

Hi all

I have a procedurally generated height map animation which I built using shader nodes, the animation works well so far and I have the result of a greyscale heightmap that is plugged into the displacement slot of the material, this works to displace polygons on a water’s surface and looks quite the way I want it to.However I have also been tasked with generating normals for this material based off the height map.

I attempted this by plugging in the height map to a HeightToNormalSmooth node, which then is plugged into the normal slot of the material. I have noticed artifacts left over on the material surface and have been asked if I can do this conversion a different way without needing the HeightTioNormalSmooth node or creating artifacts. I would appreciate any suggestions.

The only way to perfectly solve procedural normals in my experience is mathematically.

Here’s a thread where I showed the formula for finding the normal of a sine wave and an example material that uses it. Similar steps can be taken with any curve function, although it’ll probably take some light calculus and trigonometry to do with custom functions.