Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f7be7854 authored by Yein Jo's avatar Yein Jo
Browse files

Last sync for the rain effect.

Minor changes in the effects such as adding some smoothstep. This is the
last CL for the rain effect.

Bug: 325090421
Test: Manual
Flag: NA
Change-Id: I8bea0b0a7590cee27177eba69821b08feab37218
parent 24514da1
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -149,7 +149,7 @@ GlassRain generateGlassRain(
/**
 * Generate rain drops that stay in place on the glass surface.
 */
vec3 generateStaticGlassRain(vec2 uv, half screenAspectRatio, half time) {
vec3 generateStaticGlassRain(vec2 uv, half screenAspectRatio, half time, half intensity) {
    vec2 gridSize = vec2(15., 15.);
    // Aspect ratio impacts visible cells.
    gridSize.y /= screenAspectRatio;
@@ -187,7 +187,9 @@ vec3 generateStaticGlassRain(vec2 uv, half screenAspectRatio, half time) {
    normalizedTime *= normalizedTime;

    vec2 pos = cellUv * (1.5 - 0.5 * cellId + normalizedTime * 50.);
    float mask = smoothstep(0.3, 0.2, length(pos)) * smoothstep(0.2, 0.06, normalizedTime);
    float mask = smoothstep(0.3, 0.2, length(pos))
                 * smoothstep(0.2, 0.06, normalizedTime)
                 * smoothstep(0., 0.45, intensity);

    return vec3(pos * 0.19, mask);
}
+1 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ vec4 main(float2 fragCoord) {
        medDrippingRain.dropplets * medDrippingRain.droppletsMask, medDrippingRain.droppletsMask);

    // 4. Add static rain droplets on the glass surface. (They stay in place and dissapate.)
    vec3 staticRain = generateStaticGlassRain(uv, screenAspectRatio, time);
    vec3 staticRain = generateStaticGlassRain(uv, screenAspectRatio, time, intensity);
    dropMask = max(dropMask, staticRain.z);
    dropUvMasked = mix(dropUvMasked, staticRain.xy * staticRain.z, staticRain.z);

+3 −1
Original line number Diff line number Diff line
@@ -74,7 +74,9 @@ vec3 drawSplashes(vec2 uv, vec2 fragCoord, vec3 color) {
    // Normalized time [0, 1].
    float cellTime = max((mod(t + delay * cellId, duration + delay) - delay) / duration, 0.);

    return normalBlendWithWhiteSrc(color, drawSplash(cellUv, cellTime));
    float splash = drawSplash(cellUv, cellTime) * smoothstep(0., 0.45, intensity);

    return normalBlendWithWhiteSrc(color, splash);
}

vec4 main(float2 fragCoord) {