additive lighting + shadows. edit: .Capx

0 favourites
From the Asset Store
Rotate & Animation for 16 Direction & Mouse Direction
  • Click to drag walls and light sources

    +multiple sources

    +lights are additive

    +shadow casting objects can have any number of sides

    +shadow quality adjustable

    +background lighting

    here's a screenshot of it working in a platformer i'm making.

    here is the .capx file, requires the canvas plugin

    I use multiple canvas objects, one for each light source.

    Each canvas is only as big as its source's light sprite. Because they are not the same size as the screen, i have to multiply where the shadows should be by a ratio which you see in the events as 'ResMulti'.. The part where the shadows are actually drawn is similar to r0j0hounds original .capx a long time ago where it draws a quad for each pair of corners.

    the additive lighting is done by using the (spoilers!) additive blending mode on each canvas, the layer they are all on has the 'multiply' shader. This combo is a replacement for using the 'destination out' method that only does black n white.

  • Wooooo impressive effect! Congrats!

    Would love to see how to do that! :)

  • That's excellent I'm looking forward to seeing how it's done!

  • wow ! congratulations ! i have tested some ways to do that but it was impossible to get 60fps !

    im really interested by seeing your capX! and your platformer seems nice !

  • Man, this is awesome! Can't wait to get a look at the guts.

  • I wanted to this for aaaages!! Really nice!


    is the shadow caster done through construct 2 plugins or your own?

  • Nice one, Retro games would look better and having nice performance, doesn't matter we use high resolution graphics to port all platforms :)

  • Wooooo impressive effect! Congrats!

    Would love to see how to do that! :)


  • very impressive and fast result :)

    Did you code it directly in construct2 or using your how plugin ?

  • keepee This is awesome! Great work! I would love to use this in a future project, if you decide to share the capx. :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Okay, that's some very impressive stuff. You plan on sharing the code for it? Because this would be very handy to have available.

  • I agree, great job.

    I can't wait until Scirra releases an official plugin to do this. I have just the game in mind.

  • Impressive. Especially if it is done via events.

    There's just one issue you could have an eye on:

    After about 3 minutes of dragging things around, Firefox was bloated to almost 3 GB RAM usage. All additional lighting and shadowing was gone, just the pure objects remained, and neither the canvas nor Firefox reacted anymore.

    Maybe that memory leak only occurs in my combination (FF 23.0.1, WinXP 32bit), but it's worth investigating.

  • This is awesome. I had given this a lot of thought and had decided it couldn't be done just with basic events. Could you at least share the idea behind it?



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