Install Asset
Install via Godot
To maintain one source of truth, Godot Asset Library is just a mirror of the old asset library so you can download directly on Godot via the integrated asset library browser

Quick Information

Get the Z channel of a normal map from X & Y channels.
Godot Derive Z Node
Get the Z channel of a normal map from X & Y channels.
This node only works in Godot 4.2 onwards.
Method
The node take X & Y as inputs and outputs the full normal map.
vec3 deriveZ(float x_in, float y_in){
vec2 normalXY = vec2(x_in * 2.0 - 1.0, y_in * 2.0 - 1.0);
float z = sqrt(max(1.0 - dot(normalXY, normalXY), 0.0));
vec3 normal = vec3(normalXY.x, normalXY.y, z);
return normal;
}
By default the normalization is set to No
. You can normalize the result by selecting Yes
if you need.
Yes
=normalize(deriveZ(%s, %s)) * 0.5 + 0.5;
No
=deriveZ(%s, %s) * 0.5 + 0.5;
This implementation gives users the flexibility to choose whether they need normalization, which is useful since sometimes you might want to skip normalization for performance if you know your inputs are already normalized or if perfect unit vectors aren't required.
Installation
Extract the zip file and copy the folder to your project. You'll need to restart the editor for the node to appear in visual shader. Alternatively, you can make a new gdscript file and copy the code.
Get the Z channel of a normal map from X & Y channels.
Reviews
Quick Information

Get the Z channel of a normal map from X & Y channels.