Semi-procedural shadows

Production of artwork for the game by regular contributors takes place here.

Moderator: Forum Moderators

User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Semi-procedural shadows

Post by zookeeper »

So, do you think the benefits of not having to draw soft shadows into the unit images and frames themselves would be a big enough benefit to endure a bit messy and unrealistic shadow shapes?

I think it should be possible to procedurally generate shadows that look about as good as the ones I've drawn in the attached mock-up. I did these by:

- erasing the existing shadow.
- duplicating the image and blackening it.
- flipping it vertically and squeezing it to about one third of the original height.
- positioning it so that the vertical center of the "shadow" is placed at the level of the units feet.
- gaussian-blurring it and setting opacity to 60%.

Pros:
- no need to draw shadows into the images, which is more work especially in animations.
- consistent shadow style (currently we use both soft and sharp shadows, and converting all manually to a uniform style would be a lot of work).
- shadows might feel more "alive" in animations as they'd always change according to the unit's movement.
- might be possible to apply some very small small shearing or skewing effects to the shadows to simulate changes at different times of day, for example.

Cons:
- inherently unrealistic: real shadows obviously aren't cast like this, and it can be seen.
- might not work on some really odd-shaped units, so one would still need to manually draw the shadows for them.

For the sake of the argument, let's assume for a moment we could do this without much trouble code-wise (also, this would of course be a long term goal, probably dependant on the other possible big graphics engine changes). Do you think this would be worth having, as opposed to the current way of manually drawing shadows?
Attachments
Sorry for the missing TC!
Sorry for the missing TC!
procedural_shadows.png (356.16 KiB) Viewed 7231 times
User avatar
JW
Posts: 5047
Joined: November 10th, 2005, 7:06 am
Location: Chicago-ish, Illinois

Post by JW »

They look fine to me. It seems like an interesting idea. I definitely like the out-of-the-box thinking.
User avatar
Noyga
Inactive Developer
Posts: 1790
Joined: September 26th, 2005, 5:56 pm
Location: France

Post by Noyga »

IMHO it wouldn't work welll for a bunch of some units :
- Some undead spirits
- Boats
- Woses
- Tentacles of the Deep
- Some flying-only units like birds or dwarvish copters
...
"Ooh, man, my mage had a 30% chance to miss, but he still managed to hit! Awesome!" ;) -- xtifr
User avatar
Eleazar
Retired Terrain Art Director
Posts: 2481
Joined: July 16th, 2004, 1:47 am
Location: US Midwest
Contact:

Re: Semi-procedural shadows

Post by Eleazar »

zookeeper wrote:- positioning it so that the vertical center of the "shadow" is placed at the level of the units feet.
How is a program going to know where that is?

Personally i don't think the Pros outweigh the Cons.
Feel free to PM me if you start a new terrain oriented thread. It's easy for me to miss them among all the other art threads.
-> What i might be working on
Attempting Lucidity
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Semi-procedural shadows

Post by zookeeper »

Eleazar wrote:
zookeeper wrote:- positioning it so that the vertical center of the "shadow" is placed at the level of the units feet.
How is a program going to know where that is?
Because they're all supposed to be at the same level (after we get the graphics engine fixed and can actually do it for even the big units), except for some rare units, for which there could be the possibility to specify override coordinates.

And here's how an ancient wose and a wraith could look like approximately.
Attachments
procedural_shadows_wose_and_wraith.png
procedural_shadows_wose_and_wraith.png (38.49 KiB) Viewed 7176 times
User avatar
Jetrel
Posts: 7242
Joined: February 23rd, 2004, 3:36 am
Location: Midwest US

Re: Semi-procedural shadows

Post by Jetrel »

Doing it the current way really only provides a marginal improvement over this idea, and only if the shadows are very well made on all frames. This idea forces all shadows to meet a fairly good level of quality. Not the masterful illustrations of the unit's 3d volume falling beneath it that will occasionally show up here, but decent shadows nonetheless, and ones that move when the unit does. Most contributors butcher the shadows on their units, and even some of the good ones tend to put little effort into getting them right. They're a perpetual afterthought.

In my experience, with shadows in videogames, fluidity of motion triumphs. The shadows in Bungie's Myth series were breathtaking for their technological timeframe, despite being very blurry.


I think that this has a number of issues with trying to implement this in our existing engine, so we shouldn't do this now, but if (or more accurately when) we move to an OpenGL-based engine, which could well be before 1.4 or 1.6, we should do something a lot like this.

