I have found this nice project! link
It is very cool! I do not understand the inner glow vertex shader the author use.
Why need reflect
function and why need r.z + 1
?
``
void main()
{
vUv = uv;
vec4 p = vec4( position, 1. );
vec3 e = normalize( vec3( modelViewMatrix * p ) );
vec3 n = normalize( normalMatrix * normal );
vec3 r = reflect( e, n );
float m = 2. * sqrt(
pow( r.x, 2. ) +
pow( r.y, 2. ) +
pow( r.z + 1., 2. )
);
vN = r.xy / m + .5;
gl_Position = projectionMatrix *
modelViewMatrix *
vec4(position,1.0);
}
``