Accessing normal maps via script when using Zylann's terrain plugin?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By unlut

Hello, I am trying 3D stuff in Godot for the first time and using Zylann’s terrain plugin to generate my terrain, using brushes in the editor. I am trying to access normal values of the terrain in my script because I want to detect terrain slope at some points. However, when I try to access normal map like this:

var normalmap = terrainData.get_image(HTerrainData.CHANNEL_NORMAL)

I get a null value as normalmap. I may calculate normal vector from sampling points from forward and right, but since terrain is reacting to light it should calculate normal values somewhere. I know it may calculate them in the shader on the fly, but I was wondering if there is a way for terrain node to calculate and store this normal map so I can access it later, or there is already a way and I am missing something?

Edit: I can access heightmap the same way without problems.