7 lines
129 B
GLSL
7 lines
129 B
GLSL
|
|
||
|
vec3 DecodeNormal(vec2 n)
|
||
|
{
|
||
|
float z = dot(n, n) * 2. - 1.;
|
||
|
vec2 xy = normalize(n) * sqrt(1. - z * z);
|
||
|
return vec3(xy,z);
|
||
|
}
|