What shader effects do you want?

  • A simple STROKE!

  • Offset mask

    In my game you can wrap around the edges, but the sprites don't wrap around visually. An offset mask would allow me to show one edge of the screen into another

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Just a few effects I was thinking abut today:

    An erode like a common erode filter in PS or GIMP.

    A dilate for doing "turn to stone" effects, and to animate water from noise textures. (just ramp the filter up and down in real time)

    Seamless Perlin noise. Would be great for smoke effects. And to multiply over tiles for dirt and shadow'a so that the seamless patterns are not as obvious. (one tiles at 64x64 and the overlay at 128x128 as an example)

    Animated caustics for water scenes.

  • 7Soul

    doesn't sound too complicted, i'll see what i can do.

    jojoe

    erode/dilate are convolution effects and should be doable, i look into that.

    a full set of perlin/simplex noise shaders are on their way, though i still need more time ^^

  • I could use - and many others have requested it - a transform shader, i.e. a four-point corner pin for skewing surfaces. I'd also love to see some sort of customizable mesh warp, think a grid 3x3, 4x4, or 5x5, of points, where each point acts like a corner pin. So people could customize their distortion patterns in more detail.

    I also want these distortions to have an option to be able to distort whatever is behind them, even if the object behind it is moving. So you could have a distortion cast from one (partially visible or invisible) layer onto the layers underneath it?

    I have several projects - 2d with a few pseudo-3d effects, that would benefit immensely from these shaders. I am looking at 3d engines if necessary but if these effects can be done in C2 instead it'd save me a ton of time and labor.

  • Very cool! Thanks for your effort.

  • Okay, I need to make this clear... I am not saying I'm making or have made the shaders I described. They're just ideas at this point.

    I haven't learned how to make [shaders] though I may try to if nobody else steps in on these.

    I am, however, suggesting that shaders like what I described would be useful to me if someone could assist me in getting them made.

    Also, one other item that would be useful for my project, not essential but helpful anyway - I'd like to see an offset wrap, as someone mentioned earlier in the thread. So you can wrap a single image in a loop, horizontally or vertically, without having to cycle between two copies of the same background object as the current wrap feature does.

  • The current lens shader i think could be improved. There is no value for its parameter that will give NO distortion. This makes it hard to have a kind of perfect shockwave effect where it smoothly transitions the degree of magnification to 0 like a dissipating wave. If anyone has used the current lens shader to achieve this, please let me know what you did as I can't seem to perfect it.

  • jojoe

    the erode/dilate filter is ready ;)

  • Wow! awesome, thank you very much!

  • Radial Flash for thundering clouds.

  • Not sure if this has been said already, but something like this would be nice:

    <img src="http://i.imgur.com/udS9oWc.png" border="0" />

  • So much this ^^^

    only, instead of using "solid" as the picker, I'd say a new behavior "Shadow Caster" that way you can have solids that do not cast shadows as well.

    EDIT: maybe a secondary behavior as well for "accepts shadows"

    Sure there are ways to duplicate this effect now, but they aren't very efficient and having it in WebGL would be awesome and make my life a lot easier.

  • A Motion Blur effect would be tons of fun to use!

    I found a WebGL/Javascript demo made by 'shurcooL' and copied the shader info from the HTML source:

    <font size="1">#ifdef GL_ES
         precision highp float;
         #endif
    
         uniform vec3 tri0v0;
         uniform vec3 tri0v1;
         uniform vec3 tri0v2;
         uniform vec3 tri1v0;
         uniform vec3 tri1v1;
         uniform vec3 tri1v2;
    
         varying vec4 verpos;
    
         struct Line3
         {
              vec3 Origin;
              vec3 Direction;
         };
    
         struct Triangle3
         {
              vec3 V[3];
         };
    
         bool IntrLine3Triangle3_Find(Line3 line, Triangle3 triangle, out float TriBary[3])
         {
              // Compute the offset origin, edges, and normal.
              vec3 diff = line.Origin - triangle.V[0];
              vec3 edge1 = triangle.V[1] - triangle.V[0];
              vec3 edge2 = triangle.V[2] - triangle.V[0];
              vec3 normal = cross(edge1, edge2);
    
              // Solve Q + t*D = b1*E1 + b2*E2 (Q = diff, D = line direction,
              // E1 = edge1, E2 = edge2, N = Cross(E1,E2)) by
              //   |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))
              //   |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))
              //   |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)
              float DdN = dot(line.Direction, normal);
              float sign;
              if (DdN > 0.0)     ///Math<float>::ZERO_TOLERANCE
              {
                   sign = 1.0;
              }
              else if (DdN < -0.0)     ///Math<float>::ZERO_TOLERANCE
              {
                   sign = -1.0;
                   DdN = -DdN;
              }
              else
              {
                   // Line and triangle are parallel, call it a "no intersection"
                   // even if the line does intersect.
                   ///mIntersectionType = IT_EMPTY;
                   return false;
              }
    
              float DdQxE2 = sign * dot(line.Direction, cross(diff, edge2));
              if (DdQxE2 >= 0.0)
              {
                   float DdE1xQ = sign * dot(line.Direction, cross(edge1, diff));
                   if (DdE1xQ >= 0.0)
                   {
                        if (DdQxE2 + DdE1xQ <= DdN + 0.03)     // Low precision fix hack
                        {
                             // Line intersects triangle.
                             ///float QdN = -sign * dot(diff, normal);
                             float inv = 1.0 / DdN;
                             ///lineParameter = QdN * inv;
                             TriBary[1] = DdQxE2*inv;
                             TriBary[2] = DdE1xQ*inv;
                             TriBary[0] = 1.0 - TriBary[1] - TriBary[2];
                             ///mIntersectionType = IT_POINT;
                             return true;
                        }
                        // else: b1+b2 > 1, no intersection
                   }
                   // else: b2 < 0, no intersection
              }
              // else: b1 < 0, no intersection
    
              return false;
         }
    
         bool IntrLine3Triangle3_Find(Line3 line, Triangle3 triangle, float tmax, vec3 velocity0, vec3 velocity1, out float ContactTime)
         {
              float TriBary[3];
    
              if (IntrLine3Triangle3_Find(line, triangle, TriBary))
              {
                   ContactTime = 0.0;
                   return true;
              }
              else
              {
                   // Velocity relative to line
                   vec3 relVelocity = (velocity1 - velocity0) * tmax;
    
                   Triangle3 triangle1;
                   triangle1.V[0] = triangle.V[0] + relVelocity;
                   triangle1.V[1] = triangle.V[1] + relVelocity;
                   triangle1.V[2] = triangle.V[2] + relVelocity;
    
                   float ClosestContactTime = 2.0;
                   {
                        float TriBary[3];
    
                        {
                             Triangle3 tri;
                             tri.V[0] = triangle.V[0];
                             tri.V[1] = triangle1.V[0];
                             tri.V[2] = triangle1.V[1];
    
                             if (IntrLine3Triangle3_Find(line, tri, TriBary)) {
                                  ClosestContactTime = min(ClosestContactTime, TriBary[1] + TriBary[2]);
                             }
                        }
    
                        {
                             Triangle3 tri;
                             tri.V[0] = triangle.V[0];
                             tri.V[1] = triangle.V[1];
                             tri.V[2] = triangle1.V[1];
    
                             if (IntrLine3Triangle3_Find(line, tri, TriBary)) {
                                  ClosestContactTime = min(ClosestContactTime, TriBary[2]);
                             }
                        }
    
                        {
                             Triangle3 tri;
                             tri.V[0] = triangle.V[1];
                             tri.V[1] = triangle1.V[1];
                             tri.V[2] = triangle1.V[2];
    
                             if (IntrLine3Triangle3_Find(line, tri, TriBary)) {
                                  ClosestContactTime = min(ClosestContactTime, TriBary[1] + TriBary[2]);
                             }
                        }
    
                        {
                             Triangle3 tri;
                             tri.V[0] = triangle.V[1];
                             tri.V[1] = triangle.V[2];
                             tri.V[2] = triangle1.V[2];
    
                             if (IntrLine3Triangle3_Find(line, tri, TriBary)) {
                                  ClosestContactTime = min(ClosestContactTime, TriBary[2]);
                             }
                        }
    
                        {
                             Triangle3 tri;
                             tri.V[0] = triangle.V[2];
                             tri.V[1] = triangle1.V[2];
                             tri.V[2] = triangle1.V[0];
    
                             if (IntrLine3Triangle3_Find(line, tri, TriBary)) {
                                  ClosestContactTime = min(ClosestContactTime, TriBary[1] + TriBary[2]);
                             }
                        }
    
                        {
                             Triangle3 tri;
                             tri.V[0] = triangle.V[2];
                             tri.V[1] = triangle.V[0];
                             tri.V[2] = triangle1.V[0];
    
                             if (IntrLine3Triangle3_Find(line, tri, TriBary)) {
                                  ClosestContactTime = min(ClosestContactTime, TriBary[2]);
                             }
                        }
                   }
    
                   if (2.0 != ClosestContactTime)
                   {
                        ContactTime = tmax * ClosestContactTime;
                        return true;
                   }
                   else
                   {
                        return false;
                   }
              }
         }
    
         void main()
         {
              // Shade all the fragments behind the z-buffer
              /*gl_FragColor = vec4(sin(verpos.x*50.0), sin(verpos.y*50.0), 1.0 + 0.0*sin(verpos.z*5.0), 1);
              return;*/
    
              /*Line3 line; line.Origin = vec3(verpos.x, verpos.y, -1); line.Direction = vec3(0, 0, 1);
              Triangle3 triangle; triangle.V[0] = tri0v0; triangle.V[1] = tri0v1; triangle.V[2] = tri0v2;
              float triBary[3];
              if (IntrLine3Triangle3_Find(line, triangle, triBary))
              {
                   gl_FragColor = vec4(triBary[0], triBary[1], triBary[2], 1);
              }
              else discard;
              return;*/
    
              Line3 line; line.Origin = vec3(verpos.x, verpos.y, -1); line.Direction = vec3(0, 0, 1);
              Triangle3 triangle0; triangle0.V[0] = tri0v0; triangle0.V[1] = tri0v1; triangle0.V[2] = tri0v2;
              Triangle3 triangle1; triangle1.V[0] = tri1v0; triangle1.V[1] = tri1v1; triangle1.V[2] = tri1v2;
              float ContactTime;
    
              /*gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
              if (IntrLine3Triangle3_Find(line, triangle0, 1.0, vec3(0.0), vec3(triangle1.V[0] - triangle0.V[0]), ContactTime))
              {
                   //gl_FragColor = vec4(1.0 - ContactTime, 1.0 - ContactTime, 1.0 - ContactTime, 1.0);
                   gl_FragColor.g = 1.0;
              }
              else gl_FragColor.r = 1.0;
              return;*/
    
              bool col = IntrLine3Triangle3_Find(line, triangle0, 1.0, vec3(0.0), vec3(triangle1.V[0] - triangle0.V[0]), ContactTime);
    
              if (col)
              {
                   float t0 = ContactTime;
    
                   if (IntrLine3Triangle3_Find(line, triangle1, 1.0, vec3(0.0), vec3(triangle0.V[0] - triangle1.V[0]), ContactTime))
                   {
                        float t1 = ContactTime;
    
                        //gl_FragColor = vec4(1.0 - t0 - t1, 1.0 - t0 - t1, 1.0 - t0 - t1, 1.0);
                        gl_FragColor = vec4(0.8, 0.3, 0.01, 1.0 - t0 - t1);
                   }
                   else
                        //gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
                        discard;
              }
              else
                   //gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
                   discard;
         }
    
         /*void main(void) {
              gl_FragColor = vec4(0.8, 0.3, 0.01, 1.0);
         }*/</font>

    Not sure if that is the motion blur effect, but it was the longest one, so I assumed it was. I tried to use this on its own, but I get an error message: "Assertion failure: Error linking shader program: Fragment varying _verpos does not match any vertex varying" I'm not a GLSL expert or novice even, so I have no idea what it's talking about.

    Thoughts? (Oh, and if we do get this working, we should ask him if we can use it, right?)

  • Yeah Neon Glow. It might as well replace current Glow effect which sorta doesn't work very well, like compared to Classic one;how do you make such links.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)