How do I use shadowcaster with more than one light source?

0 favourites
From the Asset Store
Immerse your quiz games with our 6 unique music loops, ranging from acoustic chill guitar to cute and upbeat style.
  • Hi!

    As a test, I've tried using the RTS template, adding a light on the container of each tank and pinning it as you do for a turret, and adding the "shadowcaster" behaviour to the "solid" object.

    When you move the entire group of tanks, it works (either when you provide a shadow height or when you provide a light radius). But when one of the tanks separates from the group, you realize shadows are getting casted from the main group (i.e. no light is coming from the isolated tank).

    Hoy can I manage to have different tanks, each one casting light to its path?

    I haven't saved the project, as it is easy to replicate.

  • slight edit to the capx (is this ok to post this, mods ?) all I have done is change the walls to their own layer and between these walls and the new background I added a semi opaque shadow layer.

    (also added shadow catcher/lights as per your post <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile"> )

    https://goo.gl/mnkzNV

  • I think I understand what Aracalaus meant, because I had the same problem, and it isn't solved in your capx file :

    -> tanks aren't realistic lightsources, because if you have a tank on each side of a wall, a shadow is cast on each side, but instead they both should be enlighted

    Unfortunately, as far as I know the "shadow caster" behaviour allows you to cast shadow (thx captain obvious) but that's all, so if an object is enlightened on multiple side, it will cast multiple shadows, and oposed lightsources won't cancel each-other's shadow...

    I wanted to use it in my game too, but I have no idea how to fix the problem, and I'm not sure it's even possible in construct 2...

  • Yes I see what you mean, sorry. I think you could do something along these lines using LOS to a tilemap but it would be a blocky?

    also look at the following post where Magistross posted a clever shadow casting capx which might give you a head start ? (only for one light, but with work ...)

    Please post if you make any progress ?

  • I believe it can be done with semi-transparent-shadows and the alpha-threshold effect on the layer where the shadows are..

  • [quote:1a0c0xt5] RamPackWobble » Tue Nov 10, 2015 8:56 am

    Yes I see what you mean, sorry. I think you could do something along these lines using LOS to a tilemap but it would be a blocky?

    also look at the following post where Magistross posted a clever shadow casting capx which might give you a head start ? (only for one light, but with work ...)

    viewtopic.php?f=147&t=150994&p=958035&hilit=+404#p958035

    Please post if you make any progress ?

    Interesting idea, but the result is really blocky

    [quote:1a0c0xt5]Post by LittleStain » Tue Nov 10, 2015 9:35 am

    I believe it can be done with semi-transparent-shadows and the alpha-threshold effect on the layer where the shadows are..

    I didn't know this effect, bit I'll give it a try, thx for sharing !

  • LittleStain

    I tried this effect (AlphaClamp) but I'm not really sure I understood how to use it properly

    Could you please help me out ? show me a CAPX example ?

  • I was talking about the effect Alpha-threshhold, downloadable from the effects-part of this forum, but trying to create a capx to show the effect I've hit some bumps..

    I'm sure it can be done, some way, but I don't have the time trying to figure it out as I'm working on my own project...

  • Actually think I got it working, sort of..

    It uses a combination of alpha clamp and alpha threshold (download from forum)..

    Only places where none of the lights shine have shadows..

  • LittleStain That's a pretty clever way to deal with multiple lightsources not getting shadowcast over each others.

  • Magistross - Thankyou.

    LittleStain - Nice fx. Been playing with your capx - I also like the effect of dropping the smoothing right down to give solid shadows.

  • Many thanks to everybody! Good Job!

  • Actually think I got it working, sort of..

    It uses a combination of alpha clamp and alpha threshold (download from forum)..

    Only places where none of the lights shine have shadows..

    It's awesome ! Thx a lot !

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Seen that we deal with the subject of the lighting, does anyone know how I could give a "night effect" to a side-viewed game ?

    I'll try to explain what I mean by night effect : The all screen is darker (I thought I could use a semi-transparent black layer on top of others), except the area around torches or fireballs for example.

  • have a look at the lighting example that ships with c2 - might be what you want

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