@multiplekex/shallot 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplekex/shallot",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -520,13 +520,18 @@ fn fs(input: VertexOutput) -> FragmentOutput {
520
520
  // Smoothstep with adaptive band
521
521
  let alpha = smoothstep(aaDist, -aaDist, signedDist);
522
522
 
523
- if alpha < 0.01 {
523
+ // Dilate mask by FXAA span (8 pixels) to prevent edge bleeding
524
+ let fxaaSpan = aaDist * 8.0;
525
+ let inMaskRegion = signedDist < fxaaSpan;
526
+
527
+ // Only discard if outside both visible region and mask region
528
+ if alpha < 0.01 && !inMaskRegion {
524
529
  discard;
525
530
  }
526
531
 
527
532
  var out: FragmentOutput;
528
533
  out.color = vec4(input.color.rgb, input.color.a * alpha);
529
- out.mask = select(0.0, 1.0, alpha > 0.01);
534
+ out.mask = select(0.0, 1.0, inMaskRegion);
530
535
  return out;
531
536
  }
532
537
  `;