Workflow

Layer overlap and Z-order in PSD source files

14 min read

Layer overlap and Z-order in PSD source files

It’s 3 AM. Your character’s left arm vanishes behind their torso during a crucial attack animation, then pops back into place. Your demo is in six hours. You’ve spent the last three wrestling with your PSD, trying to figure out why the layer overlap is suddenly broken. This isn't just a visual glitch; it’s a fundamental breakdown in your Z-order logic that can derail an entire project. We've all been there, staring at our art, wondering if we drew it wrong or if the engine is gaslighting us. The problem often starts right in your source file, long before any animation software touches it.

1.The invisible enemy: when layers fight for screen space

Every 2D character is a collection of parts, carefully arranged to create the illusion of depth. A head, a torso, an arm, a leg – each exists on its own layer. In theory, this is simple: layers higher in the stack appear in front. But when these parts move, especially with skeletal animation or Mixamo retargeting on a 2D rig, their relative positions can change dramatically. Without a robust Z-order strategy, your character will look like a paper doll losing its glue. This isn't about artistic skill; it's about technical foresight.

Illustration for "The invisible enemy: when layers fight for screen space"
The invisible enemy: when layers fight for screen space

a.Why basic stacking isn't enough for animation

When you draw a character in Photoshop or Aseprite, you naturally layer elements. The front arm goes above the torso, the torso above the back arm. This works perfectly for a static pose. But once you introduce movement, that fixed stack breaks down. A front arm might swing *behind* the torso, or a leg might need to pass *in front of* the other. The static layer order in your PSD is a starting point, not a complete solution for dynamic animation. This is where many solo developers hit their first major roadblock, often hours before a deadline.

  • Fixed Z-order leads to parts popping in and out of view.
  • Complex movements often require dynamic layer swaps.
  • Body parts can unexpectedly clip through the torso or head.
  • The illusion of depth breaks, making animation look flat or broken.
  • Debugging these issues becomes a time sink without a plan.

2.Decoding Z-order: more than just stacking paper

Z-order, or depth order, dictates which elements appear in front of others. In traditional 2D art, it’s simple: layers higher in your image editor's layer panel are drawn last, therefore on top. But in animation, each bone in your skeletal animation rig often has its own depth property. This means the Z-order isn't just about the layer stack; it's about the depth assigned to each rigged part. Understanding this distinction is crucial for clean animations that avoid visual glitches. It’s a core concept that impacts how your character interacts with its own body.

Illustration for "Decoding Z-order: more than just stacking paper"
Decoding Z-order: more than just stacking paper

a.The two faces of depth: static vs. dynamic

Your PSD defines a static Z-order – a fixed sequence of layers. Charios, like other animation tools, then interprets these layers as individual sprites or textures. When you rig these sprites to bones, each bone can be assigned its own depth value. This creates a dynamic Z-order that changes with animation. For instance, a character’s arm might have a default depth, but during a specific wave emote animation, its depth could temporarily shift to appear behind the torso, then return to the front. This dynamic control is powerful but requires careful planning.

The biggest lie in 2D animation is that your layers just stack. They don't; they dance, and you're the choreographer of their depth.

Quick rule:

Always consider your character's extreme poses when designing Z-order. If an arm needs to pass behind the body at any point, make sure your layering system allows for that transition smoothly. Don't just optimize for the default idle pose; think about the full range of motion. This foresight saves hours of painful re-rigging later. It's a common mistake that wastes precious development time.

3.The PSD workflow: where things go wrong before you export

Your PSD is the foundation of your animated character. Any Z-order mistakes here will propagate through your entire pipeline, from Charios to Unity or Godot. The key is to organize your layers with animation in mind, not just static composition. Poorly organized PSDs are the number one cause of frustrating Z-order bugs. We need to think about how each part will move and where it needs to sit relative to others at every point in an animation.

Illustration for "The PSD workflow: where things go wrong before you export"
The PSD workflow: where things go wrong before you export

a.Preparing your layers for animation software

When creating your character in Photoshop, each articulable part needs its own layer. This means separate layers for the upper arm, forearm, hand, upper leg, lower leg, foot, head, torso, etc. Beyond just separating them, consider their pivot points and how they’ll rotate. Ensure there’s enough overlap between connecting parts to prevent gaps when they move. Generous overlap is your best friend against unsightly seams. This extra pixel space is crucial for smooth transitions and realistic deformation.

  1. 1Separate every moving part onto its own layer.
  2. 2Name layers clearly (e.g., `Arm_Front_Upper`, `Torso_Main`).
  3. 3Ensure ample overlap at joints (e.g., forearm extends under bicep).
  4. 4Group related layers (e.g., `Arm_Front` group containing `Upper`, `Lower`, `Hand`).
  5. 5Keep the default pose clean with correct initial Z-order.
  6. 6Avoid merged layers for any part that needs to animate independently.

b.The hidden cost of insufficient overlap

Many artists, especially those new to animation, draw parts exactly to their visible edge. This is a critical error. When a limb rotates, the area near the joint stretches and compresses. If there isn't enough extra pixel information underneath the overlapping part, you'll see gaps or sudden, jagged edges. Always extend your layers beyond their visually perceived boundaries, especially at pivot points. This buffer zone provides the necessary data for smooth deformation and prevents your character from looking like it's made of disjointed cardboard cutouts. This foresight dramatically reduces post-export fixes.

4.Fixing the overlap: strategies for clean articulation

Once your PSD is structured correctly, the next step is managing Z-order within your animation tool, like Charios. This isn't a one-size-fits-all solution; different parts of your character require different strategies. Some elements, like a character's hair, might always stay on top, while others, like limbs, need to flexibly change depth. Understanding these nuances is key to avoiding visual artifacts and maintaining the illusion of a cohesive character. It’s about more than just moving things around; it’s about establishing rules.

Illustration for "Fixing the overlap: strategies for clean articulation"
Fixing the overlap: strategies for clean articulation

a.Establishing a default Z-order hierarchy

Start by setting a logical default Z-order in Charios. Generally, parts closer to the viewer (front arm, head) have a higher depth value, and parts further away (back arm, torso) have lower values. Most animation tools allow you to assign a Z-depth to each bone or attachment. Think of it as assigning a 'depth coordinate' to each piece of your character. This initial setup is your baseline, the state your character returns to after complex movements. It’s the foundation for any dynamic adjustments you’ll make during animation. A clear default makes debugging much simpler.

  • Head and hair usually get the highest Z-depth.
  • Front arm components (shoulder, upper, lower, hand) are next.
  • Torso and hips are typically in the middle.
  • Back arm components receive lower Z-depth than the torso.
  • Legs follow a similar front-to-back pattern.
  • Small details like accessories can be placed strategically.

b.Dynamic depth adjustments during animation

For complex actions, you’ll need to keyframe Z-order changes. Imagine a character crossing their arms: the arm that starts 'behind' might need to temporarily move 'in front' of the other. Charios allows you to set specific Z-depth values for bones at different points in your animation timeline. This gives you granular control over how parts overlap at any given frame. Mastering this dynamic depth adjustment is where your animations truly come alive, preventing stiff or unrealistic movements. It's a fundamental skill for advanced 2D animation.

A good example is a platformer character's wall jump animation. As the character pushes off a wall, their 'back' arm might need to swing forward dramatically. If its Z-order isn't adjusted, it could clip through the character's body or the wall itself. By keyframing the Z-depth, you ensure a seamless transition that maintains visual integrity. This deliberate control over depth is what separates amateur rigs from professional ones. It’s a detail that players notice, even if subconsciously.

5.The 'always on top' dilemma: handling persistent elements

Some character elements, like a character's nose or a specific hair strand, might always need to appear in front of other parts of the head. This is where an 'always on top' or fixed Z-order priority comes in handy. While most body parts need flexible depth, these persistent elements require a constant high priority. Don't overdo it with 'always on top' flags; reserve them for truly unchanging elements. Misusing this can lead to other parts unexpectedly disappearing behind them. It's a powerful tool, but one to use sparingly.

Illustration for "The 'always on top' dilemma: handling persistent elements"
The 'always on top' dilemma: handling persistent elements

a.Identifying truly persistent elements

Before you mark something as 'always on top,' consider its full range of motion. Does a character's earring *ever* need to go behind their hair? Probably not. Does a scar on their cheek *ever* need to go behind their nose? Unlikely. These are good candidates for fixed high Z-order values. However, a character's cape might *sometimes* need to be in front of an arm and *sometimes* behind it, depending on the action. This requires dynamic adjustment, not a fixed priority. Thoughtful identification prevents later headaches.

  • Nose, mouth, and eyes generally stay above other head parts.
  • Small accessories like earrings or hair clips.
  • Character UI elements, if they are part of the rig.
  • Any element that should never be obscured by other character parts.
  • Use sparingly to avoid unintended clipping issues.

6.Exporting for animation: what Charios expects from your PSD

Charios is designed to make 2D animation straightforward, but it relies on a well-prepared source file. When you import your PSD into Charios, it reads your layers and their initial stacking order. This initial order forms the default Z-order for your rig. If your PSD is a mess, your Charios rig will inherit that mess. A clean, logically grouped PSD saves you hours of post-import cleanup and ensures your character animates as intended. This step is where prevention is truly better than cure, setting the stage for smooth animation work.

Illustration for "Exporting for animation: what Charios expects from your PSD"
Exporting for animation: what Charios expects from your PSD

a.The Charios import process and Z-order

When you drop your PSD into Charios, each Photoshop layer becomes a renderable sprite attached to a bone. Charios respects the layer order from your PSD as the baseline Z-order. You can then adjust the depth of individual bones or sprites within Charios. Think of your PSD as providing the initial 'blueprint' for depth. If you have a `Front_Arm` group and a `Back_Arm` group, ensure the `Front_Arm` group is higher in your PSD’s layer stack. This simple rule prevents immediate Z-order conflicts upon import. It's a direct translation.

  1. 1Organize PSD layers into logical groups (e.g., `Arm_Left`, `Leg_Right`).
  2. 2Ensure groups reflect desired initial Z-order.
  3. 3Name layers clearly for easy identification in Charios.
  4. 4Flatten any effects or smart objects that aren't meant to animate independently.
  5. 5Save your PSD with maximum compatibility for broader software support.

7.Iteration and testing: catch issues before they ship

You've prepared your PSD, rigged in Charios, and even started animating. But Z-order issues are sneaky. They often only appear during specific frames or extreme poses. The worst time to find them is during playtesting or, even worse, after launch. Regular, dedicated testing of your character's full range of motion is non-negotiable. This proactive approach saves you from late-night debugging sessions and frantic patch releases. It's an investment in your game's quality and your sanity.

Illustration for "Iteration and testing: catch issues before they ship"
Iteration and testing: catch issues before they ship

a.The animation checklist for Z-order integrity

Create a checklist of actions and poses that are most likely to expose Z-order problems. This might include: full arm swings, leg crossing animations, head turns through 180 degrees, and extreme stretches or crouches. Run through these repeatedly. Pay close attention to joints and areas where multiple body parts converge. The goal is to intentionally break the rig to find its limits. This stress testing reveals weaknesses in your Z-order strategy that might otherwise go unnoticed. It’s like a quality assurance pass for your character's depth.

  • Perform full 360-degree limb rotations if applicable.
  • Test all character emotes, especially those with overlapping limbs.
  • Check `idle`, `walk`, `run`, `jump` cycles for consistent depth.
  • Look for clipping during attack animations or special abilities.
  • Examine extreme poses where parts are close to the camera or far away.
  • Verify Z-order with different camera angles or character rotations.

8.Common Z-order traps: lessons from late-night debugging

Even with the best intentions, Z-order issues can creep in. These are often subtle mistakes made during the initial art setup or rigging phase. Understanding these common traps can help you spot and fix them faster, or ideally, avoid them altogether. Many of these problems stem from treating 2D animation art like static illustrations. We're building a dynamic puppet, not a flat painting. Learning from others' mistakes is a shortcut to a smoother workflow. These are the gotchas that plague indie devs.

Illustration for "Common Z-order traps: lessons from late-night debugging"
Common Z-order traps: lessons from late-night debugging

a.Mistakes that lead to depth chaos

One common trap is insufficient padding around sprite edges. If your arm sprite ends exactly where it appears to meet the torso, any rotation will expose a gap. Another is inconsistent naming conventions in your PSD, making it hard to track layers in Charios. Failing to establish a clear hierarchy early on is a recipe for disaster. It’s tempting to rush through the art phase, but those shortcuts always come back to haunt you when you're trying to animate complex platformer character animation moves. Pay attention to the details from the start.

  • Not extending overlap pixels at joints (e.g., forearm under bicep).
  • Using merged layers for parts that need independent movement.
  • Inconsistent layer naming in the PSD.
  • Ignoring the default Z-order in the PSD layer stack.
  • Over-reliance on fixed 'always on top' settings.
  • Not accounting for extreme rotations in initial art design.

9.The one contrarian opinion: why ==simple is always better== for 2D character Z-order

Many tutorials advocate for hyper-complex Z-order systems, especially when using advanced tools like Spine. They suggest elaborate slot systems or multiple render layers. But for the vast majority of indie games, this is over-engineering. A simple, consistent Z-order hierarchy with minimal dynamic adjustments is almost always the more robust and maintainable solution. The more complex your system, the more points of failure you introduce. Focus on elegant solutions, not overly clever ones. This approach minimizes debugging time significantly.

Illustration for "The one contrarian opinion: why ==simple is always better== for 2D character Z-order"
The one contrarian opinion: why ==simple is always better== for 2D character Z-order
If your Z-order system requires a flowchart to explain, it's already too complicated. Keep it simple, keep it predictable.

a.Prioritizing clarity over complexity

Instead of building a system that allows every limb to pass over every other limb at will, identify the critical overlap scenarios for your character. Does the front arm *really* need to go behind the back leg? Probably not. Does it need to go behind the torso? Yes, often. Focus your dynamic Z-order efforts on these common and essential movements. A lean Z-order system is easier to debug and faster to animate. It ensures that your character's depth is consistent without unnecessary complexity. This efficiency translates directly into more time for actual game development.

