How do I multiple ShadowCasters / ShadowLights

Get help using Construct 2

Post » Wed Oct 21, 2015 5:24 pm

Hello there,
I would like to add several light sources and generate dynamic shadows. I have already tried with the ShadowCaster and the ShadowLights, but without success.

So far I have the following sequence:
https://www.dropbox.com/s/nqvjn0okwsg8e ... s.jpg?dl=0

...and here is a screenshot of my map:
https://www.dropbox.com/s/ys8h90arbqibb ... n.jpg?dl=0

The green lines are the ShadowCaster. The Layer opacity is 100% and I will see all black. :o

Can someone help me there? :)
Last edited by wossi on Thu Oct 22, 2015 6:31 am, edited 5 times in total.
B
7
S
2
Posts: 84
Reputation: 754

Post » Wed Oct 21, 2015 5:27 pm

You need a shadow caster behavior on everything that needs a shadow cast.

Watch the CPU power though when you add more lights and more stuff. It can really add up quick. Unity or U4E would be the best in this case.
Construct has Dynamic lighting, and if used right it can look really good. But at this time I think the solution for you is to try something more engendered for the task of shadow casting,


A few fake shadows here and there is fine, but be sure to watch the rendering overhead. Construct can do a lot of great things. Accurate, efficient shadow-casting is not one of them. For really nice shadows you will need something that takes the 3D nature of the object into account.

TRy making your sprites with pre-rendered shadows is another solution I have found.

Better to use a chainsaw to cut trees, and a table saw to make fine woodwork. Picking the right tool for the job is verry important, otherwise you are going to do lots of things to equal the features of the other engines.

C2 makes great 2D games , faking 3D games it does ok.... but you will need to invest a lot more time into making our artwork.

Look in the effect section there is a guy named Somebody that made a great shadow effect.
Last edited by jojoe on Wed Oct 21, 2015 5:33 pm, edited 1 time in total.
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Wed Oct 21, 2015 5:30 pm

I had a ShadowCaster and ShadowLights, but once I use a second ShadowLights, appear no more shadows.
B
7
S
2
Posts: 84
Reputation: 754

Post » Wed Oct 21, 2015 5:35 pm

You need more than 1 layer.

The lamp and the shadows should be on the same layer IIRC:
https://www.scirra.com/manual/178/shadow-light

I dont use them very much, sorry my memory is hazy.
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Wed Oct 21, 2015 5:54 pm

Seeing your graphics using shadowlight might be overkill..
I'd go for pinning a shadow object (sprite) to your player and setting it's angle based on where the lightsource is..
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 » Wed Oct 21, 2015 7:12 pm

@LittleStain: Ok, but this solved not my problem. I edit my first post.
I have several rooms. For example in the third room (right on top) you have a "daylight" and a lamp. In the first room (where start the player) you have another lamp. The green line are ShadowCasters.

@Jojoe: Thanks for your edit. Before I trying the ShadowCaster and ShadowLights, I used "Parallax Lightmaps". Its only a Sprite (created in GIMP), but this was not good for me. I want more Dynamic. :D
B
7
S
2
Posts: 84
Reputation: 754

Post » Wed Oct 21, 2015 7:30 pm

In my opinion faking it the way I suggested would give better (and probably less gpu-intensive) results in your case..

another way would be setting the shadows to a certain amount of opacity and using the Alpha threshold effect on the shadow layer..
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 » Wed Oct 21, 2015 7:59 pm

LittleStain wrote:In my opinion faking it the way I suggested would give better (and probably less gpu-intensive) results in your case..

another way would be setting the shadows to a certain amount of opacity and using the Alpha threshold effect on the shadow layer..

Hi @LittleStain, great way to put it.

One of the best "Rules of thumb" I have heard for Video game development is "Better to fake it than make it".

@wossi

An old trick we did with the blender game engine was to take the 3D model which was casting the shadow, replace the material with a flat black material, then Smash the model flat on the same normal as the light direction. Then flip and mirror the object to make an exact shadow.

In Construct 2 you can do the same thing with the sprites, by duplicating the animated sprite, Use the Set Color to Black (0,0,0)

Here I make a Jumpman with a fake shadow for you.

https://mega.nz/#!VFY31A7Q!xroRHt6HoVp_ ... pw54D5LEV4

I am doing it in real time, just for this example, you are going to want to do this shadow sprite in your image editor.

Just Flip it , and smash it. You can also Skew it in your image editor, but I suggest not doing that. Anyway, enjoy your Lazy-Mans-Free shadow Hack!

Have a good day :)
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Wed Oct 21, 2015 11:25 pm

Here is one with an animated sprite. Just put your sprites into the Shadow family and enable it by setting the instance variable Shadow to True. Leave the original set to false. Then Invert the Y axis, and make the height about half the original height.

https://mega.nz/#!UIA1XBRA!MhmuMro-jTHD ... Vax9l5NZBk
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Thu Oct 22, 2015 9:01 am

Thanks for all replies! :D
Here is my other solution with a type of "light mapping". It's a little bit more of dynamic as a simple sprite, but the lights will be shine in the adjacent room.

https://www.dropbox.com/s/10847ox199nqw ... t.jpg?dl=0
B
7
S
2
Posts: 84
Reputation: 754

Next

Return to How do I....?

Who is online

Users browsing this forum: ramyaswetha and 5 guests