adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Adonthell-devel] Shadow is back ... sort of


From: Kai Sterker
Subject: Re: [Adonthell-devel] Shadow is back ... sort of
Date: Mon, 26 Jan 2009 23:19:29 +0100

On Sat, Jan 24, 2009 at 9:54 PM, Kai Sterker <address@hidden> wrote:

>> What happens if the shadow covers surfaces with different heights? E.g. if
>> the character is walking up some stairs. Ideally the shadow will be split
>> and the portion covering each flat surface will be drawn with the
>> appropriate offset. However, I'm guessing that might be tricky to implement.
>
> I guess it might be reasonably simple to do that based on object
> bounding boxes.

I've got a concept implementation. It's committed, but not yet enabled
in the renderer. Some debugging is still needed. It works in the
following way:

During collision phase, we already retrieved all tiles beneath the
character to figure out the ground level. These are the tiles that
during rendering will potentially have the shadow on them.
So with only a minimum overhead, each of those tiles gets the shadow
object assigned.
Of course, these tiles might be so far below the character, that the
shadow would not be visible on the mapview. In that case, those tiles
do not even appear during rendering.

If a tile gets rendered, we will also draw the shadow. We use the
object bounding box to clip the shadow to this tile. Afterwards, we
subtract the clipping rectangle from the shadow area, so that this
part of the shadow will not be drawn on the next tile.

After each frame, we need to reset the shadow area to its original
extend. All in all, the shadow object is only created once, so it
should be pretty efficient.


>> Also, can we have shadows shrink if the character is higher above the
>> ground? Alternatively, we could just fade the shadow (i.e. make it more
>> transparent).

> Nice idea :-). Since we know the character's height above ground, we
> can pretty easily change alpha based on that.

Since that is the simplest solution, I did just that. There's another
reason, however. Since the view is isometric, we wouldn't normally
have any foreshortening of objects. So I think it would not be
appropriate for the shadow either. OTOH, we do have code in v0.3 to
scale an image, so it still might be something to do if the alpha
change doesn't look nice.

Kai

P.S.: James, do you still have those high grass tiles around?
http://lists.nongnu.org/archive/html/adonthell-artwork/2008-05/msg00000.html
While I don't think I can include them right now, I'd like to have
them around for after the alpha 3 release.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]