diff options
author | jjesswan <jessica_wan@brown.edu> | 2024-05-06 20:29:14 -0400 |
---|---|---|
committer | jjesswan <jessica_wan@brown.edu> | 2024-05-06 20:29:14 -0400 |
commit | eb8af873097ce73a22139db4924ebd41d766f011 (patch) | |
tree | 2ba63f06e8b787b8091cf1ac8a71974191ac57bb /resources | |
parent | d8bf256cf18327f48061ed875c98109200288733 (diff) |
foam done
Diffstat (limited to 'resources')
-rw-r--r-- | resources/images/foam4.png | bin | 0 -> 10850158 bytes | |||
-rw-r--r-- | resources/shaders/foam.frag | 10 | ||||
-rw-r--r-- | resources/shaders/foam.vert | 8 |
3 files changed, 10 insertions, 8 deletions
diff --git a/resources/images/foam4.png b/resources/images/foam4.png Binary files differnew file mode 100644 index 0000000..0b91836 --- /dev/null +++ b/resources/images/foam4.png diff --git a/resources/shaders/foam.frag b/resources/shaders/foam.frag index 8f5df85..af0cf4c 100644 --- a/resources/shaders/foam.frag +++ b/resources/shaders/foam.frag @@ -32,7 +32,7 @@ float getSaturation(vec2 k, vec2 xzPos, float adjWaveLength, float phaseC){ void main() { float height = pos.y; - float saturation = constants[0];//getSaturation(dir, vec2(pos.x, pos.z), 512.f, constants[0]); + float saturation = constants[0];//getSaturation(dir, vec2(pos.x, pos.z), 200.f, constants[0]); vec4 m_uv = texture(halftone_texture, tex); float m_threshold = m_uv.r * m_uv.g * m_uv.b; @@ -44,10 +44,10 @@ void main() { vec4 g = clamp(.5*saturation - m_threshold, 0, 1) * h; // apply foam texture - vec4 foam = texture(foam_texture, tex*.3); - vec4 j = vec4(22, 33, 54, 100)/255; - if (saturation > m_threshold) j = vec4(vec3(g*foam), 1); + vec4 foam = texture(foam_texture, tex*3); + vec4 j = vec4(0,0,0,0); + if (saturation > m_threshold) j = vec4(g*foam); - fragColor = vec4(vec3(saturation), 1); + fragColor = vec4(vec3(j), saturation); } diff --git a/resources/shaders/foam.vert b/resources/shaders/foam.vert index a33e343..f27c589 100644 --- a/resources/shaders/foam.vert +++ b/resources/shaders/foam.vert @@ -1,7 +1,9 @@ #version 330 core layout(location = 0) in vec3 position; // Position of the vertex -layout(location = 1) in float wavelength; // wavelenth adjusted for ocean depth +layout(location = 1) in vec3 wavelength; // wavelenth adjusted for ocean depth +layout(location = 2) in vec3 wavedirs; // wavelenth adjusted for ocean depth + //layout(location = 2) in vec2 direction; // wave slope //layout(location = 3) in vec2 texCoords; // texture coords //layout(location = 3) in vec3 norm; // texture coords @@ -43,8 +45,8 @@ vec2 calculateTexCoord(vec3 pos){ } void main() { - dir = vec2(0,0); - constants = vec2(wavelength, phaseC); + dir = vec2(wavedirs[0],wavedirs[1]); + constants = vec2(wavelength[0], phaseC); gl_Position = proj * view * model * vec4(position, 1); pos = vec3(gl_Position); |