Skip to content

Instantly share code, notes, and snippets.

@marcouberti
Last active December 11, 2020 13:35
Show Gist options
  • Save marcouberti/4e4456f12348791293448c26bd444a84 to your computer and use it in GitHub Desktop.
Save marcouberti/4e4456f12348791293448c26bd444a84 to your computer and use it in GitHub Desktop.
KodeLife basic texture shader
#version 150
uniform float time;
uniform vec2 resolution;
uniform vec2 mouse;
uniform vec3 spectrum;
uniform sampler2D texture0;
uniform sampler2D texture1;
uniform sampler2D texture2;
uniform sampler2D texture3;
uniform sampler2D prevFrame;
uniform sampler2D prevPass;
in VertexData
{
vec4 v_position;
vec3 v_normal;
vec2 v_texcoord;
} inData;
out vec4 fragColor;
void main(void)
{
vec2 uv = gl_FragCoord.xy / resolution;
// displacement
vec2 d = vec2(sin(time)*0.1, cos(time)*0.1);
// texture + displacement
vec3 fb = texture(texture0, uv + d).rgb;
// coloring
fragColor = vec4(fb, 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment