Created
May 30, 2020 13:15
-
-
Save menduz/51e52f7daf989553e0463469cffe2256 to your computer and use it in GitHub Desktop.
Spherical normal encoding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Encoding: | |
normalOut=normalize(normalIn.xy)*sqrt(normalIn.z*0.5+0.5); | |
// Decoding: | |
normal.z=length2(normalOut.xy)*2- 1; | |
normal.xy=normalize(normalOut.xy)*sqrt(1- normal.z*normal.z); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment