View Full Version : Simple Shadow Casting in a 2D environment
I seem to have hit a snag with Tactionage...
I need a light source, or several really, to cast shadows, and the math is just way beyond me.
If anybody knows of a simple way yo cast HARD shadows, or a place to learn, please let me know.
Left 4k Dead (http://www.mojang.com/notch/j4k/l4kd/) is a STELLAR example of how the corners cast shadows...
If I find out how, I'll definitely be letting you know! ;P
Fengol
28-10-2009, 08:58 PM
Here's a GameDev.net article on shadows http://www.gamedev.net/reference/programming/features/2dsoftshadow/ hard-edged shadow casting is also included
Chippit
28-10-2009, 09:07 PM
Heh, I actually did something like this (soft shadows and everything) a few months back, and my solution is almost exactly like that explained on the gamedev.net article. Would've been really nice if I'd known about it then, it'd have saved me a lot of thinking, and a lot of trouble. Plus their way of getting the penumbra's vector is a little better than mine.
Nice piece, though.
Nandrew
29-10-2009, 03:50 PM
Chippit vs GDNet, FIGHT!
Though it's lovely to see your own initiative vindicated when an authority basically posts the same technique elsewhere. :P
@Chippit: You did a BscIT right? I'm seriously missing the formal math now that I'm working with these sorts of problems. One really wouldn't believe how much of just my matric maths I needed to go dig up! (TRIG is a masterpiece of pain and produce!)
Still considering upping my education through unisa. In your opinion is it worth it? Or should I just learn the math I need along the road?
Chippit
31-10-2009, 12:22 PM
That's right, yeah. Frankly, though, most of the stuff I learned, I did so on my own and not through varsity. Not everyone learns like me, though, and you should never really frown on some additional knowledge, however you decide to get it. ;)
dislekcia
02-11-2009, 03:31 PM
Personally, I'm all for figuring things out on your own. You're always going to be doing the implementation part of any alg or maths you learn, so the self-learning part happens naturally. Where you get the references from is up to you, but generally I tend to dislike structured courses because the internet's free and there are exactly 0 courses out there structured to help ME right now.
herman.tulleken
02-11-2009, 04:27 PM
I agree with what dislekcia is saying, formal courses are useless for the right-now real-world problems. Figuring stuff out on your own is also the best way to internalise knowledge.
However, formal courses can also have advantages, especially with subjects like mathematics. Often, a course will give a a bit of breadth that is not so easy to obtain on your own. In my own experience I have worked on a lot of problems that I would not be able to solve (in a good way) if I had not known some piece of mathematics or programming construct existed (often because it is not normally used for the purpose I wanted to use it, so no amount of Googling would enlightened me). Not to mention the fact that it is very hard to search for stuff if you don't know the basics already.
Also, mathematics especially has this annoying property that you need a whole chain of knowledge to understand anything. If you select a random math article from Wikipedia, chances are good you won't understand it. And you will spend a very long time trying to figure out the chain of knowledge you have to acquire to understand it.
Another thing that applies mostly to mathematics: it has this weird thing that if you only know a little bit, you can almost do anything. (I have seen the strangest - but working - solutions of geometry problems solved mechanically in a game engines.) But the more you know, the better (simpler and often faster) your solutions become. Thus you don't necessarily see that more math could be useful until you have it, which means you will probably not find it on your own.
That said, if you do learn it as you go along, do not just use the internet - also buy a few thick books that can help ground your knowledge. One of my favourite books that provide a good mathematical base (but not too detailed) is Real-time collision detection (http://www.amazon.com/Real-Time-Collision-Detection-Interactive-Technology/dp/1558607323) - look for similar titles.
dislekcia
02-11-2009, 09:50 PM
Yeah, having an overview in which to slot the stuff you're figuring out is a great way to go about it. However, I just don't feel that many courses really help with this. Often formal courses tend to confuse more than they grant a bigger picture to colour in yourself, but that could just be me ;)
Strongly suggest a bunch of good game programming books too! Those are always a good idea.
Powered by vBulletin® Version 4.2.4 Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.