Clipping shadows over certain area's of a layer.

This forum is currently in read-only mode.
  • The Problem

    Ok you've got four layers in your layout, from top to bottom, in the following order.

    A character layer, for the actual player/npc's etc.

    A shadow layer, where sprites of fake shadows are placed.

    A middle layer, lets call that "walkway".

    A background layer which is supposed to be empty or far away, lets call that "stars".

    As the character and NPC sprites moves around, the shadows under them follows correctly and all works great, except the shadows appear where they shouldn't, in this case they appear OVER the stars layer in the background, rather than being clipped at the edge of any artwork in the walkway layer like they should. Resulting in it just looking wrong.

    The Question

    How do you stop the shadow sprites from appearing over the stars layer? You can't use Canvas (and wouldn't work for this anyway), you can't erase the shadows around the edges of the walkway layer by using eraser sprites because the artwork has an intentional irregular edge as well as many small spaces within the artwork from alpha channels (think the spaces between branches of a tree) and therefore you'd be having to use thousands of perfectly shaped sprites to do so, which isn't a viable option (even though it works, it just isn't usable in this case).

    I trust this is possible to fix though. The sprites in the shadow layer must not appear over or effect the stars layer in any way. However sprites in the characters layer may cross unaffected. This only applies to the shadows.

  • There's the mask effect but I don't really get it yet, so I can't really explain.

    On the other hand, you just gave me an idea for a weird effect

    EDIT: nevermind, can't modify layer alpha

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • There's the mask effect but I don't really get it yet, so I can't really explain.

    On the other hand, you just gave me an idea for a weird effect

    It's my idea, no stealing!!! haha, just kidding

    I had a look at the mask effect too but didn't get nowhere with it either.

    The projected "fake" shadow works perfectly (and looks great), and using eraser sprites/tiled backgrounds does work to limit where they appear, but only in very few, specific and unrealistic situations, so isn't a viable solution either. What would work would be some way to limit how many layers deep a layer can effect.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)