1 vec3 Common_UnpackNormal(in vec3 norm){ 2 return (norm * vec3(2.0)) - vec3(1.0); 3 } 4 5 vec3 Common_UnpackNormalLA(in vec4 norm){ 6 vec3 newNorm = norm.agb; 7 newNorm.b = sqrt(1.0 - (newNorm.x * newNorm.x) - (newNorm.y * newNorm.y)); 8 return (newNorm * vec3(2.0)) - vec3(1.0); 9 } 10 11 vec3 Common_PackNormal(in vec3 norm){ 12 return (norm * vec3(0.5)) + vec3(0.5); 13 }