Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <jittershader name="normalmapper">
- <param name="tex0" type="int" default="0" />
- <param name="size" type="vec2" default="1.0 0.0" />
- <language name="glsl" version="1.50">
- <bind param="scale" program="fp" />
- <bind param="tex0" program="fp" />
- <bind param="size" program="fp" />
- <program name="vp" type="vertex" source="sh.passthrudim.vp.glsl" />
- <program name="fp" type="fragment" >
- <![CDATA[
- uniform sampler2D tex0;
- uniform vec2 size;
- varying vec2 texcoord0;
- const ivec3 off = ivec3(-1,0,1);
- void main(void)
- {
- vec4 wave = texture2D(tex0,texcoord0);
- float s11 = wave.x;
- float s01 = textureOffset(tex0, texcoord0, off.xy).x;
- float s21 = textureOffset(tex0, texcoord0, off.zy).x;
- float s10 = textureOffset(tex0, texcoord0, off.yx).x;
- float s12 = textureOffset(tex0, texcoord0, off.yz).x;
- vec3 va = normalize(vec3(size.xy,s21-s01));
- vec3 vb = normalize(vec3(size.yx,s12-s10));
- vec4 bump = vec4(cross(va,vb), s11);
- gl_FragColor = bump;
- }
- ]]>
- </program>
- </language>
- </jittershader>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement