java - Any idea on how to achieve this effect without GLSL -


do have idea how 2d effect done other way using glsl shader? such glowing effect, done textures, how such dynamic bubble around them?

in case, each object in bubble goes destination. positions send vertex shader , fragment shader. in fragment shader there calculations achieve effect. draw shader on background texture of size 1280x720.

the problem is slow. wanted use on mobile phones, think without chance. further problem vertex fragment can not send lot of positions (in case 30 positions). when shader compile more positions reports "not enough space defined varyings". render use libgdx framework.

any welcome. achieving similar effect. attach picture here on how should like. , shader code.

glowy dots

vertex:

attribute vec4 a_position; uniform mat4 u_worldview; uniform float u_xpos[30]; uniform float u_ypos[30]; uniform float u_size;  varying float xpos[30]; varying float ypos[30]; varying float size; void main() {     gl_position = u_worldview * a_position;     size = u_size;      int nn = int(u_size);      for(int i=0; i<nn; ++i){     xpos[i] = u_xpos[i];     ypos[i] = u_ypos[i]; } 

fragment:

varying float xpos[30]; varying float ypos[30]; varying float size;  void main( void ) {     float rad = 4.0;     float dist = 0.0;     vec2 pos = vec2(0.0,0.0);     vec3 color = vec3(0.1);     vec2 pixel = gl_fragcoord.xy;     vec3 c = vec3(0.53, 0.05, 0.1);      float xx[30]= xpos;     float yy[30]= ypos;      int nn = int(size);     for(int i=0; i<nn; ++i){         pos = vec2(xx[i] , yy[i]) - pixel;         dist += rad / length(pos);     }      color = c.yzx*dist;     gl_fragcolor = vec4(color, 1.0); } 

without glsl tricky, if problem it's slow perhaps following approach helps:

  1. render large white blurred circle (premade) additively each spark
    • optionally apply blur shader make more smooth, might not needed
  2. use result mask, render blue hues depending on value
    • dark-gray gray becomes dark-blue bright-blue
    • gray white becomes bright-blue saturated-blue
  3. render each spark additively on top

Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -