summaryrefslogtreecommitdiff
path: root/resources
diff options
context:
space:
mode:
authorjjesswan <jessica_wan@brown.edu>2024-05-07 01:32:02 -0400
committerjjesswan <jessica_wan@brown.edu>2024-05-07 01:32:02 -0400
commitcb868acadcae4e3f497ecdabeca507f3e73e01c7 (patch)
treef7caa27311d6a7291be66cf98376223f7f283179 /resources
parenteb8af873097ce73a22139db4924ebd41d766f011 (diff)
add more accurate foam height saturation, poppping bubble effect
Diffstat (limited to 'resources')
-rw-r--r--resources/images/foam3.pngbin2042062 -> 4000051 bytes
-rw-r--r--resources/images/halftone.pngbin30448 -> 219172 bytes
-rw-r--r--resources/shaders/foam.frag12
3 files changed, 6 insertions, 6 deletions
diff --git a/resources/images/foam3.png b/resources/images/foam3.png
index ab48f97..1113912 100644
--- a/resources/images/foam3.png
+++ b/resources/images/foam3.png
Binary files differ
diff --git a/resources/images/halftone.png b/resources/images/halftone.png
index e059862..cc11eba 100644
--- a/resources/images/halftone.png
+++ b/resources/images/halftone.png
Binary files differ
diff --git a/resources/shaders/foam.frag b/resources/shaders/foam.frag
index af0cf4c..be95183 100644
--- a/resources/shaders/foam.frag
+++ b/resources/shaders/foam.frag
@@ -33,21 +33,21 @@ 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), 200.f, constants[0]);
- vec4 m_uv = texture(halftone_texture, tex);
- float m_threshold = m_uv.r * m_uv.g * m_uv.b;
+ vec4 m_uv = texture(halftone_texture, tex*2);
+ float m_threshold = (m_uv.r + m_uv.g + m_uv.b) / 3;
// final rgba color at x,z pos
vec4 h = vec4(0,0,1,1);
if (saturation > m_threshold) h = vec4(1,1,1, 1);
// add fading effect to bubble popping
- vec4 g = clamp(.5*saturation - m_threshold, 0, 1) * h;
+ vec4 g = clamp(saturation - m_threshold, 0, 1) * h;
// apply foam texture
- vec4 foam = texture(foam_texture, tex*3);
+ vec4 foam = texture(foam_texture, tex + time*.0003);
vec4 j = vec4(0,0,0,0);
- if (saturation > m_threshold) j = vec4(g*foam);
+ if (saturation > m_threshold) j = g*foam*1.8;
- fragColor = vec4(vec3(j), saturation);
+ fragColor = j; //vec4(vec3(g), 1);
}