A game about forced loneliness, made by TACStudios
1# Normal Reconstruct Z Node
2
3## Description
4
5Derives the correct Z value for generated normal maps using a given **X** and **Y** value from input **In**.
6
7## Ports
8
9| Name | Direction | Type | Description |
10|:------------ |:-------------|:-----|:---|
11| In | Input | Vector 2 | Normal X and Y value |
12| Out | Output | Vector 3 | Output value |
13
14## Generated Code Example
15
16The following example code represents one possible outcome of this node.
17
18```
19void Unity_NormalReconstructZ_float(float2 In, out float3 Out)
20{
21 float reconstructZ = sqrt(1.0 - saturate(dot(In.xy, In.xy)));
22 float3 normalVector = float3(In.x, In.y, reconstructZ);
23 Out = normalize(normalVector);
24}
25```