Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (426)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (466)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Per-Pixel 2D Shadows on the GPU [LibGDX]  (Read 2974 times)
0 Members and 1 Guest are viewing this topic.
Offline davedes
« Posted 2013-04-01 21:21:37 »



Here is an article describing my technique for 2D per-pixel lighting on the GPU:
https://github.com/mattdesl/lwjgl-basics/wiki/2D-Pixel-Perfect-Shadows

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

Offline matheus23

JGO Kernel


Medals: 98
Projects: 3


You think about my Avatar right now!


« Reply #1 - Posted 2013-04-01 23:52:13 »

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?

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline matheus23

JGO Kernel


Medals: 98
Projects: 3


You think about my Avatar right now!


« Reply #2 - Posted 2013-04-02 14:44:55 »

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

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline deathpat
« Reply #3 - Posted 2013-04-02 16:06:23 »

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

if you scroll down a bit, you will find them Wink
https://gist.github.com/mattdesl/5286905#file-pass-vert

work in progress : D A E D A L U S
Offline matheus23

JGO Kernel


Medals: 98
Projects: 3


You think about my Avatar right now!


« Reply #4 - Posted 2013-04-02 16:11:41 »

if you scroll down a bit, you will find them Wink
https://gist.github.com/mattdesl/5286905#file-pass-vert

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

<edit>Oh god...</edit>

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline Slyth2727
« Reply #5 - Posted 2013-08-14 15:50:46 »

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!

Check out Escaping Vox, a 3D
|\ _\  voxel based puzzler!
 \|_|
Offline davedes
« Reply #6 - Posted 2013-08-14 16:05:17 »

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

Offline Slyth2727
« Reply #7 - Posted 2013-08-14 16:16:19 »

Ohp my bad I meant light size... I don't know how I type these things out and not realize it  Roll Eyes. 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 Wink. What do you say?

Check out Escaping Vox, a 3D
|\ _\  voxel based puzzler!
 \|_|
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (75 views)
2014-04-15 18:08:23

BurntPizza (68 views)
2014-04-15 03:46:01

UprightPath (80 views)
2014-04-14 17:39:50

UprightPath (65 views)
2014-04-14 17:35:47

Porlus (81 views)
2014-04-14 15:48:38

tom_mai78101 (105 views)
2014-04-10 04:04:31

BurntPizza (165 views)
2014-04-08 23:06:04

tom_mai78101 (261 views)
2014-04-05 13:34:39

trollwarrior1 (210 views)
2014-04-04 12:06:45

CJLetsGame (220 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!