Search In
• More options...
Find results that contain...
Find results in...
• Create Account

## Recommended Posts

Anybody have that?

Yeah that's cool, man. Thanks. Nice work. I'm getting some big drops though. What line affects the rain size?

And how did they get it to splash when it hits the ground?

Thanks, dude. You got me started off in the right direction.

#version 400

//Ma-Shell +

uniform sampler2D texture1;
uniform float currenttime;
uniform vec2 buffersize;
uniform bool isbackbuffer;
uniform mat4 projectioncameramatrix;

float time=currenttime/1000.0;

out vec4 fragData0;

vec2 hash22(vec2 p){
vec2 p2 = fract(p * vec2(.1031,.1030));
p2 += dot(p2, p2.yx+19.19);
return fract((p2.x+p2.y)*p2);
}
#define round(x) floor( (x) + .5 )

vec2 wetGlass(vec2 p) {
p += p * 0.1; // distort drops

float t = time;
p *= vec2(.025, .025 * .25);
p.y += t * .25; // make drops fall
vec2 rp = round(p);
vec2 dropPos = p - rp;
vec2 noise = hash22(rp);//randomizes drop placement
dropPos.y *= 4.;
t = t * noise.y + (noise.x*6.28);
vec2 trailPos = vec2(dropPos.x, fract((dropPos.y-t)*2.) * .5 - .25 );
dropPos.y += cos( t + cos(t) );  // make speed vary
float trailMask = clamp(dropPos.y*2.5+.5,0.,1.); // hide trail in front of drop
float dropSize  = dot(dropPos,dropPos);
float trailSize = clamp(trailMask*dropPos.y-0.5,0.,1.) + 0.5;
trailSize = dot(trailPos,trailPos) * trailSize * trailSize;
float drop  = clamp(dropSize  * -60.+ 3.*noise.y, 0., 1.);
float trail = clamp(trailSize * -60.+ .5*noise.y, 0., 1.);
trail *= trailMask; // hide trail in front of drop
return drop * dropPos + trailPos * trail;
}

float rain(vec2 uv, float scale, float time)
{
float w=smoothstep(1.0,0.0,-uv.y*(scale/10.0));
if(w<0.2)return 0.0;
uv+=time/scale;
uv.y+=time*2.0/scale;
uv.x+=sin(uv.y+time*.5)/scale;
uv*=scale;
vec2 s=floor(uv),f=fract(uv),p;
float k=3.0,d;
p=.5+.35*sin(11.0*fract(sin((s+scale)*mat2(vec2(7,3),vec2(6,5)))*7.0))-f;
d=length(p);
k=min(d,k);
k=smoothstep(0.003,k,sin(f.x+f.y)*0.01); //particle size sort of
return k*w;
}

void main(void)
{
vec2 uv=(gl_FragCoord.xy/buffersize);
if (isbackbuffer) uv.y = 1.0 - uv.y;

vec2 position = ( gl_FragCoord.xy - buffersize.xy* 0.5 ) / buffersize.x;
position.y+=projectioncameramatrix[1][3];
position.y-=1.0;

float angle = atan(position.y,position.x)/(0.5*3.14159265359);
vec4 color = texture(texture1,uv);

float c=smoothstep(1.0,0.3,clamp(uv.y*.3+.8,0.0,.75));

c+=rain(uv,20.0*angle,time)*.5;
c+=rain(uv-5,15.0*angle,time)*.8;
c+=rain(uv+5,10.0*angle,time);
c+=rain(uv+7,8.0*angle,time);
c+=rain(uv-5,6.0*angle,time);
c+=rain(uv,4.0*angle,time);
vec3 rainfall=(vec3(c));

uv += wetGlass(gl_FragCoord.xy/1.5);

fragData0 = texture(texture1, uv)/1.5+vec4( rainfall.r+color )*.3;
}

• 1 year later...
On 2/25/2019 at 9:22 PM, havenphillip said:

Thanks for that! I found this thread by luck.

There is anywhere I can find all the shaders developed by you and the community?

It's a cool effect. Thanks to Ma-Shell for posting it. I think the only collection of shaders currently is in the workshop. I'm thinking of starting a thread where I post a shader a week for a year, 52 shaders, then putting it in the workshop so there's a collection of shaders somewhere. I'm weighing it out. Just don't know if I'm good enough.

I did develop this a bit if you're looking for a whole wet look:

• 2
• 1

More shaders would be great, let's hope Josh make LE5 compatible with LE4 shaders

That would be great if he did. Otherwise I wonder if all that work would be kind of obsolete by the time LE5 comes out. I'd get in the practice, though.

I'm trying to make a list of shaders if you have any ideas.  I want to be reasonably sure I can do it before I commit to it. 52 shaders turns out to be a lot to think about lol. And  I don't want to just make goofy little shaders like "procedural checkerboard" or something. I want to make things people might actually use - stuff I would use.

Nice. I like all those little things you're using to create that ambience.

On 11/21/2020 at 8:03 AM, DoomSlayer said:

More shaders would be great, let's hope Josh make LE5 compatible with LE4 shaders

I've been working with Leadwerks 5 shaders and while LE4 shaders will need converting, the process shouldnt be too hard.  Depends on how complex the shader is.

Awesome .How is it so far? Exceeding expectations? The vibe I'm getting is that it'll be too complicated for someone like me and there won't be any help, so I won't be able to get anywhere with it. I just can't pay \$700 for something like that. Looks like it's going to be amazing, though.

For me, I'll never look back at LE4.  It's super fast.  Can handle so much more scene complexity.  Actually I'm under the impression that it will be more documented and supported than LE4.  There's a few new things to learn with shared pointers, and the fact the engine is multithreaded.  But overall it's pretty rad.   For the shader side of things it's not hard to grasp.  I'm actually 80% through a node editor for shader development in LE5 which will make it even easier.

1 hour ago, Lethal Raptor Games said:

Actually I'm under the impression that it will be more documented and supported than LE4.

that would be great

Cool.. Whats about the licens e of that shader ? Commercial free ok?

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×

• Pages

• #### Support

• Our Picks
• Projects
• Gallery
×
• Create New...