Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (710)
Games in Android Showcase (212)
games submitted by our members
Games in WIP (784)
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  
  Implementing 2D Light  (Read 1388 times)
0 Members and 1 Guest are viewing this topic.
Offline ghostsoldier23

Junior Devvie

Medals: 1

« Posted 2013-01-26 17:27:55 »

I believe I've posted a topic similar to this before, but it was quite a while ago.  My goal is also somewhat more narrow this time.

I'm aiming to create a lighting system that uses an image overlay over the main rendering canvas to create light/shadow effects.

I'm stuck primarily at how to actually efficiently draw the light geometry to the image.  I'm trying to avoid pixel-by-pixel iteration because it causes too much performance drop in the context of the rendering engine already.

Mathematically, I was planning on just using an inverse square relationship for light traveling:

L = A/(d^2)  | L is luminance, A is absolute luminance (at one unit distance), and d is distance.

The main problem is applying this efficiently AND detecting light collision with entities in world space.

In other words, how can I calculate the shadow area (especially for objects that aren't squares...) and then apply that lighting change to the image?

I'm looking for ideas and suggestions here, no specific method.  If you have any ideas that don't involve the light overlay, that's fine too.  I'm concerned about its performance anyway.
Thanks in advance for your help!
Offline ClickerMonkey

JGO Coder

Medals: 24

Game Engineer

« Reply #1 - Posted 2013-01-26 17:54:50 »

Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

theagentd (99 views)
2017-02-18 13:42:33

theagentd (103 views)
2017-02-18 13:35:16

h.pernpeintner (1268 views)
2017-01-24 22:39:11

h.pernpeintner (1257 views)
2017-01-24 22:38:32

Galdo (1816 views)
2017-01-12 13:44:09

Archive (1921 views)
2017-01-02 05:31:41

0AndrewShepherd0 (2459 views)
2016-12-16 03:58:39

0AndrewShepherd0 (2298 views)
2016-12-15 21:50:57

Lunch (2377 views)
2016-12-06 16:01:40

ral0r2 (2155 views)
2016-11-23 16:08:26
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21 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‑
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!