Play around with shaders
This commit is contained in:
parent
5d9d0ef716
commit
4953051965
2 changed files with 80 additions and 3 deletions
38
fire.glsl
Normal file
38
fire.glsl
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
uniform float time;
|
||||
uniform vec2 mouse;
|
||||
uniform vec2 resolution;
|
||||
|
||||
float smove(float value)
|
||||
{
|
||||
return (value + 1.0)/2.0;
|
||||
}
|
||||
|
||||
float rand(vec2 co){
|
||||
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec2 pos = gl_FragCoord.xy; // rename for more meaty code
|
||||
mouse.y = -mouse.y;
|
||||
// vec2 uv = pos/resolution.xy;
|
||||
// vec2 muv = mouse/resolution.xy;
|
||||
|
||||
float scale = 100;
|
||||
float modifier = sin(pos.x/scale + time)*sin(pos.y/scale - time);
|
||||
modifier = smove(modifier);
|
||||
|
||||
float dist = distance(gl_FragCoord.xy, mouse);
|
||||
float radius = smove(sin(time))*50 + 100;
|
||||
|
||||
float value = max(1 - dist/radius, 0);
|
||||
value = value + modifier*0.3;
|
||||
|
||||
value = value + (rand(pos.x*pos.y)-0.5)*0.03;
|
||||
|
||||
gl_FragColor = vec4(value);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue