commit c226920c3248025d2788ba2b6f4b51a2cce9eda8
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Thu Dec 8 01:28:59 2022 +0100

    Improve the Sink effect so that at extreme strengths (close to 0 and infinity) it inflates and deflates more.
    Reason: previous version failed to fully inflate the Masterball to a nice sphere.

diff --git a/src/main/java/org/distorted/library/effect/VertexEffectSink.java b/src/main/java/org/distorted/library/effect/VertexEffectSink.java
index 9c9b4d2..44e5e7b 100644
--- a/src/main/java/org/distorted/library/effect/VertexEffectSink.java
+++ b/src/main/java/org/distorted/library/effect/VertexEffectSink.java
@@ -51,6 +51,11 @@ public class VertexEffectSink extends VertexEffect
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
+// used to be simple:
+// float t = deg * (1.0-h)/max(1.0,h);
+// Changed to the four complicated lines because the previous Sink effect fails to fully inflate the
+// Masterball.
+// Current function inflates and deflates much more as H is at the extremes (close to 0 and inf)
 
   static String code()
     {
@@ -59,7 +64,11 @@ public class VertexEffectSink extends VertexEffect
         "vec3 ps = vUniforms[effect+1].yzw - v;            \n"
       + "float h = vUniforms[effect].x;                    \n"
       + "float deg = degree(vUniforms[effect+2],ps);       \n"
-      + "float t = deg * (1.0-h)/max(1.0,h);               \n"
+      + "float tmp = (1.0-h)*deg;                          \n"
+      + "float t1 = tmp*(deg+1.0)/h;                       \n"
+      + "float t2 = tmp/(0.618*(0.618+deg));               \n"
+      + "float t = t2 + (t1-t2)*((sign(h-1.0)+1.0)/2.0);   \n"
+
       + "v += t*ps;                                        \n"
 
       + "const float A = 1.6;                              \n" // max amount of change in normal vector when pulling
