custommods

This commit is contained in:
samsonsin
2025-05-29 23:31:29 +02:00
parent 90b3575aea
commit 9d577eb52d
800 changed files with 19540 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
//Spheremap Transform from https://aras-p.info/texts/CompactNormalStorage.html
vec2 EncodeNormal(vec3 n) {
float f = sqrt(n.z * 8.0 + 8.0);
return n.xy / f + 0.5;
}
vec3 DecodeNormal(vec2 enc) {
vec2 fenc = enc * 4.0 - 2.0;
float f = dot(fenc,fenc);
float g = sqrt(1.0 - f / 4.0);
vec3 n;
n.xy = fenc * g;
n.z = 1.0 - f / 2.0;
return n;
}