Baltor Get started

Gallery / Godot shaders

Unsharp mask sharpening

In your harnessGodot shaderMIT

Sharpen the rendered image with an unsharp mask: the difference between each pixel and a small blur of its neighbourhood is added back, with a threshold that leaves noise and flat areas alone and a luminance-only option.

Render of Unsharp mask sharpening
The render its check recorded in Godot 4.7.2, 256 by 256 pixels.

What it takes and gives

Shader type
spatial
Render modes
unshaded, cull_disabled, depth_test_disabled, depth_draw_never, skip_vertex_transform, fog_disabled
Parameters
screen_texture (sampler2D), amount (float = 1.2), radius_pixels (float = 1), threshold (float = 0.01), luminance_only (bool = yes)
Use it on
A MeshInstance3D with a 2 x 2 QuadMesh, material.tres as its material override and a large extra cull margin, as in demo.tscn.
Result
The scene with crisper edges and slightly stronger texture.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/post_unsharp_sharpen/

Limits. Over-sharpening creates bright and dark halos along edges. Sharpening also enhances aliasing and noise above the threshold. The pass reads Godot's screen texture after opaque geometry, so transparent objects drawn after it are not processed and its order among other transparent passes is not controlled.

Details

Kind
Godot shader
Engine
Godot 4.3 or later
Files
11 files, 62.8 KB
Licence
MIT
Declared effects
reads files, runs commands
Checked with
Godot 4.7.2, opengl3 compatibility (Mesa llvmpipe, Xvfb)
Checks
contract static, engine run, engine log clean, shader in scene, capture written, render not uniform, shader changes pixels
Techniques
Unsharp masking with a 3 x 3 binomial blur, Detail threshold, Luminance-only detail
Tags
godot shader, spatial, post-process, sharpen, unsharp mask, clarity, image filter, full-screen
Identity
library.supply.creative_originals.5d4de13aecf8581e7e8a60a8.e930a80ebf04f306
Version
e930a80ebf04f30659aba4e3f60b04f53ec97587f665475a68b9b16f1c031e97

The version is the SHA-256 of the item your harness downloads; every file in it names its own checksum.

Something wrong with this item, its rights or its safety? Report it on the support page, or from your harness after a download.