Skip to content
All articles Optics and performance

How QuickLiquid Shares Displacement Maps

See which lenses can reuse work, when updates rebuild the filter, and how to check in a real layout.

Two glasses can share a displacement map when the geometry and sampling inputs match. The 0.2.0 cache shares the in-flight map generation as well as the completed image while consumers still hold references to it.

Give repeated controls matching geometry

Matching width, height, effective radius, bezel, thickness, and index of refraction are part of the picture. Resolved map dimensions, filter padding derived from blur, and magnification also participate in the key. Padding comes in steps, so a minor blur adjustment can sometimes keep the same map key even when the rendered frost changes.

Keep repeated controls at common dimensions when that fits the design. If each button grows to a different text width, use the measured layout in your benchmark. After the final engine releases a map, the cache revokes the image URL, so do a separate test for concurrent reuse and mounting after everything has unmounted.

Separate map reuse from filter updates

At magnification: 1, changing a positive refraction strength without a dispersion graph change can update SVG scale attributes in place. Crossing zero strength, changing which dispersion graph is used, or changing lens geometry can trigger a filter rebuild. With magnification above one, strength also contributes to the map key. A filter rebuild can still retrieve an image that is already cached.

Compare LiquidGlassEngine.collectMetrics() before and after adding a second set of controls. Record the changes in mapsGenerated and cacheHits, and separately check filterBuilds for each relevant engine. See the versioned engine source for the exact key and invalidation conditions.