← Pixel Dreamer Studio

Stop a big spinning texture from looking grainy when it is drawn small

Import the texture with mipmaps and set the filter to Linear Mipmap. One without the other does nothing.

Select the texture, turn on Mipmaps > Generate in the Import dock and reimport, then set the Sprite2D's Texture > Filter to Linear Mipmap (TEXTURE_FILTER_LINEAR_WITH_MIPMAPS). In our Godot 4.7 test a thin-lined 1024 px magic circle drawn at 128 px was 14.6 brightness levels away on average from a clean 128 px version, and a 0.01 rad turn changed it almost twice as much as it changed the clean one. Mipmaps alone, or the filter alone, gave exactly the same numbers. With both it was 4.7 away, and the turn changed it less than the clean version.

The code

Put it on the Sprite2D that shows the circle. It sets the filter in code, warns in the Output panel when the texture was imported without mipmaps, and spins the sprite at spin_speed radians per second.

extends Sprite2D
## A big texture drawn small, like a magic circle that spins under a character, without the grain and sparkle.
## The texture must be imported with Mipmaps > Generate on.

@export var spin_speed := 0.6  # radians per second


func _ready() -> void:
	texture_filter = CanvasItem.TEXTURE_FILTER_LINEAR_WITH_MIPMAPS
	if texture and not texture.get_image().has_mipmaps():
		push_warning("%s has no mipmaps: turn on Mipmaps > Generate in the Import dock and reimport." % texture.resource_path)


func _process(delta: float) -> void:
	rotation += spin_speed * delta

What we measured

A white magic circle with 6 rings, 48 spokes and 24 dots, 1024 x 1024 with lines 2 to 4 px wide, shown at scale 0.125 on a black screen. The reference was the same image shrunk to 128 px beforehand with a high-quality filter and drawn at full size. We averaged the brightness difference (0 to 255) over the circle against the reference at 0.30 rad, and between 0.30 and 0.31 rad. Two runs gave the same numbers.

Why one setting is not enough

Mipmaps are smaller copies of the texture made at import time. The Linear filter never reads them, so importing them alone changes nothing on screen. The Linear Mipmap filter reads them, but only if they exist, so setting it on a texture imported without them changes nothing either. Without mipmaps, each screen pixel of the shrunk circle samples the full-size image at one spot, so a thin line is hit or missed depending on the angle, which is the sparkle you see while it spins.

Where it matters

Ready-made magic circles: PD Sigil Forge Pro generates magic circles in 8 styles and exports large PNGs, SVG and spinning animations, with a Godot option. Import the PNGs with mipmaps when you draw them small.

Tested in Godot 4.7 with the Compatibility renderer.

Ready-made: PD Sigil Forge Pro generates magic circles in 8 styles and exports large PNGs, SVG and spinning animations.

More how-tos: Auras, rings, beams and weather