There are other crazy ideas that could follow from there, but those aren't worth discussing now.
Noyga wrote:IMHO it wouldn't work well for a bunch of some units :
- Some undead spirits
- Boats
- Woses
- Tentacles of the Deep
- Some flying-only units like birds or dwarvish copters
...
1] some units could be flagged to never have shadows
2] units could lose their shadow while in the water; or more interestingly, could have a shadow properly applied to the water's surface.
3] Flying units, under a proper graphics engine, would be able to change their height over their hex at will. The shadow would remain at the same spot below them, if only their "height" was supposed to be changing.
zookeeper wrote:
Eleazar wrote: How is a program going to know where that is?
Because they're all supposed to be at the same level (after we get the graphics engine fixed and can actually do it for even the big units), except for some rare units, for which there could be the possibility to specify override coordinates.
With a 'real' graphics engine, we'd be drawing everything relative to keypoint offsets, so the program *would* know where that is.
User avatar
Eleazar
Retired Terrain Art Director
Posts: 2481
Joined: July 16th, 2004, 1:47 am
Location: US Midwest
Contact:

Re: Semi-procedural shadows

Post by Eleazar »

Jetryl wrote:2] units could lose their shadow while in the water; or more interestingly, could have a shadow properly applied to the water's surface.
This would be interesting.
Jetryl wrote:3] Flying units, under a proper graphics engine, would be able to change their height over their hex at will. The shadow would remain at the same spot below them, if only their "height" was supposed to be changing.
I don't understand why (in the constraints of the Wesnoth interface) a unit should be able to do this. If you mean units could have different "altitudes" which would effect the game, that's not compatible with the "do everything neccesary with left-click" design concept.

The point is nearly moot, since we don't currently have the capacity to implement this, but i still see this as an over-all negative.

These examples are so blurred that any but the most extreme animation would be virtually invisible. Basicly we loose the capacity to have really nice shaddows when the unit is standing still. (Big negative) This is when the difference between good and mediocre shadows is really noticeable. I don't think the animation (or lack thereof) of the shadows is very apparent in game, with all the bobbing and damage numbers flying around.
Feel free to PM me if you start a new terrain oriented thread. It's easy for me to miss them among all the other art threads.
-> What i might be working on
Attempting Lucidity
Darth Fool
Retired Developer
Posts: 2633
Joined: March 22nd, 2004, 11:22 pm
Location: An Earl's Roadstead

Post by Darth Fool »

Ok, speaking from the coding end, this would not be too difficult, now that images can have functional modifications added to them in a consistent manner. It would not require any major overhaul of the engine. All the major changes were started with the introduction of image path functions and have essentially been completed with the recent changes to how team coloring works. All that would be needed is a function to generate a shadow image from the original and a height to place it at. In WML the unit designer would do something like:

Code: Select all

image="units/left-handed/jabber/wockey.png~sh(10)"
This would allow a mix of units that had good shadows already in the image and those that didn't. Heck, it would even allow a mix of images in a single unit that had a shadow in some images and other images that didn't, although for sanity's sake I would recommend against doing that. The performance would not be seriously hit as the shadowed images would be stored in the cache when the unit is first seen, and since most images already will have to be modified because of team coloring, the addition of a shadow probably won't even make a significant dent on the memory usage. So, from a technical coding perspective I would say that there is no problem with this and zookeepers assumption is a good one.

Now, do I think that it is a good idea? I tend to agree with eleazar on this that it doesn't seem to me to be that great an idea as presented. Shadows in animations are not a major distraction. I mean, you will generally notice if a unit doesn't move his feet when he moves, but you generally won't notice if the shadow is identical when he is moving. At least, I don't. This might be an improvement over some of the shadows that currently are used in animations where people just copy the base animation's shadow, but I don't think it matters much there. As has been said, where it really matters is in the standing frame, and a well crafted shadow in the standing frame is going to beat this hands down. Do we have enough good standing frame shadows to justify not doing this, well I leave that decision in the hands of the artists. Basically, though, I don't see this as a great improvement by itself.

Now, where could this have an effect that might make it worth doing. Well, if in addition to the height one can specify a tilt, than you could actually add shadows at an angle, say as the sun passes overhead. Or even have multiple light sources with multiple shadows at different angles. All you need is the right image manipulation function and a string that defines the function and its parameters. Doing so will not effect speed directly, but would increase the memory allocation. For that reason you would probably want to have an option to turn off dynamic shadows. Would such a thing be worth it? I don't know. These shadows are pretty blurry, and I am not convinced that making them a little more dynamic and reacting to the time of day, would really be that big an improvement, at least not without seeing mockups first. Are blurry dynamic shadows better than crisp fixed shadows? I don't know.

So count me as abstaining for now. :|
User avatar
Jetrel
Posts: 7242
Joined: February 23rd, 2004, 3:36 am
Location: Midwest US

Re: Semi-procedural shadows

Post by Jetrel »

