โ† All examples

godot shaders

Smooth nearest sampling for scaled pixel art

Keep pixel art crisp but free of shimmering when it is rotated, moved by sub-pixels or scaled by non-integer factors: texel edges are blended over exactly one screen pixel with linear filtering, interiors stay flat.

Recorded render of Smooth nearest sampling for scaled pixel art

What this component contains

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • component.json
  • demo.tscn
  • inspect_shader.py
  • material.tres
  • preview.png
  • sprite_pixel_art_aa.gdshader
  • test_package.py
  • verification/native.json

How it works

Shader type
canvas_item
Parameters
edge_sharpness (float = 1), enabled (bool = yes)
Use it on
A pixel art texture on a Sprite2D whose `texture_filter` is set to Linear (as in `demo.tscn`).
Result
A 24-pixel sprite scaled seven times with crisp, flat texels and smooth edges.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/sprite_pixel_art_aa/

Recorded checks

godot 4.7.2.stable.official.ed1daf0bf

  • contract_static
  • engine_run
  • engine_log_clean
  • shader_in_scene
  • capture_written
  • render_not_uniform
  • shader_changes_pixels

Limits to consider

Requires the node's texture filter set to Linear; with Nearest filtering it has no effect. Mipmaps must be off or the blend smears when minified.