I’ve decided to remake this resource because I found it very jumbled and not that optimized. For example, my code (one single module, type-safe as-well) is about 170 lines. As for optimizations, the original resource used to clone and parent a local script which created a multitude of Parts with SpecialMeshes set to Wedge (mind you, not even a WedgePart) and whip up the shape of a rectangle that way. My module simply creates a part which should cover the entire frame. It would also hide that part if either the ScreenGui or the Frame itself is visible.
Usage:
Code-wise
If you only want to handle blurring manually, then the module presents 3 simple functions (which you’d need only 2) for usage:
.new
(GuiObject: GuiObject, Arguments: UIBlurArguments) : UIBlur
This function simply creates the blur effect on a (usually Frame)GuiObject
instance. The arguments table accept as follows:
{
Corner : number?, -- 0 - 3
Fragmented : boolean?, -- Little sunlight effect using displaced geometry
Inverted : boolean?, -- Inverts the screen colors for that particular GuiObject
DisableBelowNeededGraphics : boolean?, -- Disables the blur effect if the "QualityLevel" is set to a value below 8
}
-
Update(self: UIBlur)
simply updates the blur effect. This is a function which you don’t need to call since the module already updates the effect Pre-Render. -
Destroy(self: UIBlur)
simply destroys the blur effect (not the BlurEffect instance, see Object-wise for info) and clears the little resources it used.
For an example on how to use, you simply:
local UIBlur = require(game.ReplicatedStorage.UIBlur)
UIBlur.new(script.Parent.Frame)
Object-wise
If the module’s AutoAddEnabled
attribute is enabled, the module will automatically* scan the Player’s PlayerGui for BlurEffect instances, and apply a blur effect accordingly. Setting the BlurEffect.Enabled
to false also disables the blur, like the real thing! Beware however with rounded frames, as the module will try its best to add the best corner to the blur, however it isn’t perfect. I recommend code-generated blur for frames with UICorners!
*Note: for the auto-adder to work, the module should be required, but only that! No need to actually use the .new
function.
Features (BloatWare):
Corners?
Yes, the module uses a pre-modelled MeshPart instead of a regular part for rounding. Corners also support fragmentation! This method isn’t that good either, because on 1:1 ratios the corner will look stretched, but this is best for buttons.
- Level 1 is a barely rounded square
- Level 2 is a square rounded 50% of the way
- Level 3 is a circle
Fragmentation?
Yes, since the parts used to make the blur are Glass-material, with some neat geometry one could make a “shiny” bloom just like below (third frame):
Inverted colors?
Yes, using a cool little trick from a tutorial (linked in the Update Log) I also added this functionality. Beware that it might look too crisp for simple usage, so I recommend turning this on only for a square Frame. The sample place file provided below also features a ColorCorrection effect (disabled by default).
Make sure the version of the module (found at line 5
) and this post’s title match to get the latest product!
UI Blurs Sample Place File (73.8 KB)
Despite the name, I think this may have become too bloated.
Please let me know if you encounter any issues/bugs, or have improvement ideas!
Update Log
16 May 2024
- Changed how arguments passed on Blur creation are made, please update all your scripts accordingly (I know I should’ve done this when I added Fragmentation sorry)
- Added inverted colors (thanks to this tutorial)
11 May 2024
- Added fragmentation (order of arguments changed!)
- Added variable depth scaling depending on the
Corner
used (DepthOfField is weird)
26 April 2024
- Added a sample place file
25 April 2024
- Added functionality to the corner argument
- Updated
Part.Size
formula