Eleazar wrote:
Jetryl wrote:3] Flying units, under a proper graphics engine, would be able to change their height over their hex at will. The shadow would remain at the same spot below them, if only their "height" was supposed to be changing.
I don't understand why (in the constraints of the Wesnoth interface) a unit should be able to do this. If you mean units could have different "altitudes" which would effect the game, that's not compatible with the "do everything neccesary with left-click" design concept.

The point is nearly moot, since we don't currently have the capacity to implement this, but i still see this as an over-all negative.
I mean units could have different "altitudes" that have only a graphical effect. We could take a ... floating orb unit, and could make it bob up and down a few pixels in it's hex as a standing animation - without redrawing a single frame.

All of that would be scripted in WML, none of it "burned into" the images.
torangan
Retired Developer
Posts: 1365
Joined: March 27th, 2004, 12:25 am
Location: Germany

Post by torangan »

Driving this into the extreme, Wesnoth could link to ImageMagick and offer its capabilities through WML. Then you could have lots and lots of computed effects without drawing new images.
I wanted to write this as a joke but while writing I start to doubt: is it really nonsense or only overkill?
WesCamp-i18n - Translations for User Campaigns:
http://www.wesnoth.org/wiki/WesCamp

Translators for all languages required: contact me. No geek skills required!
Darth Fool
Retired Developer
Posts: 2633
Joined: March 22nd, 2004, 11:22 pm
Location: An Earl's Roadstead

Post by Darth Fool »

torangan wrote:Driving this into the extreme, Wesnoth could link to ImageMagick and offer its capabilities through WML. Then you could have lots and lots of computed effects without drawing new images.
I wanted to write this as a joke but while writing I start to doubt: is it really nonsense or only overkill?
Well, probably both. I don't think that we want to add a new dependency on image magick into the code.
Boucman
Inactive Developer
Posts: 2119
Joined: March 31st, 2004, 1:04 pm

Re: Semi-procedural shadows

Post by Boucman »

Jetryl wrote:
Eleazar wrote:I don't understand why (in the constraints of the Wesnoth interface) a unit should be able to do this. If you mean units could have different "altitudes" which would effect the game, that's not compatible with the "do everything neccesary with left-click" design concept.

The point is nearly moot, since we don't currently have the capacity to implement this, but i still see this as an over-all negative.
I mean units could have different "altitudes" that have only a graphical effect. We could take a ... floating orb unit, and could make it bob up and down a few pixels in it's hex as a standing animation - without redrawing a single frame.

All of that would be scripted in WML, none of it "burned into" the images.
it can be done in WML (1.3)

next question ?
Fight key loggers: write some perl using vim
User avatar
Eleazar
Retired Terrain Art Director
Posts: 2481
Joined: July 16th, 2004, 1:47 am
Location: US Midwest
Contact:

Post by Eleazar »

I consider the wose to the right, better shadowed, even though the blur has not been applied. With the Auto-shaddow the root-tips don't seem to penetrate into the soil, it almost looks like he's standing on the pointy tips of his roots. I expect similar problems to be common.

Sometimes the simplest way is best.

Though it would be cool if units like the griffin had detatched shaddows so they could bob as Jetryl is suggesting.
Attachments
wose.jpg
wose.jpg (47.68 KiB) Viewed 6868 times
Feel free to PM me if you start a new terrain oriented thread. It's easy for me to miss them among all the other art threads.
-> What i might be working on
Attempting Lucidity
Neoriceisgood
Art Developer
Posts: 2221
Joined: April 2nd, 2004, 10:19 pm
Contact:

Post by Neoriceisgood »

I'd like to say that I am 100% against this idea, those shadows are really displeasing to my eyes; they don't look like shadows but big ugly blobs of darkness.
Signature dropped due to use of img tag
User avatar
irrevenant
Moderator Emeritus
Posts: 3692
Joined: August 15th, 2005, 7:57 am
Location: I'm all around you.

Post by irrevenant »

I agree that the sample shot of procedurally-generated shadows is visibly inferior to the hand-drawn approach.

However, that means that the current algorithm could use some tweaking; not necessarily that there's anything wrong with the idea of generating shadows procedurally.

Just based on eyeballing, a couple of things that look worth trying are:

1. Reduce the amount of blur used ; the edges look too fuzzy to me.
2. Shift the shadows a pixel or two along the Y (I think) axis so they're not directly beneath the unit ; IMO that looks more natural (though as you pointed out, procedural shadows can shift with the time of day)
3. Add a minor shear/skew effect as suggested
4. Stretch the shadows a bit along the Y (I think) axis

5. Maybe even experiment with just casting fuzzy (slightly skewed) ellipses - a number of the existing units seem to just do that, and it looks quite effective.

I'm sure the artists in this thread can point out more precisely what it is about the example shadows that looks a little off and could use tweaking.
Post Reply