CMH Studio

Glow Circle

A simple glow effect in a circle.


#ifdef GL_ES
precision mediump float;
#define GLSLIFY 1
#endif

uniform vec2 u_resolution;
uniform float u_time;
uniform vec2 u_mouse;

#define GLSLIFY 1
float glow(float d, float str, float thickness){
    return thickness / pow(d, str);
}

void main() {
  vec2 uv = gl_FragCoord.xy/u_resolution.xy;
  // uv.x *= u_resolution.x/u_resolution.y;
  uv= uv*2.0-1.0;

  //定義圓環
  float dist = length(uv);
  float circle_dist = abs(dist-0.3);
  float glow_circle = glow(circle_dist, 0.6, 0.05);  
  //第一種寫法 by thickness/pow(dist, strength)

  //glow_circle= exp(-20.0*circle_dist)+exp(-200.0*circle_dist); 
  //第二種寫法 by exp(-scale*dist)

  gl_FragColor = vec4(vec3(glow_circle),1.0);
}

Test

float circle(vec2 uv, float radius){
    float dist = length(uv);
    float circle_dist = abs(dist-radius);//光環大小
    return circle_dist;
}

#pragma glslify: export(circle);

Pluto (minor-planet designation: 134340 Pluto) is a dwarf planet in the Kuiper belt.

History

In the 1840s, Urbain Le Verrier used Newtonian mechanics to predict the position of the then-undiscovered planet Neptune after analyzing perturbations in the orbit of Uranus.


Just a link: www.nasa.gov.

  • Lists
  • todo
  • done

A table:

ab
Show example
console.log('Hi pluto!')