shithub: sce

Download patch

ref: f476e77f1216de039a19dc1849ddda3971332c34
parent: d9d02c1e3bfea2805a241fec8f6036389da47fb1
author: qwx <qwx@sciops.net>
date: Wed Oct 7 08:03:04 EDT 2020

grp: adjust alpha curve for better sprite rendition

scv engine glow looks slightly better this way

--- a/utils/grp.c
+++ b/utils/grp.c
@@ -106,9 +106,13 @@
 		switch(npal){
 		case 63:
 			if(i > 47)
-				a = (0xff + 1) / (1 + exp(-i + 48 - 3.4) / 0.75);
+				a = 0xff / (1 + exp(-i + 48 - 3.4) / 0.75);
+			/* logistic growth function
+			 * max / (1 + exp(-x + xofs) / slope) + yofs
+			 * fplot -r '0:47 0:255' '255 / (1 + exp((20 - x) / 4)) + 0'
+			 */
 			else
-				a = (0xff + 1) / (1 + exp(-i + 10.0) / 2.2);
+				a = (0xff + 1) / (1 + exp((16 - i) / 3.5)) + 0;
 			break;
 		/* FIXME */
 		case 40: a = i < 33 ? 0xff * i / 32 : 0xff * (6 - (i - 33)) / 6; break;