Dropshadow with Angle.

Post your own tutorials, guides and demos.

Post » Tue Sep 23, 2008 10:02 am

I edited the dropshadow shader to add the offset commands, so now you can set the angle of the shadow. And with lesser success, distance.

I don't know if anyone will find the small addition useful but I thought I would post it :)
B
2
S
2
G
4
Posts: 156
Reputation: 1,762

Post » Tue Sep 23, 2008 10:21 am

awesome

edit: a question also for the devs: is there some inherent limit preventing it from working at larger offsets? i've only poked around with making custom shaders, and i see a documented minimum 32 pixels when using border mode, but it seems to be the maximum (relative to source texture size)? will it ever be possible for these shader effects to, for example, grab or project something 200 or so pixels offset?
B
2
S
2
G
4
Posts: 254
Reputation: 1,958

Post » Tue Sep 23, 2008 10:30 am

Well, it shrinks the shadow the higher the number. If you go too high, it's probably 1 pixel or not there at all.

I'll see if I can stop that. However, I think a height modifier would need to be added.
B
2
S
2
G
4
Posts: 156
Reputation: 1,762

Post » Tue Sep 23, 2008 10:34 am

well it cuts off at 32 pixels and doesn't maintain proper shape if set to a big enough offset (and yeah, i set offx=offy). i notice it's 32 pixels relative to source texture, because stretching the sprite in the layout editor will stretch the dropshadow.
B
2
S
2
G
4
Posts: 254
Reputation: 1,958

Post » Tue Sep 23, 2008 10:36 am

Well I was only able to use the existing offset commands, I don't know what restrictions are there. I'm looking at it right now however.

To make sure I understand you, is it always 32 pixels? I ask because from trying it out myself it seemed to work right with the exception of the shrinking.
B
2
S
2
G
4
Posts: 156
Reputation: 1,762

Post » Tue Sep 23, 2008 10:42 am

i'm not trying to rain on your parade or anything -- this is simply an issue i was dealing with myself when trying to make a custom shader, and was curious about a more experienced insight. your shader is still useful and a good example that will probably help me in trying to make my own custom shaders. :)

[quote="6Fix":3amrk7ui]Well I was only able to use the existing offset commands, I don't know what restrictions are there. I'm looking at it right now however.

To make sure I understand you, is it always 32 pixels? I ask because from trying it out myself it seemed to work right with the exception of the shrinking.[/quote:3amrk7ui]

unless i stretch the image in the layout editor, yes. i'll grab a screenshot. i'm noticing a difference in what's displayed on the layout editor and runtime, also -- so perhaps there's a bug afoot (my hardware is modern and up to date).

edit:

shown here is 124,124 offset. the darker green square is 32,32
B
2
S
2
G
4
Posts: 254
Reputation: 1,958

Post » Tue Sep 23, 2008 10:45 am

I see what you're talking about now. I think it's because the offset command itself has that limitation.

Huh, I didn't realize that. Bummer. Well, I guess I should rename the thread to "Dropshadow with angle change" ... hehe
B
2
S
2
G
4
Posts: 156
Reputation: 1,762

Post » Tue Sep 23, 2008 2:42 pm

Border-mode extends the bounding box by an amount proportional to the width and height of the box, to a minimum of 32 pixels - this allows the effect to sample image information outside the object's bounding box, but at the expense of being slower, since the GPU has to process the effect on a larger area. This can be expensive for slow effects like the Blurs. So it's a trade-off between efficiency and flexibility.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,528


Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 0 guests