# What shader effects do you want?

Share your Construct 2 effect files

### » Tue Apr 30, 2013 8:00 pm

B
7
S
3
G
1
Posts: 154
Reputation: 1,812

### » Wed May 08, 2013 8:20 pm

Not sure if this has been said already, but something like this would be nice:
B
16
S
5
G
3
Posts: 47
Reputation: 2,276

### » Fri May 17, 2013 11:53 am

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.thatjoshguy2013-05-17 11:54:52
B
8
Posts: 32
Reputation: 1,039

### » Thu Jun 06, 2013 2:37 am

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:

[code]#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);
}
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);
}
else
//gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}

/*void main(void) {
gl_FragColor = vec4(0.8, 0.3, 0.01, 1.0);
}*/
[/code]

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?)
B
29
S
7
G
5
Posts: 202
Reputation: 5,310

### » Sat Jun 15, 2013 8:44 am

[QUOTE=Kiyoshi] Yeah Neon Glow. It might as well replace current Glow effect which sorta doesn't work very well, like compared to Classic one;[/QUOTE] how do you make such links.
:|
B
49
S
9
G
5
Posts: 72
Reputation: 9,072

### » Tue Jun 25, 2013 3:09 pm

That is exactly what I am looking for as well! Great diagram by the way. I noticed this was on May 8th, any update so far that anyone has heard recently?
B
23
S
3
G
4
Posts: 23
Reputation: 3,429

### » Wed Jun 26, 2013 2:12 am

This would be a start for 2D shadow casting.
B
32
S
10
G
7
Posts: 416
Reputation: 7,294

### » Mon Jul 08, 2013 11:40 pm

Hey guys, I was wondering if someone would either make or give advice on a glitch effect, similar to the one shown in the flixel power tools

image example

I've had a look at the source code for the glitch effect, and it appears they move a row of pixels at a time in a random X direction, where the maximum distance moved is dependant on a Glitch Size value, and the height is dependant on a Glitch Skip value.

Sadly, I'm not good with Shaders, and I've never done GLSL shaders, so it would be awesome if someone could make a shader do this on a sprite or at least point me in the right direction on how to do it myself.
B
24
S
5
G
1
Posts: 89
Reputation: 3,015

### » Fri Jul 12, 2013 6:43 am

hello i am lash serum.nice your froums post site.

great latisse - bimatoprosthttp://www.anymedsrx.com/latisse/
B
1
Posts: 1
Reputation: 127

### » Mon Jul 22, 2013 4:47 pm

[QUOTE=coolernow123] Not sure if this has been said already, but something like this would be nice:
[/QUOTE]

I'd love to have something like this as I currently need it.
B
12
S
2
Posts: 85
Reputation: 899

PreviousNext