From: Steinar H. Gunderson Date: Thu, 5 Jul 2018 19:13:29 +0000 (+0200) Subject: Fix normalization in the Sobel calculation. X-Git-Tag: 1.8.0~76^2~245 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=eb879cde156d29caedd25092362c168b45dc2c0a;p=nageru Fix normalization in the Sobel calculation. --- diff --git a/sobel.frag b/sobel.frag index 9feab1e..c4dabd5 100644 --- a/sobel.frag +++ b/sobel.frag @@ -47,4 +47,8 @@ void main() gradients.x = (top_right + 2.0f * right + bottom_right) - (top_left + 2.0f * left + bottom_left); gradients.y = (top_left + 2.0 * top + top_right) - (bottom_left + 2.0f * bottom + bottom_right); + + // Normalize so that we have a normalized unit of intensity levels per pixel. + gradients.x *= 0.125; + gradients.y *= 0.125; }