## The perfect halo function.

The halo is generated by making a linear blending between the sine on a *sigmoided* angle (sinus1) and a standard sine (sinus2 ).

The sigmoided sine has the advantage of being powerful far from the center:

The main problem with this method is the very short blurred area, making it too sudden.

The basic sine method has exactly the opposite problem, tiny white area but plenty of blur.

To combine both in a smooth way, the code is slowly changing the weights of both process accordingly to the distance (pc).

The java code (processing.org), looks like this:

float pc = distance_to_center/256;

float a = pow( pc, 1.5 ) – 0.3;

float sig = 1 / ( 1 + exp( ( -8 + a * 16 ) ) );

float sinus1 = ( 1 + sin( -HALF_PI + ( sig * PI ) ) ) * 0.5;

float sinus2 = 1 – ( ( 1 + sin( -HALF_PI + ( pc * PI ) ) ) * 0.5 );

d = 255 * ( sinus1 * (1-pc) + sinus2 * pc );

## Reply