10.Beyond PSD: other formats and their Z-order implications

While PSD is a popular choice for layered 2D art, other formats and workflows have their own Z-order considerations. Whether you're working with individual PNGs, sprite sheets, or even vector art, the core principles remain. Every layered asset needs a defined depth, and every animation tool needs to interpret that depth consistently. Understanding these broader implications helps you choose the right tools and formats for your specific project. This knowledge is crucial for a flexible development pipeline, especially when integrating motion capture data.

Illustration for "Beyond PSD: other formats and their Z-order implications"
Beyond PSD: other formats and their Z-order implications

a.PNG sequences and individual sprites

If you're using individual PNGs for each body part (common for pixel art in tools like Aseprite), your animation software will typically assign a default Z-order based on the order you import them or a numerical suffix in their filenames. This can be less intuitive than a PSD's layer stack. Explicitly naming your PNGs with Z-depth indicators (e.g., `arm_front_01`, `torso_00`) can help maintain order. This provides a clear, machine-readable depth hierarchy from the start, minimizing manual sorting during import. It's a small step with a big impact.

  • Name PNGs with numerical Z-order suffixes (e.g., `part_001.png`, `part_002.png`).
  • Group related PNGs into folders for better organization.
  • Use consistent file naming conventions across all assets.
  • Ensure all PNGs have transparent backgrounds to avoid visual artifacts.
  • Check for premultiplied alpha issues if your engine supports it.

Mastering layer overlap and Z-order isn't just about avoiding bugs; it's about giving your 2D characters believable depth and fluid motion. From the initial PSD setup to the final animation tweaks, a thoughtful approach to layer hierarchy and dynamic depth adjustment will save you countless headaches. The goal is to make your characters move so naturally that players never even notice the complex layering beneath. This attention to detail is what makes 2D animation truly shine, transforming flat images into living, breathing entities. It's the silent hero of compelling character design.

Take 15 minutes right now to open your character's PSD and critically examine your layer structure and overlap. Are there enough pixels at the joints? Are your layers clearly named? If not, make those adjustments. Then, try importing it into Charios and see how smoothly your animation workflow begins. A little preventative maintenance goes a long way. You'll thank yourself later when your demo is flawless and you're actually getting some sleep.

Charios team

We build a browser-native 2D character animation tool — drop layered PNGs onto a fixed skeleton and retarget Mixamo or BVH mocap onto the rig. Try Charios →

Published May 12, 2026

FAQ

Frequently asked

  • How do I prevent Z-order issues when preparing my PSD for 2D character animation?
    Ensure your PSD layers are meticulously organized with sufficient overlap for articulation, especially at joints. Establish a clear default Z-order hierarchy in Photoshop, placing elements like the torso centrally and limbs in a logical front-to-back or back-to-front sequence. This foundational setup minimizes unexpected layer popping during animation in tools like Charios.
  • What is the difference between static and dynamic Z-order in 2D character animation?
    Static Z-order is the fixed depth arrangement of your character's parts defined in the source PSD, like the arm always being behind the torso. Dynamic Z-order involves adjusting this depth during animation, allowing a limb to pass in front of or behind another element as needed. This is often controlled by keyframes or rules within animation software like Unity or Godot.
  • Why is sufficient layer overlap crucial for smooth 2D character animation?
    Insufficient overlap leads to visible gaps or 'popping' when character parts articulate, especially at joints like elbows or shoulders. Generous overlap ensures that as limbs rotate or move, the underlying parts remain covered, maintaining the illusion of a solid character. This is vital for professional-looking movement and avoids visual glitches.
  • How does Charios handle Z-order when importing layered PSD files?
    Charios reads the layer order directly from your PSD, establishing the initial Z-order for your character rig. It then allows you to define and adjust dynamic Z-order rules or keyframe Z-depth changes during animation, providing flexibility beyond the static Photoshop arrangement. This enables complex overlaps for actions like a hand passing over a chest.
  • What are common Z-order mistakes to avoid when exporting character assets from Photoshop?
    A primary mistake is assuming Photoshop's layer order will always perfectly translate to animation without considering dynamic movement. Avoid minimal overlap at joints, inconsistent naming conventions, and grouping layers that need independent Z-depth control. Neglecting a clear Z-order hierarchy before export often leads to extensive re-work in animation software like Spine or Charios.
  • Can I use separate PNG sequences instead of a single PSD to manage Z-order for 2D characters?
    Yes, using separate PNG sequences for individual character parts can simplify Z-order management by treating each part as an independent sprite. However, this approach often requires more manual setup in your animation tool and might lose the organizational benefits of a single, layered PSD for initial rigging. It's a trade-off between granular control and integrated asset management in tools like Aseprite or PixiJS.

Related