Sign in to follow this  
suliman

Day/night light and lightsources in 2d

Recommended Posts

Hi Im doing a topdown rpg like link to the past or diablo a bit. Its in 2d so no 3d effects are possible. I can simulate the darkness of night by just adding a transparent dark rectangle over the view making everything like ground, trees and units darker. The problem comes when trying to add lightsources like flashlight, streetlamps etc. I tried to add light by just drawing transparent additive cones/filled circles where the light should shine, but this doesnt work at all as it just makes eveything there brighter, but not easier to see. Any good idea on how this can be done? Thanks a lot Erik

Share this post


Link to post
Share on other sites
This is a different kind of effect, but a game I recently completed has day/night cycles in 2d, but no shadows which is really what you are after, I achieved the effect by simply rendering textures between 60% brightness or so (can't exactly remember) and 100% in time with the background's cycle:

http://www.m2tm.net/Programs/SkyFire.zip

This however may be of use:

http://www.gamedev.net/reference/programming/features/2dsoftshadow/

Share this post


Link to post
Share on other sites
The problem is that you first draw the dark rectangle, and than add the light-sources. What you need to do is to have a screensize bitmap/texture that represents the dark rectangle, draw the light sources on it, and than draw the entire thing on the entire screen.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this