Skip to content

Commit f7ebec5

Browse files
committed
Make the halo gentler
1 parent 1a9dc94 commit f7ebec5

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/app/(main)/community/events/map/shaders.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ void main() {
102102
float dist = length(fragPx - markerCenter);
103103
float innerRadius = baseHalfSquare + 0.4 * uCell;
104104
float outerRadius = innerRadius + 2.25 * uCell;
105-
float halo = (1.0 - smoothstep(innerRadius, outerRadius, dist)) * strength;
105+
float radiusDiff = max(outerRadius - innerRadius, 0.0001);
106+
float t = clamp((dist - innerRadius) / radiusDiff, 0.0, 1.0);
107+
float cubicEaseOut = 1.0 - pow(1.0 - t, 3.0);
108+
float halo = (1.0 - cubicEaseOut) * strength;
106109
haloIntensity = max(haloIntensity, halo);
107110
}
108111
}
@@ -118,16 +121,9 @@ void main() {
118121
float squareHalf = baseHalfSquare;
119122
vec2 delta = abs(fragPx - center);
120123
bool insideSquare = delta.x <= squareHalf && delta.y <= squareHalf;
121-
if (!insideSquare) {
122-
if (haloIntensity <= 0.0) {
123-
discard;
124-
}
125-
float haloAlpha = clamp(haloIntensity, 0.0, 1.0);
126-
color = mix(uSeaColor, uMarkerColor, haloAlpha);
127-
outColor = vec4(color, 1.0);
128-
return;
129-
}
130-
if (markerType <= 0.5 && landCoverage < 0.5) {
124+
bool isSeaCell = markerType <= 0.5 && landCoverage < 0.5;
125+
bool shouldRenderHalo = !insideSquare || isSeaCell;
126+
if (shouldRenderHalo) {
131127
if (haloIntensity <= 0.0) {
132128
discard;
133129
}

0 commit comments

Comments
 (0)