Bloom is the effect of strong light sources spilling over into neighbouring dark areas. It is used a lot in video games and movies to give the effect of strong light, even though the monitor is not itself capable of showing light at that strength.

with_bloom(
x,
threshold_lower = 80,
threshold_upper = 100,
sigma = 5,
strength = 1,
keep_alpha = TRUE,
...
)

Arguments

x

A ggplot2 layer object, a ggplot, a grob, or a character string naming a filter

threshold_lower, threshold_upper

The lowest channel value to consider emitting light and the highest channel value that should be considered maximum light strength, given in percent

sigma

The standard deviation of the gaussian kernel used for the bloom. Will affect the size of the halo around light objects

strength

A value between 0 and 1 to use for changing the strength of the effect.

keep_alpha

Should the alpha channel of the layer be kept, effectively limiting the bloom effect to the filtered layer. Setting this to false will allow the bloom to spill out to the background, but since it is not being blended correctly with the background the effect looks off.

...

Arguments to be passed on to methods. See the documentation of supported object for a description of object specific arguments.

Value

Depending on the input, either a grob, Layer, list of Layers, guide, or element object. Assume the output can be used in the same context as the input.

Examples

library(ggplot2)
points <- data.frame(
x = runif(1000),
y = runif(1000),
col = runif(1000)
)
ggplot(points, aes(x, y, colour = col)) +
with_bloom(
geom_point(size = 10),
) +
scale_colour_continuous(type = 'viridis')