diff options
author | jjesswan <jessica_wan@brown.edu> | 2024-05-06 00:01:04 -0400 |
---|---|---|
committer | jjesswan <jessica_wan@brown.edu> | 2024-05-06 00:01:04 -0400 |
commit | 2ba27898535e01298ef8f0d0b9ffd4e69ce13458 (patch) | |
tree | 18dac0a37704ba9c2271f185d62ea4a6d4873b61 /resources/shaders/foam.frag | |
parent | 72bcf6a346dfcaeaac9520d8c524711192e77c3d (diff) |
uv mapping onto water good
Diffstat (limited to 'resources/shaders/foam.frag')
-rw-r--r-- | resources/shaders/foam.frag | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/resources/shaders/foam.frag b/resources/shaders/foam.frag new file mode 100644 index 0000000..86403d8 --- /dev/null +++ b/resources/shaders/foam.frag @@ -0,0 +1,33 @@ +#version 330 core + +in vec4 saturation_const; +in vec2 dir; +in vec2 tex; +in vec3 pos; + + +uniform float time; +uniform sampler2D halftone_texture; +uniform vec2 widthBounds; +uniform vec2 lengthBounds; + +out vec4 fragColor; + +float getSaturation(vec2 k, vec2 xzPos, float adjWaveLength, float phaseC){ + float result = dot(k, xzPos) * 3.14f / adjWaveLength; + result = result + phaseC*time*.5f; + result = -tan(result) + 1.57f; + result = exp(result) / 4.f; + + return result; + +} + + + +void main() { + //float saturation = getSaturation(saturation_const[0], saturation_const[1],saturation_const[2],saturation_const[3]); + vec4 color = texture(halftone_texture, tex); + + fragColor = vec4(vec3(color), 1); +} |