Normal Maps for Triplanar Mapped Objects

in Shaders
I'm seeing some lighting issues while using the TextureUniformTriplanar node in the Visual Shader. I have a NoiseTexture which I am using as both to calculate the planet colors and also to calculate the normal maps. If you look at the image below, you can see a light off in the distance (I've turned up the energy to make it more visible). The "shadowed" areas are not being lit correctly. If I go to the other side of the sphere, the lighting is correct.
Am I missing something here or is this a limitation of triplanar mapping?
Comments
Maybe the normal map direction is inverted. Godot uses normal maps with Y- direction (see this table for a comparison with other engines).
You'll need to use an external tool to swap the Y coordinate in the normal map. (There might be an import option for doing this in 4.0.)
The normal map is generated by a built-in Godot plug-in so I would assume it's correct? The normal mapping is also correct on one side of the cube but it appears that the normals aren't adjusted properly for triplanar mapping.
This article seems to address the problem: https://medium.com/@bgolus/normal-mapping-for-a-triplanar-shader-10bf39dca05a.
normal maps are dependent on coordinates iirc, for this particular case you might have a better result using either a derivative map or a bumpmap that you convert into normal data in the shader.
http://www.rorydriscoll.com/2012/01/11/derivative-maps/
I ended abandoning the triplanar mapping (although I am glad I learned about it) and going back to this awesome tutorial and extended it by calculating the partial derivatives to calculate the tangent/normal vectors. I am quite happy with the result.
For anyone that is interested, here's the shader