- #version 330
- //fragment shader output
- layout(location=0) out vec4 vFragColor;
- //input from the vertex shader
- smooth in vec2 vUV; //current texture coordinates
- //shader uniforms
- uniform sampler2D x0; //old density or velocity field
- //determine texture size
- float sizeX = textureSize(x0, 0).x;
- float sizeY = textureSize(x0, 0).y;
- float stepX = 1.0/sizeX;
- float stepY = 1.0/sizeY;
- void main(void)
- {
- vec4 C = texture(x0, vUV);
- vec4 N = texture(x0, vUV + vec2( 0 , -stepY));
- vec4 S = texture(x0, vUV + vec2( 0 , stepY));
- vec4 W = texture(x0, vUV + vec2(-stepX, 0 ));
- vec4 E = texture(x0, vUV + vec2( stepX, 0 ));
- vFragColor = -4*C + N + S + W + E;
- }
SHARE
TWEET
Untitled
a guest
Dec 19th, 2014
174
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

