gfx: tweak sphere_to_polar

main
Dominik Madarász 2024-03-27 20:21:52 +01:00
parent ff72ac6bc9
commit 989a86fb1a
1 changed files with 2 additions and 3 deletions

View File

@ -224,10 +224,9 @@ float geometry_smith( vec3 N, vec3 V, vec3 L, float roughness )
return geometry_schlick_ggx( N, V, k ) * geometry_schlick_ggx( N, L, k );
}
vec2 sphere_to_polar( vec3 normal )
{
vec2 sphere_to_polar( vec3 normal ) {
normal = normalize( normal );
return vec2( ( atan( normal.z, normal.x ) - PI*0.5f ) / PI / 2.0 + 0.5, acos( normal.y ) / PI );
return vec2( 1-atan( normal.z, normal.x ) / PI + 0.5 , acos( normal.y ) / PI );
}
// Our vertically GL_CLAMPed textures seem to blend towards black when sampling the half-pixel edge.