Lens Flare!

0 favourites
  • For any one interested, I've made an experimentation on recreating a dynamic Lens Flare effect. Ideally some genius could do it with a behavior or something, but here it is, in my own layman way <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

    Here is an online preview: http://www.eli0s.com/Tests/LensFlare/

    And here is the capx file:[attachment=0:cpkhnibs]LensFlare.capx[/attachment:cpkhnibs]

    Please feel free to build upon and improve this example! I'll be happy to see any suggestions and ideas! Just don't turn your game into a JJ Abrams movie <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">

    note: with 32 lens objects I get 3% cpu usage (on the debugger running in Chrome). I feel like it's fare enough but I have no idea hoe this scales on non desktop devices.

    note2: Ashley , I don't know if it's my system's problem but the same capx gives me an assertion error with version 186. Is this a bug perhaps? Also, I've noticed in the last few versions of C2 that the Tilled Background object produces an artifact, at least on the preview mode. It's hard for me to explain in English, please have a look on the TB object in this capx, notice that I've intentionally left a 1 px line empty on the bottom of the image. Otherwise, when the height of the object is 256 px (the default image's height) there is a 1 px bleed on the top.

  • That looks fantastic! Really, just a great effect and works wonderfully!

  • Beautiful work, if its amazingly lite on CPU resources thats a massive advantage for implementation in mobile games!

  • That does look really nice. Great work, Eli0s!

  • Looks and works great

  • Wow! That's absolutely beautiful! Thanks for sharing eli0s! Hehe I am sure many of us will purposely try to find a way we can implement it into our game

  • I had a dynamic lens flare before it was cool

    open this image in new tab to see the whole

    eli0s online preview seems not working at the moment... cannot compare Your flare

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • C-7 ,


    DatapawWolf ,

    volkiller730 ,

    rekjl ,

    Thanks guys!

    By the way, does anybody know a better way to use one Sprite in order to mask in an other, but in the manner that destination out works? What I mean is, when we have a large sprite and on top of that an other smaller sprite with the blend mode set Destination out, the small sprite cut's a whole into the Sprite bellow. For instance, we only need a small gradient circle with a solid center that fades in opacity towards the edge, and with that we can cut a whole in to a solid colored layer (the way lighting effects in a dark environments is done in the ghost shooter tutorial).

    The small circular sprite cuts a whole in to the solid black layer, enabling the content below to be shown.

    However, the opposite doesn't happen. If we wish to use the same small Sprite in order to show just the part that it covers (in respect with it's opacity), we realize that outside the physical borders of the Sprite, both Destination In and aTop blending modes fail: The pixel information of the sprite bellow (or of the colored layer) is been displayed outside of the small Sprite's edges.

    The same circular Sprite does reveal the black layer bellow, taking in to account it's opacity values. However, the effect breaks outside the Sprite's physical borders and the black layer is visible.

    In my Lens Flare example, the Sprite named "HotSpot" is used to show the lens dirt spots. In order to do that, I had to stretch it into a great size, something that is not very practical, has limitations and either need a huge Sprite if details are needed, or renders blurred results when stretched.

  • rozpustelnik , nice! I hadn't seen any other lens flare examples before, this is great!

    I think that you can't see the online example because you live in Poland. For some ^&%*$ reason my domain is been blocked in some countries. You can always try the capx however!

  • eli0s Will try the capx as soon as I get home. I'm very curious how You managed the lens flare mechanics/code.

  • Very nice, kudos!

  • This is absolutely beautiful work. Thanks for sharing!

  • Amazing, and in the right time.

  • Great!

  • Aurel ,

    Dalal ,

    A0Nasser ,

    iceangel ,

    Thank you guys!

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