Newer
Older
pixi.js / src / filters / displacement / displacement.frag
@bchevalier bchevalier on 2 Jul 2015 381 bytes * Improved usability of displacement filter
precision mediump float;

varying vec2 vMapCoord;
varying vec2 vTextureCoord;
varying vec4 vColor;

uniform vec2 scale;

uniform sampler2D uSampler;
uniform sampler2D mapSampler;

void main(void)
{
   vec4 map =  texture2D(mapSampler, vMapCoord);

   map -= 0.5;
   map.xy *= scale;

   gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y));
}