Skip to content
Back to skills

Godot 2d Rendering

ASecurity

Godot 2D look: draw order, z_index and y-sort, CanvasLayer, 2D lights and shadows, canvas shaders, Parallax2D, pixel-perfect scaling.

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
ai-agentspythonrustgobashnodeaws

Security analysis

A100/100

Pro scans all 8 files and shows the line behind each finding

Scanned December 3, 2026

npx -y skills add tipoLi5890/game-studio --skill godot-2d-rendering --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Godot 2d Rendering?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Godot 2d Rendering
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tipoli5890-godot-2d-rendering/badge)](https://www.skillsdirectory.com/skills/tipoli5890-godot-2d-rendering)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: godot-2d-rendering
description: >-
  Godot 2D look: draw order, z_index and y-sort, CanvasLayer, 2D lights and shadows, canvas
  shaders, Parallax2D, pixel-perfect scaling.
---

# godot-2d-rendering — what is drawn on top, and how it looks

Draw order in 2D is canvas layer, then `z_index`, then y-sort, then tree order; most "wrong
layer" bugs are one of the four. A headless run draws nothing, so the look is judged by eye; what
can be checked without a screen (shaders compile, parameter names exist, the pixel-art settings
are set, where things sit on screen) is checked by `scripts/canvas_check.py`.

## Load what the situation needs

| The situation | Read |
|---|---|
| The courier draws behind the crate it stands in front of; a spark under the courier | `reference/draw-order.md` |
| Top-down: walking behind a chimney and in front of its base | `reference/draw-order.md` → "Y-sort for a top-down street" |
| A HUD that stays put; a sky behind everything | `reference/draw-order.md` → "Backgrounds: CanvasLayer and Parallax2D" |
| Far buildings that scroll slower; an endless strip of clouds | `reference/draw-order.md` → "Backgrounds: CanvasLayer and Parallax2D" |
| Street lamps at night, shadows from chimneys, normal-mapped sprites | `reference/lights-2d.md` |
| "The light does nothing"; the HUD is lit by the world's lamps | `reference/lights-2d.md` → "Who is lit, who casts" |
| An outline round a pickup; a white flash when the courier is hit | `resources/outline.gdshader`, `resources/hit_flash.gdshader`, then `reference/canvas-shaders.md` |
| A shader that loads but draws wrong; a parameter that does nothing | `reference/canvas-shaders.md` → "Parameter names fail silently" |
| One courier flashes and they all flash | `reference/canvas-shaders.md` → "Shared materials" |
| Blurry or shimmering pixel art; which stretch mode; window size | `reference/pixel-art.md` |
| Import settings and filtering of the sprite sheets | `godot-2d-sprites` → `reference/pixel-art-import.md` |
| Tile levels, tile y-sort origins, tile occluders | `godot-tilemap` |
| Camera follow, zoom, limits | `godot-camera` |
| HUD, menus, themes, fonts | `godot-ui` |
| Shaders on 3D objects, renderer differences | `godot-rendering-3d` |
| Seeing the result in a window; screenshots of a journey | `godot-play-harness` |

## The order, in one table

| Step | Decides | In front |
|---|---|---|
| 1 | `CanvasLayer.layer` | the higher layer, whatever the Z inside |
| 2 | `CanvasItem.z_index` (relative to the parent unless `z_as_relative` is off) | the higher final Z |
| 3 | `CanvasItem.y_sort_enabled` on the parent, same Z only | the higher Y |
| 4 | tree order | the child over its parent, the later sibling over the earlier |

Give every `CanvasLayer` its own index (two on one index swap unpredictably); keep `z_index`
inside `RenderingServer.CANVAS_ITEM_Z_MIN` .. `RenderingServer.CANVAS_ITEM_Z_MAX` (a value past it
is refused with an error and the old Z kept); put each y-sorted node's origin at its feet.

## Check what can be checked

```bash
python3 scripts/canvas_check.py shaders resources/outline.gdshader resources/hit_flash.gdshader
python3 scripts/canvas_check.py shaders game/fx/hit_flash.gdshader game/fx/outline.gdshader --uses game/actors
python3 scripts/canvas_check.py pixel-art game
python3 scripts/canvas_check.py pixel-art game --stretch canvas_items --skip texture-filter
python3 scripts/canvas_check.py --selftest
```

| Command | Fails on |
|---|---|
| `shaders SHADER... [--uses FILE\|DIR] [--root DIR]` | `SHADER_ERROR` (a shader language error, with its line), `ENGINE_ERROR` (any other error the load prints), `NOT_CANVAS` (not `shader_type canvas_item`), `UNKNOWN_PARAM` (a parameter name a script or scene sets that no checked shader declares) |
| `pixel-art PROJECT [--stretch viewport\|canvas_items] [--skip NAME]` | `STRETCH_MODE`, `SCALE_MODE`, `TEXTURE_FILTER`, and with `canvas_items` `SNAP_TRANSFORMS`, `SNAP_VERTICES`; notes for the base size, the window size and feature overrides |

`shaders` copies the shaders and the includes under the project into a throwaway project outside
it and loads them headless; `pixel-art` only reads `project.godot`. The last line is the verdict:
exit 0 clean, 2 a check failed (each on a `FAIL` line), 3 no Godot, a timeout, no sentinel or an
unreadable file, 1 a usage error or a failed selftest. Godot comes from `--godot PATH` or
`GODOT_BIN`.

The selftest catches a misspelt name, a misspelt hint, an unknown render mode, a missing include,
a sampler passed to a function, a spatial shader and five misspelt parameter names, passes the
shipped shaders, a relative include and an instance uniform, and checks the engine facts the
references state: the settings and their defaults, the out-of-range `z_index`, the light
defaults, misspelt parameter names staying silent (in code, in a scene, per instance), a spatial
shader on a sprite printing nothing, shared and local-to-scene materials, tweening a shader
parameter, and the screen motion and offset of a world node, a `CanvasLayer` node and a
`Parallax2D` node under a moving camera.

## Discipline

- **Name the step before the number.** A draw-order fix says which of the four steps it uses;
  raising `z_index` until it works breaks the next y-sort.
- **Origins at the feet.** Every y-sorted node, sprite and tall tile sorts by its base.
- **Read the load, not the return.** A broken shader still loads; `canvas_check.py shaders`
  is the check, and a parameter name is checked against the shader, not trusted.
- **Materials are shared until made local.** A per-instance effect uses
  `resource_local_to_scene` or an instance uniform.
- **Settings are checked, looks are seen.** The pixel-art settings pass the check first; then
  the look, lights and shadows are judged in a windowed run, never from a headless pass.

Files in this skill

  • SKILL.md5.7 KB
  • reference/canvas-shaders.md4.6 KB
  • reference/draw-order.md5.4 KB
  • reference/lights-2d.md3.6 KB
  • reference/pixel-art.md4.1 KB
  • resources/hit_flash.gdshader950 B
  • resources/outline.gdshader1.9 KB
  • scripts/canvas_check.py40 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.