Can we make a vector Shadow Caster?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
TylertheDesigner
Citizen
Posts: 80
Joined: Sat Apr 10, 2010 2:27 am

Can we make a vector Shadow Caster?

Post by TylertheDesigner »

I would really like to create the effect in games like Helsing's Fire and Monaco.
Andy Schatz wrote a great little how-to on the shadowcasting in Monaco-
https://www.facebook.com/notes/monaco/l ... 1301481995

Could this be done quickly in Love2d?
Can it be done without the use of PixelEffect?

I think if all of your light-blocking objects were square, this is relatively easy to handle. You would just raycast out like his suggestion, and create a mask (canvas) to use as your lighting source. But what if you had object with rounded edges or something similar? Would it be worth using Box2d at that point for both the player collision and the raycasting? Maybe you could use per-pixel maps to determine the light source, or something in GLSL involving an occlusion map.
Thoughts?
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Can we make a vector Shadow Caster?

Post by ivan »

Hey, there are demos on here that show you how to program something like this.
I don't think Box2D's raycasting could be useful in this particular case.
It depends on how complicated you want to make this but usually you can create nice-looking shadow effects using just math.
User avatar
TylertheDesigner
Citizen
Posts: 80
Joined: Sat Apr 10, 2010 2:27 am

Re: Can we make a vector Shadow Caster?

Post by TylertheDesigner »

ivan wrote:Hey, there are demos on here that show you how to program something like this.
I don't think Box2D's raycasting could be useful in this particular case.
It depends on how complicated you want to make this but usually you can create nice-looking shadow effects using just math.
Do you have links to any of them? I've seen (and done) tile based shadow casting, but I couldn't find any vector based ones in Love2d.
Edit- I agree on the Box2d aspect.
Post Reply

Who is online

Users browsing this forum: No registered users and 53 guests