Skip to content
Snippets Groups Projects
Commit dcff5c35 authored by dg's avatar dg
Browse files

shadow_simulacrum shader is now parametrized

git-svn-id: http://svn.net-core.org/repos/t-engine4@5384 51575b47-30f0-44d4-a5cc-537603b46e54
parent 41427007
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,9 @@
#extension GL_EXT_gpu_shader4: enable
uniform sampler2D tex;
uniform vec4 color;
uniform vec3 color;
uniform float base;
uniform float time_factor;
uniform float tick;
uniform vec2 p2 = vec2(1.0, 1.0);
......@@ -42,7 +44,7 @@ float noise3f(in vec3 p)
#define ty(x,y) (pow(.5+sin((x)*y*6.2831)/2.0,2.0)-.5)
#define t2(x,y) \
ty(y + 2.0*ty(x+2.0*noise3f(vec3(cos((x)/3.0)+x,y+tick/3000.0,(x)*.1)),.3),.7)
ty(y + 2.0*ty(x+2.0*noise3f(vec3(cos((x)/3.0)+x,y+tick/time_factor,(x)*.1)),.3),.7)
#define tx(x,y,a,d) \
((t2(x, y) * (a - x) * (d - y) + \
t2(x - a, y) * x * (d - y) + t2(x, y - d) * (a - x) * y + \
......@@ -62,5 +64,5 @@ void main(void)
vec2 uv = gl_TexCoord[0].xy * p2;
uv -= floor(uv);
gl_FragColor = texture2D(tex, gl_TexCoord[0].xy);
gl_FragColor.rgb = fx(uv) * 0.7 + (gl_FragColor.rgb * 0.3);
gl_FragColor.rgb = fx(uv) * color + (gl_FragColor.rgb * base);
}
......@@ -21,6 +21,9 @@ return {
frag = "shadow_simulacrum",
vert = nil,
args = {
color = color or {0.7, 0.7, 0.7},
base = base or 0.3,
time_factor = time_factor or 3000,
},
clone = false,
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment