Forums > Jitter

Jitter shader

October 6, 2013 | 11:47 am

HI
I’m trying to replicate this shader http://glsl.heroku.com/e#11398.1 with Max,
but I don’t understand how to load the shader.
Can someone give me an hint?
I rewrite the shader inside a jxs file (see below)
I really appreciate your help. Thanks.
Paolo

<code>

– Pasted Max Patch, click to expand. –

</code>


October 6, 2013 | 11:49 am

I can upload the shader, here it is

<jittershader name="test">
<description>
the first time I write a shader
</description>

<param name="time" type="float" default="0.0" />
<param name="mouse" type="vec2" default="150.0 150.0" />
<param name="resolution" type="vec2" default="1.0 1.0" />

<language name="glsl" version="1.0">
<bind param="time" program="fp" />
<bind param="mouse" program="fp" />
<bind param="resolution" program="fp" />

<program name="vp" type="vertex" source="sh.passthrudim.vp.glsl" />
<program name="fp" type="fragment">

<![CDATA[

//the essential stuff

//from the original file
uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;

void main()
{
vec2 position = (gl_FragCoord.xy / resolution.xy) + (mouse / 4.0);

float color = 0.0;
color += sin(position.x * cos(time / 15.0) * 80.0) + cos(position.y * cos(time / 15.0) * 10.0);
color += sin(position.y * sin(time / 10.0) * 40.0) + cos(position.x * sin(time / 25.0) * 40.0);
color += sin(position.x * sin(time / 5.0 ) * 10.0) + sin(position.y * sin(time / 35.0) * 80.0);
color *= sin(time / 10.0) * 0.5;

gl_FragColor = vec4(vec3(color, color * 0.5, sin(color + time / 3.0) * 0.75), 1.0);
}

]]>

</program>
</language>
</jittershader>


October 8, 2013 | 12:26 pm

cool shader!
here ya go.

the time parameter can be generated using cpuclock
mouse coordinates are output from the jit.window.
resolution should be set from the size of the jit.window.

<code>

– Pasted Max Patch, click to expand. –

</code>


October 8, 2013 | 1:24 pm

cool ya!!
thanks Rob, with your help I write my first shader, finally!


Viewing 4 posts - 1 through 4 (of 4 total)