Inferno icon indicating copy to clipboard operation
Inferno copied to clipboard

Match private _variableBlur_ CAFilter behavior (including inputNormalizeEdges)

Open quentinfasquel opened this issue 1 month ago • 1 comments

I’m trying to match the behavior of Apple’s private variableBlur CAFilter using Inferno’s variable blur effect, and I’m seeing two differences when comparing them side-by-side (left: Variablur in Inferno, right: private variableBlur CAFilter).

Image

Differences observed

1. Blur radius mismatch (minor)

For the same blur radius value, the amount of blur does not visually match between Variablur and the private variableBlur filter.

  • This is not a blocker, since we can compensate by adjusting the radius depending on which implementation we use.
  • Still, it would be nice to understand if there’s a systematic offset or scaling factor we can rely on.

2. Unwanted “vignette” effect (major)

The more problematic difference is an unwanted vignetting / darkening at the edges when using Inferno’s Variablur.

  • With the private variableBlur CAFilter, this is avoided by setting inputNormalizeEdges = true on the filter.
  • I haven’t found an equivalent way to normalize edges with Inferno’s implementation.

I am not sure the intention was ever to replicate perfectly the variable blur, but it would be great.

quentinfasquel avatar Nov 20 '25 14:11 quentinfasquel

I contributed the variable blur shader originally and will take a look at this.

~~I think I tried to make it so areas where the mask is fully opaque would match SwiftUI’s blur(radius:) modifier, but forgot to take the display scale into account so it’s treating it as pixels where the built in one treats it as points. For now you should be able to multiply your desired blur radius by the environment’s displayScale to get something fairly close to what blur(radius:) provides. Not sure how that compares to the private CAFilter, tbh.~~ Edit: nvm, it’s not the displayScale thing. Multiplying the radius by 2 should be a decent match for the built-in blur(radius:) regardless of display scale. I’ll try to make it match out of the box.

Will look into adding an option to normalize the edges.

daprice avatar Nov 20 '25 22:11 daprice