Reconstruct Normals in the Material Editor


i try to reconstruct the Normals of a Cube Sphere, that is displaced by a Heightmap.

The problem i have now is, that i get seams from my normal map. I think it’s the fact, that i use tangent space normal maps.

is there any other solution to reconstruct the vertex normal from height values?

Constructing spherical normals is easy.
The normal direction of a sphere is equal to the normalized difference between its surface position and its origin.

i found a solution that works. i found this in the Landscape shader files.

Calculate 5 Points around Vertex.

Then simply use the cross Product to get the Vertex Normal

The code can be found inside the LandscapeLayersHeightmapsPS.usf File

It’s really simple