|
|
I simply take the vertex that I am lighting, and subtract the height of the vertex to the north of it. The greater the difference, the lighter the polygon. If it's the other way around, where the northern vertex is actually higher, then the polygon is darker.
Um... did you make this up yourself? Or did you read about it somewhere?
Is it just me, or is this pure genius? Fast, simple, and elegant. I've never seen this before. I must be missing something...
I assume using the Northern vertex is an arbitrary choice for this algorithm, right? I think you should use East or West, since the Sun 'travels' East to West. Shadows would be either afternoon or morning shadows, instead of "Earth has flipped its rotational axis ninety degress and now the Sun sets in the South" shadows.
Furthermore, you could use a weighted average of the East and West vertexes, weighting each one differently over time, thus having shadows that would would slowly transition from morning shadows, to Noon shadows (i.e., East and West vertexes are weighted equally, giving you basically no shadows), to evening shadows, to night (where again East and West vertexes are weighted equally, but both are subtracted, instead of both added, so you'd have a dark landscape).
I gotta try this out...
btw: I am only 14, I have written several 'Quake' style fps engines before, but after seeing the Halo movies, I just had to do this project ;)
Good grief! Amazing...
--Derek Simkowiak
dereks at realloc dot net
|