Dropshadow with Angle.

This forum is currently in read-only mode.
  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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?

  • 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.

  • 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.

  • 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.

  • 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.

    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.

    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: <img src="http://upload.dfyb.net/uploaded/32pixels_sadface.png">

    shown here is 124,124 offset. the darker green square is 32,32

  • 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

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)