How to properly compute normals for a sphere in HLSL

Hi all.

I am working on a software which creates planetary textures.

I am computing the planetary normals in HLSL (I am heavily using shader programming).
I compute my normals in a surface shader as follows:

float3 normal = float3(
          heightLongitudeDelta * _NormalScale,
          heightLatitudeDelta * _NormalScale,
          1);

This goes into o.Normal on a Surface Shader.

Problem is, when I compute the normals like that, the result in the sphere is:

7614934--946276--upload_2021-10-29_21-53-29.png

Looks good, right? But then, I navigate to the other side of the sphere, and what I have is this:

7614934--946279--upload_2021-10-29_21-54-16.png

Do you see how all the rivers now look like veins? Their normals are inverted on the other side of the sphere.

How do I properly calculate normals for a spherical surface within HLSL?

Please… never mind this post. Nothing to see here, move along.

I had simply forgotten to calculate the tangents on my sphere mesh. A simple:

meshFilter.sharedMesh.RecalculateTangents();

Solved it.