[REQUEST] LightCaster, aka 'Inverted ShadowCaster'

0 favourites
  • 4 posts
  • I have been running into the same problem that I've seen other users on this forum also have before me, and that is the lack of support for multiple light sources within Construct 2. I am talking about the ShadowCaster object, which in it's own right works - but only if you're willing to have a singular light source in your game, or several spaced apart from each other. It's a real downer, and it's something I've tried to find a work around for the last few days.

    My first attempts included layer-effect-shading magic, but to no avail. Around here I realized that the object not only should be fully transparent where the shadows usually are from the default ShadowCaster - but it also have to be transparent all together, most desirably with the alpha mask being a radial gradient, on top of being cleared where shadows usually appear. The Polygon and Canvas plugins have gotten me on the right track, but far away from anything that actually ... well, works.

    And that's why I am proposing this:

    Could one 'reverse engineer' the ShadowCaster object/plugin to render it's polygon on the "inside" where the "light" is, rather than the "outside" where the shadows are?

    The plugin itself is already well capable of all the raycasting you'd need to achieve this, the other main thing would be the alpha ... But that could surely - worst case scenario - be handled using a webgl effect that calculates every pixel's alpha depending on the distance it has to the origin. And then you'd slap a tint effect onto that for different colored lights. I also believe it would even run smoother than default (if I understand it's internal mechanics correctly) in that, instead of rendering several arbitrary polygons in one tick, it would only render one.

    I've made an image trying to better describe what I'm trying to achieve here. I am certain that this will not only suffice for my own interests, but also for many others.

    As you might be able to tell, it should all be pretty straight forward what I would like to accomplish here. But - since I lack any actual knowledge with javascript, nor the will to start taking apart the ShadowCaster's runtime.js without actually knowing anything about it in the first place - I'm asking any kind soul to consider my request, point me to a working alternative or workaround I have missed, or kindly tell me why this isn't actually possible.

    Thank you for your time

    ?

    Edit: Oh, and if there's any question whether you'd like to be paid for your work, we could discuss that aswell.

    Edit 2: Am I doing this correctly? I guess not, huh?

  • IDK, I think the idea of a mega-polygon (Carmack, is that you? ) is kind of interesting, though, it seems like if you had a lot of onscreen shadowcasters the complexity of the polygon might become a problem.

    However, the light/shadow system was quite a bit of work, and I'd be surprised if Ashley didn't try something like this along the way, as I've read about other implements before that did something similar to what you are suggesting.

    I suspect this would gobble up a lot more fill rate as well, since rendering the 'inside' means overdrawing substantially more pixels. Which is a problem for perf on desktop, unless you want to ignore the massive number of people rocking iGPU's only (wish we could, but... ).

    Anyway, I'm going to shut up now, because I'm starting to get way out of my depth...

  • i think its already possible ...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I took a moment and managed to make the effect you're going for.

    here's the capx

    http://1drv.ms/1Ke6Oi7

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