Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / 2D Dynamic Lighting

Author
Message
flashing snall
19
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 30th Apr 2012 20:21 Edited at: 30th Apr 2012 20:21
Hey guys
So for a long long LONG time, I have wanted to create some 2D dynamic lighting. I remember banging my head into the keyboard with DBPro for a long time, but I was not but a young-in back then. On Friday I took another crack at this with xna. I know that if I were serious, Shader based lights and shadowing would be the way to go, but since my understanding of shaders is poor, and I want shadows NOW, I wanted to find another way.

My current iteration of lighting and shadowing is pretty crummy. It only allows for about 10 lights at reasonable performance. Need to work on it. But, I am never the less pretty proud of it. If anyone is interested in delving into this stuff, let me know!

Below is a picture that compares different edge techniques.



Attachments

Login to view attachments
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 30th Apr 2012 22:23
What's 2D lighting? Are you lighting sprites?

WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 1st May 2012 01:45
That's a pretty neat effect set you have there. Are they work out by polygons?

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
flashing snall
19
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 1st May 2012 06:37
So its more 2D shadowing that is the key thing I guess. I am not using DBP, and now really using sprites either. There are sprites, but in a backwards sort of way.

I have not really looked online for help for this, so this is me just pondering away, but how I currently have it set up is the following

For each light, there is a gradient sprite drawn. But before it is done rendering, the shadows are drawn ontop of it with an erasing effect, such that the light sprite only appears where it should. Then the image is drawn to the scene, and each light follows the same pattern.

What really stinks is that each light has to be drawn to a new image. I would really like to find a way to avoid that problem, and not do it by casting out rays, because that is also not that fun....


To work out the shadows to draw, they are drawn as polygons. The system is pretty straight forward. Step 1 is to find the outtermost vertices, and step 2 is to project some points from each selected vertex to the light source, outwards for awhile, and draw a polygon on the now four determined vertex points.

flashing snall
19
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 9th May 2012 07:44
just updating...


MrValentine
AGK Backer
14
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 9th May 2012 09:44
just joining in to see what comes next...

flashing snall - you make these in C# dont you?

it might make more sense if you stated the languages used too... helps avoidance lol

but if you are showing the mechanics then

I always enjoy your videos... keep them coming... but that video got me confused in the beginning... those shadows looked like 3D pillars... so not entirely clear what's actually the point of the video aside from fancy shadows and lights...

TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 9th May 2012 09:47 Edited at: 9th May 2012 09:49
He stated in the first post that he's using XNA

TheComet

Nateholio
19
Years of Service
User Offline
Joined: 30th Dec 2005
Location: I\'ve Been Everywhere
Posted: 9th May 2012 09:49
That's pretty darn cool!

In Development: K96 - Combat Simulation
Keep your Hope and Change, I choose individual Liberty!
MrValentine
AGK Backer
14
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 9th May 2012 11:06
Quote: "He stated in the first post that he's using XNA"


me = needs breakfast...

greenlig
21
Years of Service
User Offline
Joined: 30th Aug 2003
Location: Melbourne
Posted: 9th May 2012 11:19
I like. I read a few good tutorials on TIGsource that detailed this. It's a pretty easy method to implement, once you get your head around the maths. I wanted to do something similar in AGk but it doesn't have the ability to draw primitive geometry. A simple polygon tool would do the trick!!

Really cool, though. I look forward to seeing more!

Greenlig

Your signature has been erased by a mod as it is far too big.

Login to post a reply

Server time is: 2025-05-21 16:42:10
Your offset time is: 2025-05-21 16:42:10