Flashlight (torch, etc.) lighting effect

pHghostpHghost London, UKMember Posts: 2,342

Is there a smart way of faking the effect of a light-source in darkness? Imagine a character in pitch dark, carrying for example a torch. The light should follow him around, illuminating the surroundings to a specific distance.

Something along the lines of:

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    I'm sure you've seen the device-sized-black image with a whole cut out in the center, right? Would that suit your purpose? Not the best effect but I'm sure with some work it could look decent.

  • SocksSocks London, UK.Member Posts: 12,822

    Just constrain a camera size actor with a hole in the centre.

    As the edges tend to be soft, the image can be fairly small, say 256 x 256.

  • pHghostpHghost London, UKMember Posts: 2,342

    The problem with that approach is that it permits only one light source, you cannot have two characters with torches, or other lights.

    I appreciate the responses!

  • ookami007ookami007 Member Posts: 581

    Unfortunately, there is no dynamic lighting in GameSalad.

  • pHghostpHghost London, UKMember Posts: 2,342

    I know there is no dynamic lighting, that's why I'm trying to figure out if there is a way to fake it somehow, but it's possible there is no way out.

  • pHghostpHghost London, UKMember Posts: 2,342

    If you have a single layer for the background, you can do it through the multiply blend mode, but once you need more actors that are affected by it, the multiply messes it up.

  • ookami007ookami007 Member Posts: 581
    edited June 2015

    @pHghost Ok... here is an example of poor man's lighting. It's fairly resource intensive and if you want it to be even more granular, it would become even more so.

    What it does is have 3 tag types - bright light (closest), midlight (fading light) and dim light (the fringes of the light). Bright light is transparency 0 (so background, etc shows through), midlight is 75% transparent and dim light is 50%. Everything else is transparency 1 on black actors that cover the screen in a 50x50 grid.

    The bright light is 100x100 in a circular collision pattern, midlight is 200x200 and dim light is 300x300.

    You can walk around with A &D keys and the light will follow the player. There are two other light sources and they will combine and then go back to normal after the player has moved over them.

    Right now, I show the grid being created but obviously you can remake it prevent that.

    Mac project file:

    https://dropbox.com/s/o7521xan80kw41u/Dynamic%20Lighting%20001.zip?dl=0

  • pHghostpHghost London, UKMember Posts: 2,342

    Smart approach! I'll play with that, thanks!

  • ookami007ookami007 Member Posts: 581

    @pHghost It's crude, but might be workable for something.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    Here is an ancient thread that shows how old kipper used to do it. Maybe it will help.
    http://forums.gamesalad.com/discussion/comment/299792#Comment_299792

    And here is the file.

  • ookami007ookami007 Member Posts: 581

    That's a really sharp way of doing it... just wondering if it can be applied towards a very active screen with lots of actors - that don't give off light.

  • pHghostpHghost London, UKMember Posts: 2,342

    Thanks for sharing these! I'll see how flexible I can make @ookami007 's method.

    I currently use exactly the method that Kipper's demo does, but yes, it's a problem if you have a scene that is put together from many different actors on top of each other, because then the blending mode messes everything up. I might make it workable in v0.14, once the pixel art scaling is implemented, but for now I cannot do everything as one flat image, as it would make it a horror with memory management.

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    @RThurman, thats a great method, thanks for pulling it out of the archives.

  • wilsongaluchowilsongalucho Member Posts: 180

    WOW! That Kipper multi light! So awesome!!!

Sign In or Register to comment.