Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (798)
Games in Android Showcase (234)
games submitted by our members
Games in WIP (865)
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  
  [LibGDX] Top-down 2d game with pseudo 3d lighting.  (Read 469 times)
0 Members and 1 Guest are viewing this topic.
Offline unenergizer

Junior Devvie


Medals: 5
Exp: 5 years


Trying to figure it all out


« Posted 2019-08-22 22:07:24 »

Hello everyone!

I have been creating a top-down 2d game using LibGDX.  I am trying to find a way to creating a lighting effect for this game.  What I want to achieve is having lights that cast shadows. The size of the shadows depend on the height, width, and opacity or density of the object in the light path.

Here is an example.


In the image above the spheres are shorter and the shadow doesn't reach as far, where as the columns are taller and the shadow is cast further.

I would like to implement this technique into my game using a main light source as the sun implemented on a day/night cycle.  Here is an example in another game.

<a href="http://www.youtube.com/v/Oz7KKdecVPI?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/Oz7KKdecVPI?version=3&amp;hl=en_US&amp;start=</a>

One thing I would like to avoid is the box2dlights with the hard rogue like lighting where each shadow is ridiculously unrealistic.
Example:


Thank you for your help! I did do some googling on the subject. Haven't found anything that I thought would work.

JGO is Awesome!
Steam: unenergizer
Offline VaTTeRGeR
« Reply #1 - Posted 2019-08-23 08:40:46 »

Have you read this article by Careless Labs already?

He uses Box2DLights for soft and round shadows/lighting. Maybe you can use or adapt the box2dlights source to fit your profile, it very much looks like box2d supports smooth shadows.

What you want to achieve is basically full 3d sun shadow casting, this isn't simple anymore, you can either fake it like box2d does or go all out with 3d-shadows and lots of OpenGL magic.
Pages: [1]
  ignore  |  Print  
 
 

 
Riven (45 views)
2019-09-04 15:33:17

hadezbladez (4025 views)
2018-11-16 13:46:03

hadezbladez (1468 views)
2018-11-16 13:41:33

hadezbladez (4048 views)
2018-11-16 13:35:35

hadezbladez (780 views)
2018-11-16 13:32:03

EgonOlsen (4098 views)
2018-06-10 19:43:48

EgonOlsen (4685 views)
2018-06-10 19:43:44

EgonOlsen (2762 views)
2018-06-10 19:43:20

DesertCoockie (3657 views)
2018-05-13 18:23:11

nelsongames (3867 views)
2018-04-24 18:15:36
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45
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!