Box2d & Box2d Lights Simpleness Example

Ok, just to show how awesome and simple libgdx box2d and box2d lights are check this out. I just started learning box2d yesterday and have come up with this. I’m really enjoying learning this library and I hope others will realize how great it is!

Use WASD to move and scroll to enlarge or decrease light.

Pics:


http://i1173.photobucket.com/albums/r594/Slyth2727/Screenshotfrom2013-07-11210944.png


http://i1173.photobucket.com/albums/r594/Slyth2727/Screenshotfrom2013-07-11211009.png

If you want to play with it, check out the download here:

http://www.mediafire.com/download/1gvjchyevfdwuu2/Box2dCoolExample.jar

The file you’ve provided is a .zip not a .jar so it won’t run with java.

Please could you get this fixed, i really wanna try this :smiley:

Unless I’m missing something here, you’re supposed to unzip the .zip to get the .jar…anyways, .jar is not the only executable that works with Java anyways.

It worked when I downloaded it. It is, in fact, a runnable jar file that you are downloading.

Yes, I did post a .jar. You may have to right click and say run with java :slight_smile:

i see this kind of light in libgdx, my question is, can I run this on my android application without a considerable drop down frame rate or it’s quite light to calculate for the phone? i don’t know if you can understand my question XD

It’s used many mobile games without problems. I developed this library mobile in my mind and actually its just side project when I make game programming course at university where I coded for really old android phone.(2010?)

Ah you’re the creator of this great library? Kudos to you sir! May I make a suggestion? Add the option to have penumbras instead of complete soft shadows. I’m sure you could throw these in there relatively easily.

Windows 7 can add the “.zip” extension to a downloaded jar because it sees it as just a zip file. Look at the name of the file and it will be something.jar.zip.

With current implementation this would add quite much of additional trickery. I have another light system with pure gpu solution which look lot more scalable.(up to 8k shadow casting lights with laptop) With that solution penumbras are really easy. Not promising anything yet thought.

Wow that’s great performance! Can I get one insight on that? Do you use shaders to render the shadows or do you use geometry? I am guessing geometry because that is generally more performant. I look forward to what you come up with in the future :).

New system use only shaders. Basic algorithm is simple.

  1. Calculate bounding box of all lights that contribute to screen.(might be bigger thab screen)
  2. Render all occluders that are inside of that bounding box to fbo that is fitted to that bounding box.
  3. Calculate 1d shadow maps for all lights using just single pass.
  4. Render all lights to fbo. Optimal solution is using vertex shader fetch to save fill rate when light is shadowed. Can use pixel also shader for penumbras. Possible to use normal maps there too.
  5. Horizontal separated gaussian blurs pass.
  6. Vertical separated gaussian blurs pass.
  7. Blend over scene.

There are quite many performance knobs. Occluder texture can be smaller size and use low bandwith texture. Only 1bit is actually needed(but no such render targets exist). Light fbo can be also quite low resolution. Shadow map resolution is quiet important. This 1d texture direclty affect number of raycast for shadow map generation and number of vertices per point light if vertex fetch is used.