Casting Shadows in C2

Show us your completed creations made in Construct 2

Post » Sun May 05, 2013 3:58 pm

The LightingTest looks nice, but not that much realistic...
How come the shadows appear only when the light get closer?
Also have you ever seen real life shadows getting darker as two overlaps? o_O

The Flashlight one looks good though
B
20
S
5
G
8
Posts: 325
Reputation: 6,473

Post » Sun May 05, 2013 4:05 pm

@lemo

I imagine putting the shadows on the same layer and changing the layer transparency will fix the overlap issue.
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
68
S
8
G
6
Posts: 931
Reputation: 9,360

Post » Sun May 05, 2013 4:46 pm

we can all agree that we would like to know how to do this...
B
16
S
5
G
3
Posts: 47
Reputation: 2,276

Post » Mon May 06, 2013 8:00 am

Impressive, very nice ! good job.
B
31
S
9
G
1
Posts: 45
Reputation: 4,492

Post » Mon May 06, 2013 11:24 am

Nice, can it handle multiple light sources ?
B
45
S
15
G
9
Posts: 1,096
Reputation: 11,038

Post » Mon May 06, 2013 5:14 pm

AdamD says he's on holiday for a few days, but he'll come and respond when he's back

Edit: In case you're wondering, I'm his trained monkey butlerSecondDimension2013-05-06 17:18:58
B
13
S
4
Posts: 129
Reputation: 1,483

Post » Mon May 06, 2013 5:33 pm

Dude!! This is awesome!
Please give us more details and/or the .capx =D
B
52
S
10
G
6
Posts: 133
Reputation: 8,715

Post » Mon May 06, 2013 6:34 pm

Thanks for all of the comments and feedback guys. Sorry it has taken me a while to respond, as SecondDimension mentioned, I've been away and without internet access for a few days.

@Robin Sommer - I've been toying with the idea of a light based game but don't have any plans as of yet.

@sqiddster - This isn't a shader (that would probably be a more efficient way of doing it), I'm just using some maths and the canvas plugin. I should've mentioned the canvas plugin in the original post as it is brilliant.

@Venivididormi - I plan to post the .capx at some point (once I've cleaned it up a bit). It is math/loop heavy, I'm sure there is probably an easier way to do it but basically I project out the polygon away from the light source and draw it using the canvas plugin.

@Sylvain - Will do, once I've cleaned it up a bit.

@lemo - Thanks for the feedback. You're correct, the effect is highly exaggerated but perhaps I can explain my decisions. Firstly, shadows become exponentially bigger as the object casting the shadow gets closer to the light source. I've just exaggerated the effect because in the final version there will be fall off from the light which will blend with the shadow being cast (i.e. outside of the range of the light you won't be able to see the shadow). In the case of overlapping shadows, it is a problem as you note which is due to a glitch caused by multiple light sources. With multiple light sources you do get an overlapping shadow effect, see some examples: http://tinyurl.com/cd6o7yw and http://tinyurl.com/cqs7g8u. Although you can't see it, there are multiple light sources, close to each other, to create a soft shadow effect. I was just trying the effect out and need to fix it to get it to look right.

@AnD4D - Thanks for the comments. In response to your question in the other thread, I use a lot of sub-events, local variables and functions in the files. So I spread the effect out over quite a few events. If I were to compress it down then I think that the flashlight would be around 30ish events and the lightingTest would be about 60-70.

@spongehammer - Yes, there are actually multiple light sources all close together in the LightingTest example, I was playing around with creating a soft shadow effect.

@siks - As I mentioned above, I'll post the .capx files as soon as I've cleaned them up a bit. They require the canvas plugin to be installed.AdamD2013-05-06 20:50:41
B
2
Posts: 7
Reputation: 164

Post » Tue May 07, 2013 12:42 pm

I've put the .capx file for the flashlight demo online so that you guys can take a look at it. It is at: www.adamduncan.com/Flashlight/source.zip

You'll need to add R0J0hound's excellent canvas plugin to run the examples: http://www.scirra.com/forum/plugin-canvas_topic46006.html

I'll put the lighting test source code up soon too, I just want to see if I can fix a couple of issues with it.
B
2
Posts: 7
Reputation: 164

Post » Tue May 07, 2013 4:50 pm

Nice. Thanks for sharing.
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

PreviousNext

Return to Completed Creations

Who is online

Users browsing this forum: No registered users and 1 guest

cron