Per-Pixel 2D Shadows on the GPU [LibGDX]

Here is an article describing my technique for 2D per-pixel lighting on the GPU:

If you have more ideas for optimizations, please let me know!

Aaaaahhhh…

I think I finally got the idea: You actually don’t even do a polar transform, you only walk the rays from the light source to the occluders…

Well I was really confused by the polar transform before, really…

But shouldn’t the shadow map get in-precise if we want to have big lights?

I mean… in case the shadow map is 360 pixels wide, it’s only 360 rays being cast? I guess this is still enough?

In the wiki page on github you linked the demo source code, but forgot to give us the shader files :slight_smile: (shadowMap.frag / shadowRender.frag / pass.vert)

if you scroll down a bit, you will find them :wink:

Ah… silly me… but pass.vert is still missing :confused: Yeah anyways, as I said, I got it working already :slight_smile:

Oh god…

Hey this is really great, but I was wondering if you could give me a rundown of why, when you make the shadow size larger, the shadows get all messed up? And maybe point me in the direction to fixing it, but just a hint because I’d like to do it myself (to learn). Thanks!

Hey – your question is pretty unclear. What do you mean by shadow size?

Ohp my bad I meant light size… I don’t know how I type these things out and not realize it ::). But yeah, the lightSize variable.

Edit: Bless my idiotness, and tuck me in a crib. I wish I could delete posts because this is one of the most embarrassing one’s I have made…
Needless to say, I figured it out.

Edit 2: I do have another question though. When I increase upScale the light gets bigger, but the shadows “fade off” before the light ends. A simple way to fix this is to zoom the camera in and draw stuff smaller, however that messes up the FBO ;). What do you say?

Hey this is really great, but I was wondering if you could give me a rundown of why, when you make the shadow size larger, the shadows get all messed up? And maybe point me in the direction to fixing it, but just a hint because I’d like to do it myself (to learn). Thanks!

Hey – your question is pretty unclear. What do you mean by shadow size?

Ohp my bad I meant light size… I don’t know how I type these things out and not realize it ::). But yeah, the lightSize variable.

Edit: Bless my idiotness, and tuck me in a crib. I wish I could delete posts because this is one of the most embarrassing one’s I have made…
Needless to say, I figured it out.

Edit 2: I do have another question though. When I increase upScale the light gets bigger, but the shadows “fade off” before the light ends. A simple way to fix this is to zoom the camera in and draw stuff smaller, however that messes up the FBO ;). What do you say?