From 989a86fb1a7a34515ab6263e07904e8955031680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Wed, 27 Mar 2024 20:21:52 +0100 Subject: [PATCH] gfx: tweak sphere_to_polar --- engine/art/shaders/fs_32_4_model.glsl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/engine/art/shaders/fs_32_4_model.glsl b/engine/art/shaders/fs_32_4_model.glsl index 1c99103..49f3159 100644 --- a/engine/art/shaders/fs_32_4_model.glsl +++ b/engine/art/shaders/fs_32_4_model.glsl @@ -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.