Also with this algorithm the z direction seems to be inverted.
Added video showcasing the problem:
Directional light source is shining towards (0, 0, -1) so only the front face of the cube should be lit.
And here's the pixel shader code:
float4 encodedNormals = NormalTarget.Sample(PointSampler, input.UV); float3 N = decode(encodedNormals); float3 LightDir = mul(_LightDirection, View); float NdotL = saturate(dot(N, -LightDir)); lighting.rgb = float3(NdotL, NdotL, NdotL);