Faked Shadow Example (Updated)

Post your own tutorials, guides and demos.

Post » Sat Aug 21, 2010 2:36 pm



[url:2sns60jx]http://dl.dropbox.com/u/7658043/FakeShadowDemo.cap[/url:2sns60jx]

Here is a little Example showing how you can use a fake shadow.Move the arrow keys left and right to see how the shadows behave as the sun moves.



[url:2sns60jx]http://dl.dropbox.com/u/7658043/ShadowplusDN.cap[/url:2sns60jx]

I have added day and night now. Press the Up And Down keys to change day into night and vice versa.
B
22
S
3
G
6
Posts: 1,356
Reputation: 7,141

Post » Sat Aug 21, 2010 10:26 pm

nice
to make it more versatile though, you might want to change it so instead of rotating the shadow when you press the button, it rotates the shadow to "always" be at some angle relative to the sun

here's an alternate version with skewing instead of angling: (drag and drop sun)
http://dl.dropbox.com/u/1013446/fluid/fakeshadow2.cap
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Sat Aug 21, 2010 10:29 pm

Thank you very much lucid for correcting my problem.Now i will know what to do in the future with shadows.
B
22
S
3
G
6
Posts: 1,356
Reputation: 7,141

Post » Sun Aug 22, 2010 4:15 am

no prob, there was a mistake with my last cap though,
shadows should grow longer the closer the sun is to the horizon,
skew should also grow less pronounced the further above it is:

http://dl.dropbox.com/u/1013446/fluid/fs.cap
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Sun Aug 22, 2010 9:25 am

Wow!.The last cap you send looks great that's exactly what i wanted to do but i didn't know how to do it.Thank's once again lucid.I want to change to sun into the moon once the sun is behind the horizon ,How can i achieve this Lucid?
B
22
S
3
G
6
Posts: 1,356
Reputation: 7,141

Post » Wed Nov 24, 2010 8:26 am

This is very nice, i love it :)
Can i use it in my game?
B
4
S
1
G
2
Posts: 91
Reputation: 1,057

Post » Fri Nov 26, 2010 12:22 pm

one thing is missing. transperency.
shadows, when sun is low, not only grow longer - but also less visible. in that last cap - try and drag the sun far away offscreen and see what happends.
ImageImageImageImage
B
26
S
7
G
7
Posts: 572
Reputation: 6,097

Post » Fri Nov 26, 2010 4:20 pm

[quote:7owy8rjj]one thing is missing. transperency.
shadows, when sun is low, not only grow longer - but also less visible. in that last cap - try and drag the sun far away offscreen and see what happends.[/quote:7owy8rjj]

It's fine with me anyway - no one's gonna ever see the sun in my game :)
I'm using this (yes i know...) with lamps. It doesn't look very realistic (due to the lamps position) but still better than blobs.
B
4
S
1
G
2
Posts: 91
Reputation: 1,057

Post » Fri Nov 26, 2010 11:30 pm

[quote="irbis":14bxl0n9]one thing is missing. transperency.
shadows, when sun is low, not only grow longer - but also less visible. .[/quote:14bxl0n9]
easily remedied:
http://dl.dropbox.com/u/1013446/fs3.cap
(drag and drop sun with mouse)
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Sat Nov 27, 2010 12:07 am

[code:3uddm35y]+ System: Always (every tick)
-> sun: Set Y to clamp(.y,23,200)
-> Sprite: Set horizontal skew to [b](sun.y/70)[/b]*(Sprite.x-sun.x)
-> Sprite: Set height to [b]178[/b]-(Sprite.y-sun.y)
-> sun2: Set opacity to lerp(70,0[b],clamp((sun.y-100),0,100)/100[/b])
-> Sprite: Set opacity to lerp(70,10,[b]clamp((sun.y-100),0,100)/100[/b])
[/code:3uddm35y]

Nice, but i wonder how you come up with such things as "clamp((sun.y-100),0,100)/100". Why sun.y-100?

Also, i know you didn't write all this code, but why is the shadows height set to 178 ? random value?
what about skew with sun.y /70?

This is making my head spin... also, i suck at maths, and that really doesn't help me at all here lol

Thanks
B
4
S
1
G
2
Posts: 91
Reputation: 1,057

Next

Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 0 guests