算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
gamedev-2d-art-lighting-art【设计与创意】Painting 2D art for dynamic lighting: workflow for Unity 2D Lights / Godot CanvasLight, normal map authoring (Sprite Lamp / hand-painted), separation in layers (diffuse / normal / emissive / mask), self- shadowing in pixel art, day/night palette swaps vs realtime light mixing, glow / emissive layers. USE WHEN: integrating 2D Lights with hand-painted…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
name: gamedev-2d-art-lighting-art description: | Painting 2D art for dynamic lighting: workflow for Unity 2D Lights / Godot CanvasLight, normal map authoring (Sprite Lamp / hand-painted), separation in layers (diffuse / normal / emissive / mask), self- shadowing in pixel art, day/night palette swaps vs realtime light mixing, glow / emissive layers.
Two paradigms for 2D lighting:
Modern indie pixel art usually combines both: baked rim light + dynamic fill from scene Lights.
| Engine | 2D lighting system |
|---|---|
| Unity URP 2D | 2D Renderer Data + Light 2D components (Point/Sprite/Freeform/Parametric/Global). Normal map secondary texture. Shadow Caster 2D for occlusion. |
| Godot 4 | PointLight2D / DirectionalLight2D + LightOccluder2D for shadows. Normal map via shader. |
| Defold | Custom shaders. |
| Phaser / web | Pixi.js light filter or custom shader. |
A "lit-aware" sprite needs (at minimum):
seamless-textures/SKILL.md for authoring.)Most pixel-art games stop at diffuse + normal + emissive. Adding more is diminishing returns vs hand-painting.
If you'll use 2D Lights, the diffuse should be flat-lit — single ambient lighting condition, no strong shadow side. The engine adds the directional shading.
Typical workflow:
If you instead want classic fully-shaded diffuse, the engine's 2D Light affects it ON TOP of the bake — works but the result is double-shaded (cool effect for dramatic lighting; bad for naturalistic).
See seamless-textures/SKILL.md for normal map authoring options
(Sprite Lamp, Sprite DLight, Materialize, hand-paint).
For pixel art: normals on small sprites can look strange because neighboring pixels have different normals → light shifts pixel-by-pixel unevenly. Solutions:
Real-time self-shadow on a pixel sprite is usually not worth it. Dynamic shadows on a 32×32 character look noisy, low-resolution, jittery as the light moves.
Common approaches:
The cheap way. Paint the sprite with shadow side darker (lit assumed from upper-left). Limits dynamic lighting (always upper-left feel) but looks sharp.
Author two diffuse variants: top-lit and rim-lit. Engine blends based on light direction. Doubles art cost but feels alive.
Flat-painted diffuse + 2D Light gives a soft directional fill. Sprite doesn't really self-shadow, but the rim-light hint feels lit. Works for most indie pixel art.
Emissive pixels ignore lighting and stay full-bright. Use cases:
Authoring:
final_color = lit_color + emissive_color * emissive_mask.In Unity URP 2D: assign emissive secondary texture in Sprite Renderer.
Stardew Valley uses palette swap (retro fit). Hyper Light Drifter uses realtime. Hollow Knight uses realtime + heavy emissive.
Two ways to achieve "glow":
For pixel art: option 2 conflicts with the pixel-perfect aesthetic (blur softens pixels). Common compromise: enable bloom only on emissive layer, not on the diffuse.
unity-2d-lighting