Godot 4 AtlasTexture and Region Import

A sprite sheet is one texture with many sprites. Godot needs to know which rectangle belongs to which frame. There are three common ways to say that, and they are easy to confuse:

  1. AtlasTexture — a resource that points at an atlas and a region.
  2. Sprite2D.region — a property on one node, for one sprite.
  3. SpriteFrames — an animation resource whose frames are usually AtlasTextures.

The right choice depends on whether you need one sprite, one animation, or a reusable asset.

AtlasTexture: a texture that is a window

AtlasTexture is a Texture2D resource. It references a larger texture plus a Rect2 region. Anything that accepts a texture can use it.

var atlas := AtlasTexture.new()
atlas.atlas = load("res://sprites/hero.png")
atlas.region = Rect2(64, 0, 64, 64)
$Sprite2D.texture = atlas

Properties that matter:

Property Meaning
atlas The source texture
region The rectangle to display, in pixels, from the top-left
margin Expands the region for filtering (usually 0)
filter_clip Clips sampling to the region instead of the whole atlas

filter_clip is the one people miss. With it off, a filtered sample near the edge can read pixels outside the region — the neighbor frame. With it on, the sample is clipped, which stops bleeding but can harden the edge. For pixel art with Filter off, it usually does not matter.

Sprite2D region: the one-node shortcut

If you only need one sprite from a sheet, you do not need a separate resource:

$Sprite2D.texture = load("res://sprites/hero.png")
$Sprite2D.region_enabled = true
$Sprite2D.region_rect = Rect2(64, 0, 64, 64)

This is the fastest path for a static prop, a portrait, or a UI icon. It is not reusable across nodes unless you duplicate the settings.

SpriteFrames: the animation container

SpriteFrames is the resource AnimatedSprite2D plays. Each frame is a texture; in a sheet-based workflow, each texture is an AtlasTexture pointing at one region.

A minimal .tres:

[gd_resource type="SpriteFrames" load_steps=4 format=3]

[ext_resource type="Texture2D" path="res://hero.png" id="1_sheet"]

[sub_resource type="AtlasTexture" id="AtlasTexture_0"]
atlas = ExtResource("1_sheet")
region = Rect2(0, 0, 64, 64)

[sub_resource type="AtlasTexture" id="AtlasTexture_1"]
atlas = ExtResource("1_sheet")
region = Rect2(64, 0, 64, 64)

[resource]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_1")
}],
"loop": true,
"name": &"idle",
"speed": 10.0
}]

The SpriteFrames generator writes this for you from a PNG + JSON, including one AtlasTexture per frame.

Which one should you use?

Need Use
One static sprite from a sheet Sprite2D.region
A reusable sprite texture AtlasTexture
A character animation SpriteFrames (with AtlasTexture frames)
A texture for a shader or material AtlasTexture
A UI icon from an atlas AtlasTexture or region

The region offset bug

The most common mistake is treating the region as relative to the cell. It is not. region is in pixels from the top-left of the atlas.

If the frame is in the second column of a 64 px grid, the region is:

Rect2(64, 0, 64, 64)

not Rect2(0, 0, 64, 64) with an offset on the node. Adding a node offset on top of a correct region moves the sprite twice.

Common issues

Symptom Cause Fix
Wrong sprite appears Region points at the wrong cell Recompute from the sheet coordinates
Sprite is offset by a cell Node offset plus region offset Remove one; keep the region absolute
Thin line at the edge Filtering samples the neighbor Add padding/extrude; try filter_clip
Sprite is cropped Region is smaller than the art Expand the region or fix the sheet
Sprite is blurry Filter on for pixel art Set Filter off in the import dock
Pivot looks wrong AtlasTexture has no pivot Use the node’s offset/centered

A note on pivots

AtlasTexture has no pivot. Neither does SpriteFrames. Pivots in Godot are a property of the node (Sprite2D.offset, AnimatedSprite2D.centered/offset), not the texture region.

That is why the pipeline insists on uniform frame bounds. One node offset has to work for every frame. If the frames were trimmed individually, the character will move even if every region is correct.

FAQ

Can I use AtlasTexture with AnimatedSprite2D? Yes, that is exactly what a sheet-based SpriteFrames does.

Do I need filter_clip? For pixel art with Filter off, usually no. For filtered art near an atlas edge, it can stop bleeding; test both.

Can I animate the region directly? Yes, with AnimationPlayer. It is useful for packed atlases, but a frame-based Sprite2D or SpriteFrames is simpler for a grid.

Why does the first frame look right and the rest are offset? The regions are probably relative to the first cell instead of the atlas. Recompute every rect from the sheet origin.

Does the texture path in the .tres have to be res://? Yes for project resources. If the path is wrong, Godot reports a missing texture; fix the path and reimport.


Next: Godot 4 pixel art import settings — the settings that keep the regions crisp.