• #### frankiezafe 21:20 on 2017-07-30 Permalink | Reply Tags: documentation ( 16 ), opengl ( 3 ), programming ( 3 )

Very interesting article about OpenGL Multi-Context (using the same textures, meshes, etc.) in multiple viewport, typically for multiple projections.
OpenGL Multi-Context ‘Fact’ Sheet

## 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 );

c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r