How do I create a limited diffusion light source?

0 favourites
  • 6 posts
From the Asset Store
Awardkit
$5 USD
Create custom awards and achievement or use the many templates and create your own.
  • I am currently working on a serious game which manages day/night transitions. When the player is in some of the rooms, he/she can turn lights on or off.

    In order to create light sources, I have some Shadow Light objects on an opaque black layer above the background project light onto the lamps which then reflect the light (instead of shadows). This trick works by having the Shadow Lights using the "Destination Out" blend mode (their "shadow" therefore reveals the layer below).

    See below:

    dropbox.com/s/z82jbgnhfinos ... g.png?dl=0

    My issue is the following when using the light sources: Either you set their radius to zero and can then determine the range of diffusion of the light (see left lamp above), but the edges of the light aren't smooth or you set the light's radius and have a nice natural looking light (see right lamp above), but the light extends off the screen.

    I know this seems to be a limitation of the light/shadow caster plugins in C2, but has anyone an idea how to prevent the shade from extending off the screen edges without having to have hard looking shade edges?

  • I'm not sure why one would use the shadow-light object for this seeing these lights are static..

    Wouldn't using a sprite (with blendmodes) be far more suitable?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, LittleStain, I agree regarding the example I used above (probably not the best choice, as these are static), but there are other cases in which the light intensity needs to vary. I suppose I could use a set of static frames and move between the frames as intensity increases/diminishes, but I wanted to see if using the "dynamic" light/shadow objects was possible. Otherwise, I will probable revert to such a solution.

  • Well, LittleStain, I agree regarding the example I used above (probably not the best choice, as these are static), but there are other cases in which the light intensity needs to vary. I suppose I could use a set of static frames and move between the frames as intensity increases/diminishes, but I wanted to see if using the "dynamic" light/shadow objects was possible. Otherwise, I will probable revert to such a solution.

    I'm not sure if you could get the effect you want by adding a webgl-effect on the shadowlight-layer, but if not, my advice would be to use some kind of object/sprite to fake the whole thing..

    But my knowledge of this area might be too limited to see another "easy" option..

  • I think this is basically a question for Ashley: Is there any way in which the light object could provide soft edges when using a radius of zero to control the shade's range?

  • Example using horizontal and vertical blur (webgl) on the shadow layer:

    https://dl.dropboxusercontent.com/u/485 ... tblur.capx

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