How do I create a limited diffusion light source?

Get help using Construct 2

Post » Thu Jul 09, 2015 12:55 pm

Message: wmsgva can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
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:

https://www.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?
B
10
S
3
Posts: 87
Reputation: 957

Post » Thu Jul 09, 2015 1:02 pm

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?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Jul 09, 2015 1:16 pm

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.
B
10
S
3
Posts: 87
Reputation: 957

Post » Thu Jul 09, 2015 1:22 pm

wmsgva wrote: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 told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Jul 09, 2015 1:26 pm

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?
B
10
S
3
Posts: 87
Reputation: 957

Post » Thu Jul 09, 2015 1:35 pm

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

https://dl.dropboxusercontent.com/u/485 ... tblur.capx
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 12 guests